# How to delete index data based on date field range using logstash command line

**URL:** <https://discuss.elastic.co/t/how-to-delete-index-data-based-on-date-field-range-using-logstash-command-line/182011>\
**Category:** Logstash\
**Created:** [May 21, 2019, 1:28pm UTC](https://discuss.elastic.co/t/how-to-delete-index-data-based-on-date-field-range-using-logstash-command-line/182011 "2019-05-21T13:28:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Venkatesh\_Ravuri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/venkatesh_ravuri/32/46557_2.png) [@Venkatesh\_Ravuri](https://discuss.elastic.co/u/Venkatesh_Ravuri)\
**Post date:** [May 21, 2019, 1:28pm UTC](https://discuss.elastic.co/t/how-to-delete-index-data-based-on-date-field-range-using-logstash-command-line/182011/1 "2019-05-21T13:28:07Z")

</div>

I am trying to perform delta delete for old data based on date field range, I tried few options but not working.

Conf file:

input {

s3 {  
bucket =\> "#####"  
region =\> "#####"  
prefix =\> "#####"  
}

}

filter {  
csv {  
separator =\> ","  
columns =\> [ "time\_id","timezone\_id","city","community","sub\_community","customer\_id","agent\_id","user\_id","feed\_id","customer\_name","company\_name","customer\_master\_name","device\_source","b2c\_c2c","featured","promoted","verified","vertical\_id","vertical\_name","category\_l1\_name","category\_l2\_name","category\_l3\_name","bedrooms","data\_source","nnl","dal"  
]  
quote\_char =\> "`"

```
            }
    mutate {
                            convert => { "timezone_id" => "integer" }
                            convert => { "customer_id" => "integer" }
                            convert => { "agent_id" => "integer" }
                            convert => { "feed_id" => "integer" }
                            convert => { "featured" => "integer" }
                            convert => { "promoted" => "integer" }
                            convert => { "verified" => "integer" }
                            convert => { "vertical_id" => "integer" }
                            convert => { "bedrooms" => "integer" }
                            convert => { "nnl" => "integer" }
                            convert => { "dal" => "integer" }
                    }

    }

```

output {

```
            amazon_es {
                    hosts => ["search-meabi-es-pub-ixvztcxb4kahwtuphho4odpfni.eu-west-1.es.amazonaws.com"]
                    region => "eu-west-1"
                    document_id => "ps_20150502"
                    index => "v_ft_d_popularity_data_supply"
            }

```

}

output {

```
            amazon_es {
                    hosts => ["####"]
                    region => "eu-west-1"
                    document_id => "ps_20150502"
                    index => "v_ft_d_popularity_data_supply"
            }

```

}

tried the below delete command but no luck

curl -XDELETE [https://search-meabi-es-pub-ixvztcxb4kahwtuphho4odpfni.eu-west-1.es.amazonaws.com/v\_ft\_d\_popularity\_data\_supply/logs/\_query](https://search-meabi-es-pub-ixvztcxb4kahwtuphho4odpfni.eu-west-1.es.amazonaws.com/v_ft_d_popularity_data_supply/logs/_query) -d '{"query": {"range":{ "time\_id": {"from":"2019-05-02","to":"2019-05-05" }}}}' -H 'Content-Type: application/json'

Result:  
{"\_index":"v\_ft\_d\_popularity\_data\_supply","\_type":"logs","\_id":"\_query","\_version":1,"result":"not\_found","\_shards":{"total":2,"successful":1,"failed":0},"\_seq\_no":4356

---

<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:** [June 18, 2019, 1:28pm UTC](https://discuss.elastic.co/t/how-to-delete-index-data-based-on-date-field-range-using-logstash-command-line/182011/2 "2019-06-18T13:28:18Z")

</div>

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