_cat/indices question

Can I check the latest document created time upon calling _cat/indices?

Like for example i want to see if the latest document inside the index is 10 days older

Thank you

the _cat indices API only contains information when the index has been created. But in order to find out if a document is older than 10 days you should query the index and search for a timestamp.

Can you please give an example of an efficient query that i can use, for example, fetchdocuments that has 10 days older using createdTime field

Thank you

use a range query, set the size parameter to 0, if you are only interested if there is a document. You can also set the terminate_after parameter to 1 to abort early. See https://www.elastic.co/guide/en/elasticsearch/reference/7.3/search-request-body.html