title: Elasticsearch Java API - how do I delete document based on field?
body: <p>I would like to delete a document based on a specific field that is not the <code>_id</code> field, which is required in the following:</p>
  
  <pre><code>DeleteResponse response = NodeClient()
      .prepareDelete("user_name", "user_type", field_var)
      .execute()
      .actionGet();
  </code></pre>
  
  <p>I tried something similar to the following:</p>
  
  <pre><code>DeleteByQueryResponse response = client.prepareDeleteByQuery(“test”)
      .setQuery(termQuery(”_type”, “type1”))
      .execute()
      .actionGet();
  </code></pre>
  
  <p>But it appears to be deprecated in ES 2.1. </p>