I have few duplicate documents under a particular index . Is there any way to skip the duplicate entry through elastic query ?
I have following documents under a index. Now I want a single document through elastic query based on status field. Means if we have 10 documents having "status: done" , it should return only single document (latestone)
Size =1 would be fine if there is only single status (done). But if we have some other status as well then this should not work , right ?
Let me give the complete example here:
That would help not spending time with wrong answers. Please do that next time.
It's always better to provide a full recreation script as described in About the Elasticsearch category. It helps to better understand what you are doing.
A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.
Anyway, you can run a terms aggregation and then a top_hits agg with size:1 in it.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.