Query the last match by a field

Hey guys,

This might be a basic query but cannot figure it out.

Among the documents of a certain time window, I like to find the last one (by time) which matches by given field(s).
Any ideas?

FYI, I'm using the latest ES.

Thanks!
Ray

You could just sort the data and you would then know the first or last document of all the documents returned is the one you want. You could even set your fetch size to 1 and you would only ever get the document you wanted.

sort of a good example

Awesome! That's what exactly I was looking for.

Thanks Ed!

1 Like

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