On 10/1/21 10:51 AM, KARTHIK SHIVAKUMAR wrote:
Problem : Error from server at http://localhost:8081/solr/Log-Test: Document is
missing mandatory uniqueKey field: id.
Process : I have written a small Solr-Client code to push content to
solr-indexer on port 8081
Question : I have encountered this problem for the first time and did not find
any proper solutions on www for the same.
Request : How to fix this With-Out introducing 'id' as another parameter passed
on from content side ??.
The entire point of uniqueKey is that every document will have something
in that field, and that if an existing document has the same value in
that field as a document that is being indexed, it is deleted and the
new document takes its place. By design, if you have a uniqueKey field,
every submitted document must have a value in that field. A uniqueKey
is required for several Solr features, including distributed indexes
(those with more than one shard).
There is an existing update processor that can fill in a field with a
random UUID if the field doesn't exist in the submitted document. But
note that if you do use this, you will no longer be able to have Solr
automatically replace that old document with a new one without some
extra work, because nothing outside of Solr will have any knowledge
about what the uniqueKey field contains for that document.
I hope that gives you a direction.
Thanks,
Shawn