"How to get the oldest document of all indexes matching an index pattern

Hello, is there a solution to get this information?

We don't add a timestamp metadata field to the documents so, not in general. If you added a timestamp to all the documents yourself then you can sort on it.

Thank's for reply i'm new on elastic, if possible please give me a short howto to build my own sort to all the documents (howto add a timestamp to all the documents... and to use it in a query) THK's for helping me :slight_smile:

You should take a look at this:


Just add a date field to the document you index, and then add a sort DESC to this field.

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