# Automatically removing index

**URL:** <https://discuss.elastic.co/t/automatically-removing-index/106866>\
**Category:** Elasticsearch\
**Created:** [November 8, 2017, 12:46pm UTC](https://discuss.elastic.co/t/automatically-removing-index/106866 "2017-11-08T12:46:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gavenkoa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gavenkoa/32/23899_2.png) [@gavenkoa](https://discuss.elastic.co/u/gavenkoa)\
**Post date:** [November 8, 2017, 12:46pm UTC](https://discuss.elastic.co/t/automatically-removing-index/106866/1 "2017-11-08T12:46:34Z")

</div>

Docs says you need to remove unused (yeah, old) indexes: [https://www.elastic.co/guide/en/elasticsearch/guide/current/retiring-data.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/retiring-data.html)

There is [https://www.elastic.co/guide/en/elasticsearch/client/curator/current/installation.html](https://www.elastic.co/guide/en/elasticsearch/client/curator/current/installation.html) to help with.

Is there an option for index to be removed automatically by ES after some time passed?

Currently we don't have time to learn tools better and stripping month history in order to prevent storage outage is good enough.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 8, 2017, 1:19pm UTC](https://discuss.elastic.co/t/automatically-removing-index/106866/3 "2017-11-08T13:19:23Z")

</div>

Curator is the way to go.

Otherwise run your own DELETE index-name command every day. It’s a simple call you can do from your application

---

<div class="post-metadata">

**Author:** ![gavenkoa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gavenkoa/32/23899_2.png) [@gavenkoa](https://discuss.elastic.co/u/gavenkoa)\
**Post date:** [November 8, 2017, 3:06pm UTC](https://discuss.elastic.co/t/automatically-removing-index/106866/4 "2017-11-08T15:06:46Z")

</div>

I end with curator:

```
bash# wget https://packages.elastic.co/curator/5/centos/6/Packages/elasticsearch-curator-5.3.0-1.x86_64.rpm
bash# rpm -i elasticsearch-curator-5.3.0-1.x86_64.rpm
bash# curator_cli show_indices

```

192.168.10.33:/etc/cron.daily/curator-purge-old-indexes

```
#!/bin/sh
/usr/bin/curator curator --config /etc/elasticsearch/curator-cfg.yml /etc/elasticsearch/curator-action-delete.yml

```

/etc/elasticsearch/curator-action-delete.yml

```
actions:
  1:
    action: delete_indices
    description: >-
      Delete old indexes.
    options:
      ignore_empty_list: True
      timeout_override:
      continue_if_exception: False
      disable_action: False
    filters:
    - filtertype: pattern
      kind: prefix
      value: logstash-
      exclude:
    - filtertype: age
      source: name
      direction: older
      timestring: '%Y.%m.%d'
      unit: days
      unit_count: 30
  2:
    action: delete_indices
    description: >-
      Delete old indexes.
    options:
      ignore_empty_list: True
      timeout_override:
      continue_if_exception: False
      disable_action: False
    filters:
    - filtertype: pattern
      kind: prefix
      value: sa-
      exclude:
    - filtertype: age
      source: name
      direction: older
      timestring: '%Y-%m-%d'
      unit: days
      unit_count: 30

```

/etc/elasticsearch/curator-cfg.yml

```
client:
  hosts:
    - 192.168.10.32
    - 192.168.10.33
  port: 9200

```

To test:

```
/usr/bin/curator curator --dry-run --config /etc/elasticsearch/curator-cfg.yml /etc/elasticsearch/curator-action-delete.yml
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 6, 2017, 3:06pm UTC](https://discuss.elastic.co/t/automatically-removing-index/106866/5 "2017-12-06T15:06:47Z")

</div>

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