I'm trying to only import certain columns of a CSV
file into Solr, but I'm not sure how to do this or if this is even possible with Solr. Currently, I'm using one of the books.csv
examples that came with the Solr installation (can be found in C:\solr-5.2.1\example\exampledocs).
The below xml
that I put in the schema.xml
file works if all fields are included, but if I comment some fields out, Solr complains about unknown fields that are the ones commented out.
<uniqueKey>id</uniqueKey>
<!-- Fields added for books.csv load-->
<field name="cat" type="text_general" indexed="true" stored="true"/>
<field name="name" type="text_general" indexed="true" stored="true"/>
<field name="price" type="tdouble" indexed="true" stored="true"/>
<!-- these columns commented out
<field name="inStock" type="boolean" indexed="true" stored="true"/>
<field name="author" type="text_general" indexed="true" stored="true"/>
-->
Because the post script in C:\solr-5.2.1\bin is a shell
script and wont run in Windows, which I am using, I need to use the post.jar
file located in the same place as the books.csv
file.
java -Dtype=text/csv -Durl=http://localhost:8983/solr/jcg/update -jar post.jar books.csv