2013-08-28 19:24:34 -04:00
|
|
|
[[delete-by-query]]
|
|
|
|
== Delete By Query API
|
|
|
|
|
2014-05-12 22:07:46 -04:00
|
|
|
The delete by query API allows one to delete documents from one or more
|
2013-08-28 19:24:34 -04:00
|
|
|
indices and one or more types based on a <<query-dsl-queries,query>>. Here
|
|
|
|
is an example:
|
|
|
|
|
|
|
|
[source,java]
|
|
|
|
--------------------------------------------------
|
|
|
|
import static org.elasticsearch.index.query.FilterBuilders.*;
|
|
|
|
import static org.elasticsearch.index.query.QueryBuilders.*;
|
|
|
|
|
|
|
|
DeleteByQueryResponse response = client.prepareDeleteByQuery("test")
|
|
|
|
.setQuery(termQuery("_type", "type1"))
|
|
|
|
.execute()
|
|
|
|
.actionGet();
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
For more information on the delete by query operation, check out the
|
2013-09-03 10:15:28 -04:00
|
|
|
{ref}/docs-delete-by-query.html[delete_by_query API]
|
2013-08-28 19:24:34 -04:00
|
|
|
docs.
|