Hello there!
I've been wondering if there's a way to get the total number of duplicate data in Elasticsearch?
I'm using this query to get the duplicates, but somehow, even browsing the web, I can't find enough information about this. Somebody suggested to use a watch condition script, but I don't know how to start it off.
POST /sampleindex/_search
{
"size": 0,
"aggs": {
"duplicateCount": {
"terms": {
"field": "costInvoiceNumber",
"min_doc_count": 2
},
"aggs": {
"duplicateDocuments": {
"top_hits": {}
}
}
}
},
"query": {
"range": {
"costInvoiceDate": {
"gte": "2017-01-31",
"lte": "2017-02-03"
}
}
}
}
Any response is highly appreciated. Thank you!