Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out the index creation date in elasticsearch

How to find out the index created date in elastic search?

like image 431
Johnsa Philip Avatar asked Feb 19 '14 06:02

Johnsa Philip


People also ask

How do I search index in Elasticsearch?

You can use the search API to search and aggregate data stored in Elasticsearch data streams or indices. The API's query request body parameter accepts queries written in Query DSL. The following request searches my-index-000001 using a match query. This query matches documents with a user.id value of kimchy .

How do I get an index name in Elasticsearch?

Use Kibana to list indices for Elasticsearch. As with the terminal-based cURL requests, Kibana should return the status, name and UUID for each index.

How do I search all indexes in Elasticsearch?

To search multiple data streams and indices, add them as comma-separated values in the search API's request path. The following request searches the my-index-000001 and my-index-000002 indices. You can also search multiple data streams and indices using an index pattern.

Where are indexes stored in Elasticsearch?

By default, Elasticsearch indexes all data in every field and each indexed field has a dedicated, optimized data structure. For example, text fields are stored in inverted indices, and numeric and geo fields are stored in BKD trees.


2 Answers

Elasticsearch now automatically includes the creation date for an index, for example:

If I create a new index (with no settings)

curl -XPOST 'localhost:9200/aoeu'
{"acknowledged":true}

I can now 'get' the index to retrieve its metadata:

curl -XGET 'localhost:9200/aoeu'
{
  "aoeu": {
    "aliases": {},
    "mappings": {},
    "settings": {
      "index": {
        "creation_date": "1429308615170",
        "number_of_replicas": "1",
        "number_of_shards": "5",
        "uuid": "C5sqwXClSFyd5uF3MSrVgg",
        "version": {
          "created": "1050199"
        }
      }
    },
    "warmers": {}
  }
}

You can see the creation_date field above.

like image 118
Lee H Avatar answered Oct 04 '22 01:10

Lee H


curl -XGET localhost:9200/_cat/indices?h=i,creation.date.string

Above command will output index name (i) and creation date. For more options you can try help as-

curl -XGET localhost:9200/_cat/indices?help

like image 33
Yogesh Jilhawar Avatar answered Oct 04 '22 01:10

Yogesh Jilhawar