In my Elasticsearch index I have duplicates docs where some "unique" fields have the same values.
In order to fix them, I have to find them, so I'm using an aggregation query with min_doc_count=2
. The problem is that I manage to run it only with one key and not with a couple of keys. So in this way it works:
GET /my_index/_search
{
"size": 0,
"aggs": {
"receipts": {
"terms": {
"field": "key1",
"min_doc_count": 2,
"size": 1000000
}
}
}
}
I'd like to have **two terms that simultaneously match, but how to insert a double field
key2
?
Any idea?
I tried with multi-terms aggregations, like this (I don't know if the syntax is correct):
GET /my_index/_search
{
"size": 0,
"aggs": {
"receipts": {
"multi_terms": {
"terms": [
{
"field": "key1"
},
{
"field": "key2"
}
],
"min_doc_count": 2,
"size": 1000000
}
}
}
}
but I get this errror:
{
"error" : {
"root_cause" : [
{
"type" : "parsing_exception",
"reason" : "Unknown aggregation type [multi_terms] did you mean [rare_terms]?",
"line" : 5,
"col" : 26
}
],
"type" : "parsing_exception",
"reason" : "Unknown aggregation type [multi_terms] did you mean [rare_terms]?",
"line" : 5,
"col" : 26,
"caused_by" : {
"type" : "named_object_not_found_exception",
"reason" : "[5:26] unknown field [multi_terms]"
}
},
"status" : 400
}