Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

SolrException: Document [null] missing required field: id

1

53 views

I have changed the schema.xml file and added few fields in that like this

<field name="c_url" type="string" indexed="true" stored="true" />
   <field name="c_content_type" type="text" indexed="true" stored="true" />
   <field name="c_title" type="text" indexed="true" stored="true" />
   <field name="c_keywords" type="text" indexed="true" stored="true" multiValued="true" />
   <field name="c_text" type="text" indexed="true" stored="true" />
   <field name="c_timestamp" type="text" indexed="true" stored="true" />
   <field name="c_public" type="text" indexed="true" stored="true" multiValued="true" />
   <field name="c_groups" type="text" indexed="true" stored="true" multiValued="true" />
   <field name="c_sitename" type="text" indexed="true" stored="true" />
   <field name="c_context" type="text" indexed="true" stored="true" />
   <field name="c_modified_date" type="text" indexed="true" stored="true" />

so corresponding to these fields I have created one xml file and added some dummy data into that like this.

    <add><doc>
  <field name="c_url">http://www.google.com/</field>
  <field name="c_content_type">text/html</field>
  <field name="c_title">Testing Data</field>
  <field name="c_keywords">software</field>
  <field name="c_keywords">software_cycle</field>
  <field name="c_text">search</field>
  <field name="c_timestamp">2006-02-13T15:26:37Z</field>
  <field name="c_public">Optimized</field>
  <field name="c_public">Optimized_data</field>
  <field name="c_groups">Standards</field>
  <field name="c_groups">Standards_data</field>
  <field name="c_sitename">Google</field>
  <field name="c_context">Scalability</field>
  <field name="c_modified_date">2010-10-13T15:26:37Z</field>
  </doc></add>

And when I tried to reindex the data into solr like this:-

C:\apache-solr-3.2.0\example\exampledocs>java -Durl=http://localhost:7788/solr/u
pdate -jar post.jar *.xml
SimplePostTool: version 1.3
SimplePostTool: POSTing files to http://localhost:7788/solr/update..
SimplePostTool: POSTing file gb18030-example.xml
SimplePostTool: POSTing file hd.xml
SimplePostTool: POSTing file ipod_other.xml
SimplePostTool: POSTing file ipod_video.xml
SimplePostTool: POSTing file mem.xml
SimplePostTool: POSTing file monitor.xml
SimplePostTool: POSTing file monitor2.xml
SimplePostTool: POSTing file mp500.xml
SimplePostTool: POSTing file sd500.xml
SimplePostTool: POSTing file solr.xml
SimplePostTool: POSTing file text.xml
SimplePostTool: FATAL: Solr returned an error #400 Bad Request

I always get an error after text.xml file and If I remove this text.xml file then I don't get any error.. This is the below error I am getting if I include the text.xml file. Any help will be appreciated.

SEVERE: org.apache.solr.common.SolrException: Document [null] missing required field: id
        at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:336)
        at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:60)
        at org.apache.solr.handler.XMLLoader.processUpdate(XMLLoader.java:147)
        at org.apache.solr.handler.XMLLoader.load(XMLLoader.java:77)
        at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:67)
        at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
        at org.apache.solr.core.SolrCore.execute(SolrCore.java:1360)
        at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356)
        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864)
        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
        at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)
        at java.lang.Thread.run(Thread.java:662)

asked June 23, 2011 4:08 pm CDT
posted via StackOverflow

1 Answers

1
Best answer
 

You say you added a few fields (supposedly to the sample schema), but you don't mention what happened to the fields that were already there. I'm guessing you left the preexistent fields there, which means that id is still a required field (see here in the sample schema), therefore the error you see.

answered June 25, 2011 3:45 am CDT

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions