# Delete items for a given range

**URL:** <https://discuss.elastic.co/t/delete-items-for-a-given-range/7089>\
**Category:** Elasticsearch\
**Created:** [March 21, 2012, 10:58pm UTC](https://discuss.elastic.co/t/delete-items-for-a-given-range/7089 "2012-03-21T22:58:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kartik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kartik/32/2946_2.png) [@Kartik](https://discuss.elastic.co/u/Kartik)\
**Post date:** [March 21, 2012, 10:58pm UTC](https://discuss.elastic.co/t/delete-items-for-a-given-range/7089/1 "2012-03-21T22:58:16Z")

</div>

Hello,

I was wondering if there is a way to delete all the items for a given  
range of timestamps.

I tried looking for possible answers online and found a few entries  
that indicate that this is possible, but no definite answer confirming  
this. (aka bulk api)

I am aware of ElasticSearch allowing you to search for entries for a  
given time range but does anyone know of a better way of doing ranged  
deletions except of deleting entries individually after you get them  
from the range query.

Thanks for your time.

Kartik

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [March 22, 2012, 10:40pm UTC](https://discuss.elastic.co/t/delete-items-for-a-given-range/7089/2 "2012-03-22T22:40:47Z")

</div>

You can execute a delete by query with the same range query you are using:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

--  
Ivan

On Wed, Mar 21, 2012 at 3:58 PM, Kartik [talwar.kartik@gmail.com](mailto:talwar.kartik@gmail.com) wrote:

> Hello,
> 
> I was wondering if there is a way to delete all the items for a given  
> range of timestamps.
> 
> I tried looking for possible answers online and found a few entries  
> that indicate that this is possible, but no definite answer confirming  
> this. (aka bulk api)
> 
> I am aware of Elasticsearch allowing you to search for entries for a  
> given time range but does anyone know of a better way of doing ranged  
> deletions except of deleting entries individually after you get them  
> from the range query.
> 
> Thanks for your time.
> 
> Kartik

---

<div class="post-metadata">

**Author:** ![Kartik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kartik/32/2946_2.png) [@Kartik](https://discuss.elastic.co/u/Kartik)\
**Post date:** [March 23, 2012, 6:49pm UTC](https://discuss.elastic.co/t/delete-items-for-a-given-range/7089/3 "2012-03-23T18:49:10Z")

</div>

Hello Ivan,

Thanks for your reply.

I was more interested in doing that through their REST interface.

Do you know if that's still possible?

Thanks

On Mar 22, 3:40 pm, Ivan Brusic [i...@brusic.com](mailto:i...@brusic.com) wrote:

> You can execute a delete by query with the same range query you are using:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/delete-by-query)...
> 
> --  
> Ivan
> 
> On Wed, Mar 21, 2012 at 3:58 PM, Kartik [talwar.kar...@gmail.com](mailto:talwar.kar...@gmail.com) wrote:
> 
> > Hello,
> 
> > I was wondering if there is a way to delete all the items for a given  
> > range of timestamps.
> 
> > I tried looking for possible answers online and found a few entries  
> > that indicate that this is possible, but no definite answer confirming  
> > this. (aka bulk api)
> 
> > I am aware of Elasticsearch allowing you to search for entries for a  
> > given time range but does anyone know of a better way of doing ranged  
> > deletions except of deleting entries individually after you get them  
> > from the range query.
> 
> > Thanks for your time.
> 
> > Kartik

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [March 24, 2012, 4:26pm UTC](https://discuss.elastic.co/t/delete-items-for-a-given-range/7089/4 "2012-03-24T16:26:09Z")

</div>

I should have linked to the REST API:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Fri, Mar 23, 2012 at 11:49 AM, Kartik [talwar.kartik@gmail.com](mailto:talwar.kartik@gmail.com) wrote:

> Hello Ivan,
> 
> Thanks for your reply.
> 
> I was more interested in doing that through their REST interface.
> 
> Do you know if that's still possible?
> 
> Thanks
> 
> On Mar 22, 3:40 pm, Ivan Brusic [i...@brusic.com](mailto:i...@brusic.com) wrote:
> 
> > You can execute a delete by query with the same range query you are using:
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/delete-by-query)...
> > 
> > --  
> > Ivan
> > 
> > On Wed, Mar 21, 2012 at 3:58 PM, Kartik [talwar.kar...@gmail.com](mailto:talwar.kar...@gmail.com) wrote:
> > 
> > > Hello,
> > 
> > > I was wondering if there is a way to delete all the items for a given  
> > > range of timestamps.
> > 
> > > I tried looking for possible answers online and found a few entries  
> > > that indicate that this is possible, but no definite answer confirming  
> > > this. (aka bulk api)
> > 
> > > I am aware of Elasticsearch allowing you to search for entries for a  
> > > given time range but does anyone know of a better way of doing ranged  
> > > deletions except of deleting entries individually after you get them  
> > > from the range query.
> > 
> > > Thanks for your time.
> > 
> > > Kartik

---

<div class="post-metadata">

**Author:** ![medcl\_net](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@medcl\_net](https://discuss.elastic.co/u/medcl_net)\
**Post date:** [March 24, 2012, 5:09pm UTC](https://discuss.elastic.co/t/delete-items-for-a-given-range/7089/5 "2012-03-24T17:09:02Z")

</div>

hey,guys, I just pushed a plugin integrated with  
carrot2([http://carrot2.org](http://carrot2.org)),

here is the repo:

> **[medcl/elasticsearch-carrot2](https://github.com/medcl/elasticsearch-carrot2)**
>
> elasticsearch-carrot2 - a elasticsearch plugin integrated with carrot2,which clustering your search results into topics,

how to instsall?

1.download lexical  
files([https://github.com/downloads/medcl/elasticsearch-carrot2/config.zip](https://github.com/downloads/medcl/elasticsearch-carrot2/config.zip)),put  
them into the config folder.  
2.bin/plugin install medcl/elasticsearch-carrot2/1.0

how to use?

curl -XPOST  
[http://localhost:9200/elasticsearch\_resources/\_carrot2?carrot2.fetch\_size=1800&carrot2.language=ENGLISH&carrot2.title\_fields=title&carrot2.summary\_fields=snippet&carrot2.url\_field=url&carrot2.attach\_detail=true](http://localhost:9200/elasticsearch_resources/_carrot2?carrot2.fetch_size=1800&carrot2.language=ENGLISH&carrot2.title_fields=title&carrot2.summary_fields=snippet&carrot2.url_field=url&carrot2.attach_detail=true)  
-d'  
{  
"query": {  
"bool": {  
"should": [  
{  
"match\_all": {}  
}  
]  
}  
},  
"from": 0,  
"size": 10  
}  
'

a response sample:

> <https://gist.github.com/medcl/2184894>

BTW,this is a early version just for preview,will be improved later.

have fun.thanks.

---

<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, 3:35am UTC](https://discuss.elastic.co/t/delete-items-for-a-given-range/7089/6 "2017-07-06T03:35:00Z")

</div>


