# Delete by filtered query does not work any more in 1.0.0

**URL:** <https://discuss.elastic.co/t/delete-by-filtered-query-does-not-work-any-more-in-1-0-0/15927>\
**Category:** Elasticsearch\
**Created:** [February 20, 2014, 2:39pm UTC](https://discuss.elastic.co/t/delete-by-filtered-query-does-not-work-any-more-in-1-0-0/15927 "2014-02-20T14:39:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![J\_Schulz](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@J\_Schulz](https://discuss.elastic.co/u/J_Schulz)\
**Post date:** [February 20, 2014, 2:39pm UTC](https://discuss.elastic.co/t/delete-by-filtered-query-does-not-work-any-more-in-1-0-0/15927/1 "2014-02-20T14:39:27Z")

</div>

Hi,

since 1.0.0 it's not possible any more to delete documents by a filtered  
query.

As exmaple the query from

[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-filtered-query.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-filtered-query.html)

returns "HTTP/1.1 400 Bad Request" and prints to the logfile

{org.elasticsearch.index.query.QueryParsingException: [test] request does  
not support [filtered]  
at  
org.elasticsearch.index.query.IndexQueryParserService.parseQuery(IndexQueryParserService.java:303)  
at  
org.elasticsearch.index.shard.service.InternalIndexShard.prepareDeleteByQuery(InternalIndexShard.java:444)  
at  
org.elasticsearch.action.deletebyquery.TransportShardDeleteByQueryAction.shardOperationOnPrimary(TransportShardDeleteByQueryAction.java:118)  
at  
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:556)  
at  
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:426)  
at  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
at java.lang.Thread.run(Thread.java:724)}

Does anybody knows why it's not possible any more? It's a bug?

The docs says "The delete by query can use the Query DSL within its body in  
order to express the query that should be executed and delete all  
documents."

From:  
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-delete-by-query.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-delete-by-query.html)

Regards,  
Jonny

--  
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/560db5db-ba42-4eaf-8dfd-70ff02357be8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/560db5db-ba42-4eaf-8dfd-70ff02357be8%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![J\_Schulz](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@J\_Schulz](https://discuss.elastic.co/u/J_Schulz)\
**Post date:** [February 20, 2014, 2:41pm UTC](https://discuss.elastic.co/t/delete-by-filtered-query-does-not-work-any-more-in-1-0-0/15927/2 "2014-02-20T14:41:47Z")

</div>

Sorry, forget to post the full query that fails:

curl -vv -XDELETE '[http://localhost:9200/test/\_query](http://localhost:9200/test/_query)' -d '{  
"filtered" : {  
"query" : {  
"term" : { "tag" : "wow" }  
},  
"filter" : {  
"range" : {  
"age" : { "from" : 10, "to" : 20 }  
}  
}  
}  
}'

--  
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/8759690e-e6f1-41c3-96ff-895ae0eb7c11%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8759690e-e6f1-41c3-96ff-895ae0eb7c11%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![J\_Schulz](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@J\_Schulz](https://discuss.elastic.co/u/J_Schulz)\
**Post date:** [February 20, 2014, 2:42pm UTC](https://discuss.elastic.co/t/delete-by-filtered-query-does-not-work-any-more-in-1-0-0/15927/3 "2014-02-20T14:42:36Z")

</div>

Sorry, forgot to post the full query that fails:

curl -vv -XDELETE '[http://localhost:9200/test/\_query](http://localhost:9200/test/_query)' -d '{  
"filtered" : {  
"query" : {  
"term" : { "tag" : "wow" }  
},  
"filter" : {  
"range" : {  
"age" : { "from" : 10, "to" : 20 }  
}  
}  
}  
}'

> 

--  
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/23763e1f-d2d6-484e-9d75-16c6ea04e4ac%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/23763e1f-d2d6-484e-9d75-16c6ea04e4ac%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [February 20, 2014, 4:09pm UTC](https://discuss.elastic.co/t/delete-by-filtered-query-does-not-work-any-more-in-1-0-0/15927/4 "2014-02-20T16:09:58Z")

</div>

The syntax has changed slightly, you'll now need to wrap your query inside  
a "query" block.

curl -vv -XDELETE '[http://localhost:9200/test/\_query](http://localhost:9200/test/_query)' -d '{  
"query": {  
"filtered" : {  
"query" : {  
"term" : { "tag" : "wow" }  
},  
"filter" : {  
"range" : {  
"age" : { "from" : 10, "to" : 20 }  
}  
}  
}  
}  
}'

--  
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/a4fdd364-8a13-470c-8ea2-e2ec9417039e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a4fdd364-8a13-470c-8ea2-e2ec9417039e%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:48am UTC](https://discuss.elastic.co/t/delete-by-filtered-query-does-not-work-any-more-in-1-0-0/15927/5 "2017-07-06T01:48:38Z")

</div>


