Compare IDs between two indices in elasticsearch -
i have 2 indices in elasticsearch cluster, containing ought same data in 2 different formats. however, number of records different. ids of each document should same. there way extract list of ids present in 1 index not other?
if 2 indices have same type these documents stored, can use this:
get index1,index2/_search { "size": 0, "aggs": { "group_by_uid": { "terms": { "field": "_uid" }, "aggs": { "count_indices": { "cardinality": { "field": "_index" } }, "values_bucket_filter_by_index_count": { "bucket_selector": { "buckets_path": { "count": "count_indices" }, "script": "params.count < 2" } } } } } }
the query above works in 5.x. if id field inside document, that's better test.
Comments
Post a Comment