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


#1

Hello, is there a solution to get this information?


(Nik Everett) #2

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.


#3

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:


(Xavier Facq) #4

You should take a look at this:

https://www.elastic.co/guide/en/elasticsearch/reference/5.1/search-request-sort.html#search-request-sort

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


(system) #5

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