# Delete the old data from index

**URL:** https://discuss.elastic.co/t/delete-the-old-data-from-index/156312
**Category:** Elasticsearch
**Created:** [November 12, 2018, 3:37pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312 "2018-11-12T15:37:43Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 12, 2018, 3:37pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/1 "2018-11-12T15:37:43Z")

</div>

HI,  
I want to delete data from ES index and i want to keep only last 30 days record in it. Is it possible to achieve this with rollover concept.

---

<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 12, 2018, 3:49pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/2 "2018-11-12T15:49:36Z")

</div>

You should use:

- Time based indices
- Curator project

With that you can easily do what you described.

---

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 12, 2018, 3:50pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/3 "2018-11-12T15:50:37Z")

</div>

so using of rollover concept its not possible right.

---

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 12, 2018, 3:51pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/4 "2018-11-12T15:51:31Z")

</div>

> [@dadoonet](#):
>
> - Time based indices
> - Curator project

Could you suggest me which version of curator will work for me.

I'm using

ELK 6.2.4 and running by docker.

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [November 12, 2018, 3:59pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/5 "2018-11-12T15:59:26Z")

</div>

You can use rollover to generate time-based indices and manage their lifecycle and deletion using Curator.

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [November 12, 2018, 4:01pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/6 "2018-11-12T16:01:07Z")

</div>

Curator 5.5.4 will work with all 5.x and 6.x releases of Elasticsearch.

You _can_ use rollover indices still. You will just need to do rollover by time, perhaps creating a new index every day. This is less than ideal, however, as it can result in many, many shards. Be sure to use index templates so that new indices (created by rollover or otherwise) do not have the default number of 5 shards, unless that many are needed.

---

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 14, 2018, 6:38am UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/7 "2018-11-14T06:38:13Z")

</div>

> [@theuntergeek](#):
>
> Curator 5.5.4 will work with all 5.x and 6.x releases of Elasticsearch.

sorry for late reply when i try to install curator 5.5.4 im getting below error and es running using docker,

```
[root@lpdosput020008 ~]# pip install curator-5.5.4.tar.gz
Processing ./curator-5.5.4.tar.gz
Collecting elasticsearch!=6.0.0,<7.0.0,>=5.5.2 (from elasticsearch-curator==5.5.4)
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ff788823c50>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/elasticsearch/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ff788823bd0>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/elasticsearch/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ff7887dd0d0>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/elasticsearch/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ff7887dd250>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/elasticsearch/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ff7887dd3d0>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/elasticsearch/
  Could not find a version that satisfies the requirement elasticsearch!=6.0.0,<7.0.0,>=5.5.2 (from elasticsearch-curator==5.5.4) (from versions: )
No matching distribution found for elasticsearch!=6.0.0,<7.0.0,>=5.5.2 (from elasticsearch-curator==5.5.4)

```

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [November 14, 2018, 11:48am UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/8 "2018-11-14T11:48:33Z")

</div>

If you're running docker, and the instance has outside access, just run `pip install elasticsearch-curator`, like it says to do in [the documentation](https://www.elastic.co/guide/en/elasticsearch/client/curator/5.5/pip.html).

---

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 15, 2018, 12:03pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/9 "2018-11-15T12:03:35Z")

</div>

> [@theuntergeek](#):
>
> If you're running docker, and the instance has outside access, just run `pip install elasticsearch-curator` , like it says to do in [the documentation](https://www.elastic.co/guide/en/elasticsearch/client/curator/5.5/pip.html).

when i run as per your document i'm getting below error and those box don't have internet connection it has to done by offline

```
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f79a8358e90>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/elasticsearch-curator/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f79a8358b10>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/elasticsearch-curator/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f79a83588d0>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/elasticsearch-curator/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f79a8358850>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/elasticsearch-curator/
  Could not find a version that satisfies the requirement elasticsearch-curator (from versions: )
No matching distribution found for elasticsearch-curator

```

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [November 15, 2018, 3:00pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/10 "2018-11-15T15:00:02Z")

</div>

It will probably be easier to run a docker container for CentOS or a Debian/Ubuntu variant, then and just download the respective RPM or DEB package and install that as one file, rather than have to pre-download all of the dependencies.

---

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 15, 2018, 3:17pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/11 "2018-11-15T15:17:49Z")

</div>

Actually I guess installed all the dependencies, but when I try to install curator with this command  
Python setup.py install

I'm getting this kind of error,

No such file or resource for elastic search required 5 or 6

Actually it's fail to find ES, bvoz its running on rocker.

How could I find that

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [November 15, 2018, 3:33pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/12 "2018-11-15T15:33:45Z")

</div>

The instructions for installing from source are [here](https://www.elastic.co/guide/en/elasticsearch/client/curator/5.6/python-source.html), including [this part](https://www.elastic.co/guide/en/elasticsearch/client/curator/5.6/python-source.html#_elasticsearch_python_module):

> ## elasticsearch (python module)
> 
> Download and install the [elasticsearch-py](https://github.com/elastic/elasticsearch-py) dependency:
> 
> 1. `wget https://github.com/elastic/elasticsearch-py/archive/` `6.3.1.tar.gz -O elasticsearch-py.tar.gz`
> 2. `pip install elasticsearch-py.tar.gz`
> 
> or uncompress and run `python setup.py install`

---

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 23, 2018, 6:05am UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/13 "2018-11-23T06:05:13Z")

</div>

> [@theuntergeek](#):
>
> `wget https://github.com/elastic/elasticsearch-py/archive/` `6.3.1.tar.gz -O elasticsearch-py.tar.gz`

im getting page not found error

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [November 26, 2018, 12:41pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/14 "2018-11-26T12:41:11Z")

</div>

The instructions have you download `https://github.com/elastic/elasticsearch-py/archive/6.2.0.tar.gz`. Where are you getting `6.3.1` from? This is not the _elasticsearch_ version, but the release version of the `elasticsearch` _python_ module, which is not tied to the Elasticsearch release version.

---

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 26, 2018, 2:50pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/15 "2018-11-26T14:50:39Z")

</div>

> [@theuntergeek](#):
>
> The instructions have you download `https://github.com/elastic/elasticsearch-py/archive/6.2.0.tar.gz` . Where are you getting `6.3.1` from? This is not the _elasticsearch_ version, but the release version of the `elasticsearch` _python_ module, which is not tied to the Elasticsearch release version.

After extracting the tar file i tried below steup and getting error,

```
[root@lpdosput020008 elasticsearch-py-6.2.0]# pip install setup.py
Collecting setup.py
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f1004fc4b10>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/setup-py/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f1004fc4b50>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/setup-py/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f1004fc4d50>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/setup-py/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f1004fc4990>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/setup-py/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f1004f9b050>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/setup-py/
  Could not find a version that satisfies the requirement setup.py (from versions: )
No matching distribution found for setup.py

```

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [November 26, 2018, 3:23pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/16 "2018-11-26T15:23:07Z")

</div>

Please actually follow the instructions [in the documentation](https://www.elastic.co/guide/en/elasticsearch/client/curator/5.5/python-source.html), as it's clear you are doing things which are not in the instructions (like uncompressing the tarball). The instructions clearly show:

> If you have `pip` installed, then you can install from a gzipped file.

With all of the examples showing things like:

> `wget https://github.com/elastic/curator/archive/v5.5.4.tar.gz -O elasticsearch-curator.tar.gz`  
> `pip install elasticsearch-curator.tar.gz`

If you follow [all of the instructions](https://www.elastic.co/guide/en/elasticsearch/client/curator/5.5/python-source.html), you will have installed the `urllib3` prerequisite before the elasticsearch python module, which is why you are getting the error you reported.

---

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 26, 2018, 3:43pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/17 "2018-11-26T15:43:01Z")

</div>

now elasticsearch curator installed successfully. How can check its running or not

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [November 26, 2018, 3:58pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/18 "2018-11-26T15:58:07Z")

</div>

It's not a service. You have to run it periodically with `cron` or some other scheduler. Test it by running it with your configuration files and the `--dry-run` flag. Look for the logs, wherever you've configured them to be stored.

---

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 26, 2018, 4:09pm UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/19 "2018-11-26T16:09:38Z")

</div>

thank you for help 🙂

---

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [November 28, 2018, 10:20am UTC](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312/20 "2018-11-28T10:20:33Z")

</div>

> [@theuntergeek](#):
>
> It's not a service. You have to run it periodically with `cron` or some other scheduler. Test it by running it with your configuration files and the `--dry-run` flag. Look for the logs, wherever you've configured them to be stored.

i tried with dry run but im getting below message,

```
[root@lpdosput020009 ~]# curator --dry-run /root/curator.yml
-bash: curator: command not found

```

[Next page](https://discuss.elastic.co/t/delete-the-old-data-from-index/156312.md?page=2)
