title: Optimizing Bulk Indexing in elasticsearch
body: <p>We have an elastic search cluster of 3 nodes of the following configurations</p>
  
  <pre><code> #Cpu Cores     Memory(GB)   Disk(GB)    IO Performance 
      36            244.0        48000        very high
  </code></pre>
  
  <p>The machines are in 3 different zones namely eu-west-1c,eu-west-1a,eu-west-1b.</p>
  
  <p>Each elastic search instance is being allocated 30GB of heap space.</p>
  
  <p>we are using the above cluster for running aggregations only. The cluster has replication factor of 1 and all the string fields are not analyzed , doc_values is true for all the fields.</p>
  
  <p>We are pumping data into this cluster running 6 instances of logstash in parallel ( having a batch size of 1000)</p>
  
  <p>When more instances of logstash are started one by one the nodes of the ElasticSearch cluster starts throwing out of memory error.</p>
  
  <p>What could be the possible optimizations to speed up bulk indexing rate on the cluster?= Will presence of nodes of cluster in the same zone increase bulk indexing? Will adding more nodes in the cluster help ?</p>
  
  <p>Couple of steps taken so far </p>
  
  <p>Increase the bulk queue size from 50 to 1000<br>
  Increase refresh interval from 1 seconds to 2 minutes<br>
  Changed segments merge throttling to none (
      <a href="https://www.elastic.co/guide/en/elasticsearch/guide/current/indexing-" rel="nofollow noreferrer">https://www.elastic.co/guide/en/elasticsearch/guide/current/indexing-</a> performance.html)</p>
  
  <p>We cannot set the replication factor to 0 due to inconsistency involved if one of the nodes goes down.</p>