title: Elasticsearch .net NEST - DeleteByQuery not working but Search for same query works
body: <p>I'm trying to delete some documents from my Elasticsearch collection using NEST</p>
  
  <p>The following code works and returns 3 docs:</p>
  
  <pre><code>var results = client.Search&lt;JObject&gt;(s =&gt; s.Query(q =&gt; q.Terms("string.ProgramId", ids))
  </code></pre>
  
  <p>But when I use same query with DeleteByQuery like this:</p>
  
  <pre><code>var response = client.DeleteByQuery&lt;string&gt;(s =&gt; s.Query(q =&gt; q.Terms("string.ProgramId", ids)));
  </code></pre>
  
  <p>It throws me the following error:</p>
  
  <pre><code>An unhandled exception of type 'Nest.DispatchException' occurred in Nest.dll
  
  Additional information: Could not dispatch IElasticClient.DeleteByQuery() into any of the following paths: 
  
   - /{index}/_query
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>[edit]</p>
  
  <p>Got a response to it at another site that I need to specify indices when using a destructive endpoint such as delete.
  And also that I need to specify either the same type in the search/delete for it to go to the same path when querying or specify AllTypes()</p>
  
  <p>Tried the following line:</p>
  
  <pre><code>var response = client.DeleteByQuery&lt;JObject&gt;(s =&gt; s.AllIndices().Query(q =&gt; q.Terms("string.ProgramId", ids)));
  </code></pre>
  
  <p>And though it didn't throw an error this time, it didn't return any results.</p>