Somebody
Somebody

Reputation: 23

Auto index and auto deletion of index on Elasticsearch

We have the following requirement: every month a new index (collection) has to be created: company_details- in ES cluster. We need to delete the older indices which are greater than 2 months.

Example:

company_details-2019-12 (delete this index)
company_details-2020-01 (retain this index)
company_details-2020-02 (retain this index)

We could create an alias company_details and point it to the current month index (so that we could do indexing/querying). This also has to be updated every month automatically.

How can we setup ES so that this would be done automatically?

Upvotes: 0

Views: 831

Answers (1)

Daniel Schneiter
Daniel Schneiter

Reputation: 1996

If you are on a recent version of Elasticsearch, Index Lifecycle Management (ILM) (see Elasticsearch Reference: Manage the index lifecycle) can be used to automate all the tasks you described:

  • rolling over indices
  • adjusting links
  • optimize indices according to the life-cycle until they eventually get deleted

Upvotes: 0

Related Questions