[[delete-by-query]] == Delete By Query API The delete by query API allows to delete documents from one or more indices and one or more types based on a <>. 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 link:{ref}/docs-delete-by-query.html[delete_by_query API] docs.