# Date calculation does not work in DELETE

**URL:** <https://discuss.elastic.co/t/date-calculation-does-not-work-in-delete/16545>\
**Category:** Elasticsearch\
**Created:** [March 22, 2014, 4:28pm UTC](https://discuss.elastic.co/t/date-calculation-does-not-work-in-delete/16545 "2014-03-22T16:28:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Norbert\_Hartl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/norbert_hartl/32/1690_2.png) [@Norbert\_Hartl](https://discuss.elastic.co/u/Norbert_Hartl)\
**Post date:** [March 22, 2014, 4:28pm UTC](https://discuss.elastic.co/t/date-calculation-does-not-work-in-delete/16545/1 "2014-03-22T16:28:25Z")

</div>

Hi,

I'm trying to delete entries in my indexes that are older than 6 months.  
I'm using the curl command

curl -vv -XDELETE [http://localhost:9200/myindex/\_query](http://localhost:9200/myindex/_query) -d @delete-old.json  
delete-old.json content:

{

"query" : {

```
  "filtered" : {

     "query" : {

        "match_all" : { }

     },

     "filter" : {

        "range" : {

           "timeStamp" : {

              "lte" : "now-6M"

           }

        }

     }

  }

```

}

}

The query does work when doing a search. It does also work if I use

"timeStamp" : {

```
   "lte" : "2013-09-01T00:00:00+00:00"

```

}

So is the date calculation "now-6M" not supposed to work in DELETEs?

thanks,

norbert

--  
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/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Norbert\_Hartl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/norbert_hartl/32/1690_2.png) [@Norbert\_Hartl](https://discuss.elastic.co/u/Norbert_Hartl)\
**Post date:** [March 23, 2014, 6:16pm UTC](https://discuss.elastic.co/t/date-calculation-does-not-work-in-delete/16545/2 "2014-03-23T18:16:24Z")

</div>

btw. I forgot to add I'm using elasticsearch 1.0.1

Norbert

Am 22.03.2014 um 17:28 schrieb Norbert Hartl [norbert.hartl@googlemail.com](mailto:norbert.hartl@googlemail.com):

> Hi,
> 
> I'm trying to delete entries in my indexes that are older than 6 months. I'm using the curl command
> 
> curl -vv -XDELETE [http://localhost:9200/myindex/\_query](http://localhost:9200/myindex/_query) -d @delete-old.json
> 
> delete-old.json content:
> 
> {
> 
> "query" : {
> 
> ```
> "filtered" : {
> 
> "query" : {
> 
> "match_all" : { }
> 
> },
> 
> "filter" : {
> 
> "range" : {
> 
> "timeStamp" : {
> 
> "lte" : "now-6M"
> 
> }
> 
> }
> 
> }
> 
> }
> 
> ```
> 
> }
> 
> }
> 
> The query does work when doing a search. It does also work if I use
> 
> "timeStamp" : {
> 
> ```
> "lte" : "2013-09-01T00:00:00+00:00"
> 
> ```
> 
> }
> 
> So is the date calculation "now-6M" not supposed to work in DELETEs?
> 
> thanks,
> 
> norbert
> 
> --  
> 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/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/A583FCC2-C912-4DC5-ABDD-C2540CBAFA28%40googlemail.com](https://groups.google.com/d/msgid/elasticsearch/A583FCC2-C912-4DC5-ABDD-C2540CBAFA28%40googlemail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Boaz\_Leskes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/boaz_leskes/32/723_2.png) [@Boaz\_Leskes](https://discuss.elastic.co/u/Boaz_Leskes)\
**Post date:** [March 25, 2014, 3:08pm UTC](https://discuss.elastic.co/t/date-calculation-does-not-work-in-delete/16545/3 "2014-03-25T15:08:50Z")

</div>

Hi Norbert,

This looks like a bug. Will dig deeper and get back to you.

Cheers,  
Boaz

On Sunday, March 23, 2014 7:16:24 PM UTC+1, Norbert Hartl wrote:

> btw. I forgot to add I’m using elasticsearch 1.0.1
> 
> Norbert
> 
> Am 22.03.2014 um 17:28 schrieb Norbert Hartl \<[norber...@googlemail.com](mailto:norber...@googlemail.com)\<javascript:\>
> 
> > :
> 
> Hi,
> 
> I'm trying to delete entries in my indexes that are older than 6 months.  
> I'm using the curl command
> 
> curl -vv -XDELETE [http://localhost:9200/myindex/\_query](http://localhost:9200/myindex/_query) -d  
> @delete-old.json  
> delete-old.json content:
> 
> {
> 
> "query" : {
> 
> ```
> "filtered" : {
> 
> "query" : {
> 
> "match_all" : { }
> 
> },
> 
> "filter" : {
> 
> "range" : {
> 
> "timeStamp" : {
> 
> "lte" : "now-6M"
> 
> }
> 
> }
> 
> }
> 
> }
> 
> ```
> 
> }
> 
> }
> 
> The query does work when doing a search. It does also work if I use
> 
> "timeStamp" : {
> 
> ```
> "lte" : "2013-09-01T00:00:00+00:00"
> 
> ```
> 
> }
> 
> So is the date calculation "now-6M" not supposed to work in DELETEs?
> 
> thanks,
> 
> norbert
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/bd65a11e-5dba-4d5d-842e-8c68db0ddd61%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bd65a11e-5dba-4d5d-842e-8c68db0ddd61%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Boaz\_Leskes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/boaz_leskes/32/723_2.png) [@Boaz\_Leskes](https://discuss.elastic.co/u/Boaz_Leskes)\
**Post date:** [March 26, 2014, 8:52am UTC](https://discuss.elastic.co/t/date-calculation-does-not-work-in-delete/16545/4 "2014-03-26T08:52:23Z")

</div>

Heya,

I've added a pull request to fix this  
issue: [Capture and set start time in Delete By Query operations by bleskes · Pull Request #5540 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/pull/5540)

You can watch to see when it gets merged in.

Thx for reporting!

Boaz

On Tuesday, March 25, 2014 4:08:50 PM UTC+1, Boaz Leskes wrote:

> Hi Norbert,
> 
> This looks like a bug. Will dig deeper and get back to you.
> 
> Cheers,  
> Boaz
> 
> On Sunday, March 23, 2014 7:16:24 PM UTC+1, Norbert Hartl wrote:
> 
> > btw. I forgot to add I’m using elasticsearch 1.0.1
> > 
> > Norbert
> > 
> > Am 22.03.2014 um 17:28 schrieb Norbert Hartl [norber...@googlemail.com](mailto:norber...@googlemail.com):
> > 
> > Hi,
> > 
> > I'm trying to delete entries in my indexes that are older than 6 months.  
> > I'm using the curl command
> > 
> > curl -vv -XDELETE [http://localhost:9200/myindex/\_query](http://localhost:9200/myindex/_query) -d  
> > @delete-old.json  
> > delete-old.json content:
> > 
> > {
> > 
> > "query" : {
> > 
> > ```
> > "filtered" : {
> > 
> > "query" : {
> > 
> > "match_all" : { }
> > 
> > },
> > 
> > "filter" : {
> > 
> > "range" : {
> > 
> > "timeStamp" : {
> > 
> > "lte" : "now-6M"
> > 
> > }
> > 
> > }
> > 
> > }
> > 
> > }
> > 
> > ```
> > 
> > }
> > 
> > }
> > 
> > The query does work when doing a search. It does also work if I use
> > 
> > "timeStamp" : {
> > 
> > ```
> > "lte" : "2013-09-01T00:00:00+00:00"
> > 
> > ```
> > 
> > }
> > 
> > So is the date calculation "now-6M" not supposed to work in DELETEs?
> > 
> > thanks,
> > 
> > norbert
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/403e2c48-f9f6-46e8-b370-fe024943b02b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/403e2c48-f9f6-46e8-b370-fe024943b02b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Norbert\_Hartl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/norbert_hartl/32/1690_2.png) [@Norbert\_Hartl](https://discuss.elastic.co/u/Norbert_Hartl)\
**Post date:** [March 26, 2014, 8:55am UTC](https://discuss.elastic.co/t/date-calculation-does-not-work-in-delete/16545/5 "2014-03-26T08:55:34Z")

</div>

Am 26.03.2014 um 09:52 schrieb Boaz Leskes [b.leskes@gmail.com](mailto:b.leskes@gmail.com):

> Heya,
> 
> I've added a pull request to fix this issue: [Capture and set start time in Delete By Query operations by bleskes · Pull Request #5540 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/pull/5540)
> 
> You can watch to see when it gets merged in.
> 
> Thx for reporting!

Thank you very much for fixing it.

Norbert

> Boaz
> 
> On Tuesday, March 25, 2014 4:08:50 PM UTC+1, Boaz Leskes wrote:  
> Hi Norbert,
> 
> This looks like a bug. Will dig deeper and get back to you.
> 
> Cheers,  
> Boaz
> 
> On Sunday, March 23, 2014 7:16:24 PM UTC+1, Norbert Hartl wrote:  
> btw. I forgot to add I'm using elasticsearch 1.0.1
> 
> Norbert
> 
> Am 22.03.2014 um 17:28 schrieb Norbert Hartl [norber...@googlemail.com](mailto:norber...@googlemail.com):
> 
> > Hi,
> > 
> > I'm trying to delete entries in my indexes that are older than 6 months. I'm using the curl command
> > 
> > curl -vv -XDELETE [http://localhost:9200/myindex/\_query](http://localhost:9200/myindex/_query) -d @delete-old.json
> > 
> > delete-old.json content:
> > 
> > {
> > 
> > "query" : {
> > 
> > ```
> > "filtered" : {
> > 
> > "query" : {
> > 
> > "match_all" : { }
> > 
> > },
> > 
> > "filter" : {
> > 
> > "range" : {
> > 
> > "timeStamp" : {
> > 
> > "lte" : "now-6M"
> > 
> > }
> > 
> > }
> > 
> > }
> > 
> > }
> > 
> > ```
> > 
> > }
> > 
> > }
> > 
> > The query does work when doing a search. It does also work if I use
> > 
> > "timeStamp" : {
> > 
> > ```
> > "lte" : "2013-09-01T00:00:00+00:00"
> > 
> > ```
> > 
> > }
> > 
> > So is the date calculation "now-6M" not supposed to work in DELETEs?
> > 
> > thanks,
> > 
> > norbert
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ec13a845-aedd-4eb4-b9ca-60eb67c5b773%40googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> 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/403e2c48-f9f6-46e8-b370-fe024943b02b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/403e2c48-f9f6-46e8-b370-fe024943b02b%40googlegroups.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/C97DC526-F488-45F4-8BA5-C0D23987747A%40googlemail.com](https://groups.google.com/d/msgid/elasticsearch/C97DC526-F488-45F4-8BA5-C0D23987747A%40googlemail.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:40am UTC](https://discuss.elastic.co/t/date-calculation-does-not-work-in-delete/16545/6 "2017-07-06T01:40:40Z")

</div>


