Where if anywhere does ES documentation explain about metadata, specifically index creation datetimes?

This in an application context, not "human consumption".

With a bit of searching I finally found this answer.

The up-to-date (v. 8.11) documentation for this appears to be here, "cat indices API". But there it says "cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get index API." There is mention there of this "h" parameter which the above answer referenced, but no information about the index creation datetime (however, it appears to work, i.e. it is possible to get the index creation datetime using the recipe from the linked answer).

Going to that "index API" page, I find nowhere, on any of those pages, anything about digging the index creation datetime out of metadata or settings or anything.

Does ES actually not want us to have access to the index creation datetime? Is use of this information discouraged? Is it deprecated and slated for removal from the API imminently?

Or is this another example of the ES API documentation not really being up to scratch?

If anyone knows where this is documented (ideally for an application context*) please tell me.


* obviously the "human consumption" output can be used by an application, as plain text, not a JSON object. But ES on that page is fairly explicitly saying "don't use that for an app, use something else."

I would recommend using the get index settings API: GET /_settings?human&filter_path=*.settings.index.creation_date_string. I don't see this documented anywhere, which is definitely a bug. It's not deprecated or slated for removal or anything.

2 Likes

FIXED: To add a little more context, this field is used by ILM processes.

See David's explanation below.

Here Explain lifecycle API and Here Explain data stream lifecycle

ILM is nothing to do with setting this property, it pre-dates ILM by a very long time and will be set on all indices whether ILM-managed or not. It's true that ILM does use it tho.

@DavidTurner Thanks!

Not sure why I was thinking only created by ILM DOH!

All indices... :slight_smile:

# POST discuss-test/_doc 201 Created
{
  "_index": "discuss-test",
  "_id": "s2Q-x4wBxDuM4iqpphjE",
  "_version": 1,
  "result": "created",
  "_shards": {
    "total": 2,
    "successful": 2,
    "failed": 0
  },
  "_seq_no": 1,
  "_primary_term": 1
}
# GET discuss-test/_settings?human&filter_path=*.settings.index.creation_date_string 200 OK
{
  "discuss-test": {
    "settings": {
      "index": {
        "creation_date_string": "2024-01-01T22:55:25.773Z"
      }
    }
  }
}
1 Like

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