-1

i have three docs to be indexed into solr . sample of the 3 docs has been given below.

Doc 1:{ name:"alex" age:"25"}
Doc 2:{ name:"alex" age:"29"}
Doc 3:{ name:"benu" age:"29"}

Suggest me a way to index this.

UMA MAHESWAR
  • 167
  • 3
  • 16

2 Answers2

0

So if name is not unique, why is it the uniqueKey?

You have the option to give overwrite=false in the update request if you want to override the uniqueKey requirement for certain updates, but be aware that this will require that parameter to be present for any request that updates documents.

It's usually far better to assign a uniqueKey to each row (such as a uuid), or use an existing one (like the id of the row in the database).

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
0

In order to index the above 3 documents , i just removed the unique key( mentioned below) in the managed schema and it works perfectly.

 <uniqueKey>name</uniqueKey>

In case if removing this throws a QueryElevate exception, remove the searchComponent named elevator in the solrconfig.

UMA MAHESWAR
  • 167
  • 3
  • 16
  • But not having a uniqueKey will break many features in Solr. It's far from an ideal situation. – MatsLindh Nov 20 '18 at 09:11
  • @MatsLindh can you please quote some major disadvantages that we have if we remove the uniquekey feature in schema? – UMA MAHESWAR Nov 20 '18 at 11:21
  • 1
    You won't be able to use [efficient deep pagination using cursorMarks](https://lucene.apache.org/solr/guide/6_6/pagination-of-results.html), you won't be able to update an existing document, you won't be able to explicitly delete one document of a set of duplicates (where information is identical). Any operation that requires referencing one specific document will either be more complicated if the feature supports giving it a query (and at least one field differ between them), or impossible to retrieve. Some Streaming Expressions require a unique id for a document, etc. Add a unique key. – MatsLindh Nov 20 '18 at 12:25