title: How to speed up document append to existing array in elasticsearch?
body: <p>I am using elasticsearch version 6.3.1.
  And I am creating a nested type field,I have created this field to append all the documents of same ID.</p>
  
  <p>Here is my schema for index:-</p>
  
  <pre><code>curl -XPUT 'localhost:9200/axes_index_test12?pretty' -H 'Content-Type: application/json' -d'
  {
  "mappings": {
       "axes_type_test12": {
          "properties": {
             "totalData": {
                "type": "nested",
                "properties": {
                   "gpsdt": {
                      "type": "date",
          "format":"dateOptionalTime"
                   },
           "extbatlevel": {
                      "type": "integer"
                   },
           "intbatlevel" : {
          "type" : "integer"
           },
           "lastgpsdt": {
                      "type": "date",
          "format":"dateOptionalTime"
                   },
               "satno" : {
          "type" : "integer"
           },
           "srtangle" : {
          "type" : "integer"
           }
                }
             },
             "imei": {
                "type": "long"
             },
             "date": {
                "type": "date", "format":"dateOptionalTime"
             },
         "id" : {
         "type" : "long"
      }
          }
       }
    }
  }'
  </code></pre>
  
  <p>And to append into existing array I call following API : -</p>
  
  <p>Here is the documents which I have to append:-</p>
  
  <pre><code>data={
                      "script" : {"source": "ctx._source.totalData.add(params.count)",
                      "lang": "painless",
                      "params" : {"count" : { "gpsdt" : gpsdt,
                                                      "analog1" : analog1,
                                                      "analog2" : analog2,
                                                      "analog3" : analog3,
                                                      "analog4" : analog4,
                                                      "digital1" : digital1,
                                                      "digital2" : digital2,
                                                      "digital3" : digital3,
                                                      "digital4" : digital4,
                                                      "extbatlevel" : extbatlevel,
                                                      "intbatlevel" : intbatlevel,
                                                      "lastgpsdt" : lastgpsdt,
                                                      "latitude" : latitude,
                                                      "longitude" : longitude,
                                                      "odo" : odo,
                                                      "odometer" : odometer,
                                                      "satno" : satno,
                                                      "srtangle" : srtangle,
                                                      "speed" : speed
                                                 }
                                 }
                                      }
              }
  </code></pre>
  
  <p>Document Parsing:-</p>
  
  <pre><code>json_data = json.dumps(data)
  </code></pre>
  
  <p>And API url is: -</p>
  
  <pre><code>API_ENDPOINT = "http://localhost:9200/axes_index_test12/axes_type_test12/"+str(documentId)+"/_update"
  </code></pre>
  
  <p>And Finnaly I call this API:-</p>
  
  <pre><code>headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
  r = requests.post(url = API_ENDPOINT, data = json_data,headers=headers
  </code></pre>
  
  <p>Everything is fine with this but I am not getting good performance when I append new documents in existing array.</p>
  
  <p>So please suggest me what changes I should make?
  And I have 4 node cluster, 1 master, 2 data nodes and one cordinator node.</p>