peter_rui
peter_rui

Reputation: 31

solr uuid with error document is missing mandatory uniquekey field id

I tried to generate id using UUID techniques, but the following errors occurs in data import process.

org.apache.solr.common.SolrException: Document is missing mandatory uniqueKey field: id

Here is my configuration files:

managed-schema

<field name="id" type="uuid" indexed="true" stored="true" multiValued="false" />
<fieldType name="uuid" class="solr.UUIDField" indexed="true" />

solrconfig.xml

 <requestHandler name="/update" class="solr.UpdateRequestHandler">   
        <lst name="defaults">  
            <str name="update.chain">uuid</str>  
        </lst>  
      </requestHandler>  


<updateRequestProcessorChain name="uuid">  
    <processor class="solr.UUIDUpdateProcessorFactory">  
        <str name="fieldName">id</str>  
    </processor>  
    <processor class="solr.RunUpdateProcessorFactory" />  
    <processor class="solr.DistributedUpdateProcessorFactory" />
</updateRequestProcessorChain> 

And my solr version is 6.3

Upvotes: 0

Views: 1595

Answers (1)

peter_rui
peter_rui

Reputation: 31

I have got the solution. The configuration above is for solr 4.X version. Now for the new version, the config in solrconfig.xml should be like this:

<requestHandler name="/dataimport" class="solr.DataImportHandler">
    <lst name="defaults">
      <str name="config">data-config.xml</str>
      <str name="update.chain">uuid</str>
    </lst>
 </requestHandler>

<updateRequestProcessorChain name="uuid">
      <processor class="solr.UUIDUpdateProcessorFactory">
          <str name="fieldName">id</str>
      </processor>
      <processor class="solr.RunUpdateProcessorFactory"/>
</updateRequestProcessorChain>

Upvotes: 3

Related Questions