Solr - Missing Required Field

2019-07-31 14:10发布

问题:

Solr is reporting that it is missing a required field (documentId) but the field and value are being passed to Solr. From the schema:

<fields>
   <field name="id" type="string" indexed="true" stored="true" required="true" /> 
   <field name="documentId" type="string" indexed="true" stored="true" required="true" /> 
</fields>

According to the Solr log, the documentId is being passed in:

org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/update/extract params={waitSearcher=true&commit=true
&literal.id=C:\documents\102\Comps+Database+BRD.docx&literal.documentId=102&w
t=javabin&waitFlush=true&version=2} status=400 QTime=489

Why would Solr then report:

org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: [doc=C:\documents\102\test.docx]
 missing required field: documentId

Edit Corrected typo in extract request, but still same error.

回答1:

For some reason, Solr doesn't like the "Id" suffix on field names. When I rename "documentId" to "document", I get no errors. It also failed on "testId", but worked when I renamed to "test". Does anyone know why "Id" field name suffix would cause solr to always report missing required field even when passed a value?



回答2:

it looks like there is an typo dcoumentId= while the filed definition uses documentId

you see the difference? dco... and doc....



标签: solr