# Delete by time range with ES v1.0

**URL:** <https://discuss.elastic.co/t/delete-by-time-range-with-es-v1-0/18659>\
**Category:** Elasticsearch\
**Created:** [July 14, 2014, 7:24pm UTC](https://discuss.elastic.co/t/delete-by-time-range-with-es-v1-0/18659 "2014-07-14T19:24:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bastien\_Chong](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bastien_chong/32/1393_2.png) [@Bastien\_Chong](https://discuss.elastic.co/u/Bastien_Chong)\
**Post date:** [July 14, 2014, 7:24pm UTC](https://discuss.elastic.co/t/delete-by-time-range-with-es-v1-0/18659/1 "2014-07-14T19:24:23Z")

</div>

I'm trying to delete document from an index based on the timestamp.  
I'm using ES v1.0, so I have to use the query wrapper.

This return the wanted result :

curl -\*XGET \*'[http://localhost:9200/test/\_](http://localhost:9200/test/_)_search_?pretty=1' -d '{"query":  
{"range":{"@timestamp":{"from":"2014-07-10T00:00:00","to":"2014-07-13T21:00:00"}}}}'

but this doesn't work, command is hanging :

curl -_XDELETE_ '[http://localhost:9200/test/\_](http://localhost:9200/test/_)_query_?pretty=1' -d  
'{"query":  
{"range":{"@timestamp":{"from":"2014-07-10T00:00:00","to":"2014-07-13T21:00:00"}}}}'

Any idea ?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/80405e2e-01cd-43bf-996f-7e5851ce89a7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/80405e2e-01cd-43bf-996f-7e5851ce89a7%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Bastien\_Chong](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bastien_chong/32/1393_2.png) [@Bastien\_Chong](https://discuss.elastic.co/u/Bastien_Chong)\
**Post date:** [July 14, 2014, 8:03pm UTC](https://discuss.elastic.co/t/delete-by-time-range-with-es-v1-0/18659/2 "2014-07-14T20:03:01Z")

</div>

> [2014-07-14 19:49:16,154][DEBUG][action.search.type] [Pisces]  
> [check][1], node[BF93qRWnRDGuT9GQozB0LQ], [P], s[STARTED]: Failed to  
> execute [org.elasticsearch.action.search.SearchRequest@8e75504]  
> org.elasticsearch.search.SearchParseException: [check][1]:  
> query[@timestamp:[1404950400000 TO 1405285200999]],from[-1],size[-1]: Parse  
> Failure [Failed to parse source [{"query":  
> {"range":{"@timestamp":{"from":"2014-07-10T00:00:00","to":"2014-07-13T21:00:00"}}}]]
> 
> Caused by: org.elasticsearch.common.jackson.core.JsonParseException:  
> Unexpected end-of-input: expected close marker for OBJECT (from [Source:  
> [B@22606fa9; line: 1, column: 0])  
> at [Source: [B@22606fa9; line: 1, column: 185]

What's the correct syntax ?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/288cd182-f199-4961-8d6e-f1232b9c6896%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/288cd182-f199-4961-8d6e-f1232b9c6896%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:15am UTC](https://discuss.elastic.co/t/delete-by-time-range-with-es-v1-0/18659/3 "2017-07-06T01:15:53Z")

</div>


