Reputation: 1379
I'm using cross cluster search and searching for a document by _id that exists in both clusters. ES returns with 2 hits (1 in local index, 1 in remote index). I just want the one in the local index. How can I remove the duplicate from the remote cluster ?
Query :
{
"query": {
"terms": {
"_id": [ "123"]
}
}
}```
Upvotes: 0
Views: 449
Reputation: 1996
You should be able achieving this by using Field Collapsing
over the _id
-field and define a sorting condition in which documents from your local cluster rank higher (e.g a cluster id, or a timestamp etc)
(see Elasticsearch Reference: Field Collapsing)
Upvotes: 1