Hello all, First of all, I am very new to Solr.
I am using Solr version 6.4.1. I have a Solr core (non-cloud), where there is a mandatory unique key field called "id". I am trying to add documents to the core from Java, without having to specify the "id" field explicitly; i.e. to have it auto-generated. I learned that this is possible by including the following information in the conf/solrconfig.xml file: > <updateRequestProcessorChain name="add-unknown-fields-to-the-schema"> > <!-- UUIDUpdateProcessorFactory will generate an id if none is present > in the incoming document --> > <processor class="solr.UUIDUpdateProcessorFactory"> > <str name="fieldName">id</str> > </processor> > ... > <processor class="solr.LogUpdateProcessorFactory"/> > <processor class="solr.DistributedUpdateProcessorFactory"/> > <processor class="solr.RunUpdateProcessorFactory"/> > </updateRequestProcessorChain> (I did restart the server after adding the above text to the xml file.) However, when I try to add documents from Java using SolrJ (without specifying the "id" field), I get the following exception: > Exception in thread "main" > org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error > from server at http://localhost:8983/solr/sales_history: Document is > missing mandatory uniqueKey field: id My Java code is like this: > SolrClient solr = new HttpSolrClient.Builder(SOLR_URL).build(); > SolrInputDocument document = new SolrInputDocument(); > document.addField(..., ...); > document.addField(..., ...); > UpdateResponse updateResponse = solr.add(document); The exception is thrown from the last line above. Is there any way to add documents from Java and have the uniqueKey field be auto-generated? Thank you