2017-03-07 10:37
采纳率: 100%
浏览 53

从Apache Solr中的CSV文件索引数据

I have followed the tutorials given in below link

Indexing csv file in solr

I have configured solr server in my local and

But when i try to post csv file using the below command

java -Dtype=text/csv -Durl=http://localhost:8983/solr/jcg/update -jar post.jar  books.csv

I am getting below error response in command prompt

Any one help why i am getting the error response


<lst name="responseHeader"><int name="status">400</int><int name="QTime">111</int></lst><lst name="error"><lst name="metadata"><str name="error-class">org.apache.solr.common.SolrException</str><str name="root-error-class">org.apache.solr.common.SolrException</str></lst><str name=
"msg">ERROR: [doc=0553573403] unknown field 'cat'</str><int name="code">400</int></lst>

图片转代码服务由CSDN问答提供 功能建议





  java -Dtype = text / csv -Durl = http:// localhost:8983 / solr / jcg / update -jar post.jar books.csv 

I 我在命令提示符下面得到以下错误响应


错误: < / p>

 &lt; response&gt; 
&lt; lst name =“responseHeader”&gt;&lt; int name =“status”&gt; 400&lt; / int&gt;&lt; int name =“QTime  “&gt; 111&lt; / int&gt;&lt; / lst&gt;&lt; lst name =”error“&gt;&lt; lst name =”metadata“&gt;&lt; str name =”error-class“&gt; org.apache.solr  .common.SolrException&lt; / str&gt;&lt; str name =“root-error-class”&gt; org.apac  he.solr.common.SolrException&lt; / str&gt;&lt; / lst&gt;&lt; str name = 
“msg”&gt;错误:[doc = 0553573403]未知字段'cat'&lt; / str&gt;&lt; int name =  “code”&gt; 400&lt; / int&gt;&lt; / lst&gt; 
&lt; / response&gt; 
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dquv73115
    dquv73115 2017-03-07 13:21

    The tutorial you're following is quite old, so if you want follow the tutorial there are two options:

    1. the tutorial you're following misses the creation of Schema configuration in jcg collection. In this case you should fix your managed-schema file to jcg configuration taking care to add the following fields as suggested in the Tutorial, then reload the configuration (or restart Solr). At this point the "Indexing the Data" step should work correctly.
     <!-- 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"/>
     <field name="inStock" type="boolean" indexed="true" stored="true"/>
     <field name="author" type="text_general" indexed="true" stored="true"/>
    1. You have correctly added schema and fields but not reloaded the configuration, but not reloaded the collection. So just reload the configuration (or restart Solr) and continue with the tutorial.

    On the other hand, if you're using an earlier version of Solr (6.4) I suggest to delete jcg collection and create it again:

    bin/solr delete -c jcg
    bin/solr create -c jcg -d ./server/solr/configsets/sample_techproducts_configs  
    点赞 评论