How Can i get max id of indexed documents

I am new to elastic search. I indexed few of documents and i want to find the max id which ever inserted across the documents.

My URL something like ":/books/dramabooks/_search?size=0"
"aggs" : {
"max_id" : { "max" : { "field" : "id" } }


Note:request returning max_id value as null.

Could you please provide right query that should return maximum value of id.

Thanks in advance.


ID's are usually a SHA or UUID! There is no pattern of numerical ascendancy/descendancy to them to find out the max of, unless you are overriding the ID upon insertion!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.