Delete by filtered query does not work any more in 1.0.0


(J. Schulz) #1

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

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

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.
To view this discussion on the web visit 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.


(J. Schulz) #2

Sorry, forget to post the full query that fails:

curl -vv -XDELETE '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.
To view this discussion on the web visit 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.


(J. Schulz) #3

Sorry, forgot to post the full query that fails:

curl -vv -XDELETE '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.
To view this discussion on the web visit 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.


(Binh Ly) #4

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' -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.
To view this discussion on the web visit 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.


(system) #5