Need to get Elastic Search current highest id


(Phani Nadiminti) #1

Hi All,

I am new to elastic search. I am working on river jdbc mysql concepts I
have a scenario like I need to get highest value for field "id" that is
inserted in to elastic search.please suggest me how to build this query to
get highest value for id inserted.

Thanks & Regards,
phani.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/cafd8ae1-aaa8-4e97-ae75-349c9d59c84c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Phani Nadiminti) #2

Hi,

I got the solution to get max id .

GET /index/type/_search
{
"aggs" : {
"max_id" : { "max" : { "field" : "id" } }
}
}

Thanks
phani


(system) #3