title: How Elastic Search delete_by_query work ? What happens when we insert new data and retrieve the same while deleting documents?
body: <p>I wanted to know more about elastic delete, it's Java high level delete api &amp; weather it's feasible to perform bulk delete.</p>
  
  <p>Following are the config information</p>
  
  <ul>
  <li>Java: 8</li>
  <li>Elastic Version: 7.1.1</li>
  <li><p>Elastic dependencies added:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.elasticsearch.client&lt;/groupId&gt;
      &lt;artifactId&gt;elasticsearch-rest-high-level-client&lt;/artifactId&gt;
      &lt;version&gt;7.1.1&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.elasticsearch&lt;/groupId&gt;
      &lt;artifactId&gt;elasticsearch&lt;/artifactId&gt;
      &lt;version&gt;7.1.1&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre></li>
  </ul>
  
  <p>In my case daily around 10K records are added into the index <code>dev-answer</code>. 
  I want to trigger delete operation (this can be triggered daily or once in a week or once in a month) which will basically delete all documents from above <code>index</code> if specific condition is satisfied. (Which I'll give in <code>DeleteByQueryRequest</code>)</p>
  
  <p>For delete there is an api as given in latest <a href="https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.1/java-rest-high-document-delete-by-query.html" rel="noreferrer">doc</a> which I'm referring.</p>
  
  <pre><code>DeleteByQueryRequest request = new DeleteByQueryRequest("source1", "source2");
  </code></pre>
  
  <p>While reading the documentation I came across following queries which I'm unable to understand.</p>
  
  <ol>
  <li><p>As in doc: <code>It’s also possible to limit the number of processed documents by setting size. request.setSize(10);</code> 
  What does processed document means ? Will it delete only 10 documents ? </p></li>
  <li><p>What batch size I should set ? <code>request.setBatchSize(100);</code> it's performance is based on how many documents we are going to delete ?</p>
  
  <p>Should I first make a call to <code>get no of documents</code> &amp; based on that <code>setBatchSize</code> should be changed ?</p></li>
  <li><p><code>request.setSlices(2);</code> Slices should be depend on how many cores executor machine have or on no of cores in elastic cluster ?</p></li>
  <li><p>In documentation the method <code>setSlices(2)</code> is given which I'm unable to find in class <code>org.elasticsearch.index.reindex.DeleteByQueryRequest</code>. What I'm missing here ?</p></li>
  <li><p>Let's consider if I'm executing this delete query in async mode which is taking 0.5-1.0 sec, meanwhile if I'm doing get request on this index, will it give some exception ? 
  Also in the same time if I inserted new document &amp; retrieving the same, will it be able to give response ?</p></li>
  </ol>