title: Elasticsearch: remove/update field inside nested object
body: <pre><code>{
    "_index" : "test",
    "_type" : "test",
    "_id" : "1212",
    "_version" : 5,
    "found" : true,
    "_source" : {
      "count" : 42,
      "list_data" : [ {
        "list_id" : 11,
        "timestamp" : 1469125397
      }, {
        "list_id" : 122,
        "timestamp" : 1469050965
      } ]
    }
  }
  </code></pre>
  
  <p>This is my document schema.<code>list_data</code> is nested object. I have requirement to update/delete particular filed inside <code>list_data</code>. I am able to update <code>count</code> field using groovy script.</p>
  
  <pre><code>$ curl -XPOST 'localhost:9200/index/type/1212/_update?pretty' -d '
  {
      "script" : "ctx._source.count = 41"
  }'
  </code></pre>
  
  <p>But don't know how to update nested object.</p>
  
  <p>For example i want to add this into <code>list_data</code>.</p>
  
  <pre><code>{
     "list_id" : 121,
     "timestamp" : 1469050965
  }
  </code></pre>
  
  <p>and my document should change to:</p>
  
  <pre><code>{
    "_index" : "test",
    "_type" : "test",
    "_id" : "1212",
    "_version" : 6,
    "found" : true,
    "_source" : {
      "count" : 41,
      "list_data" : [ {
        "list_id" : 11,
        "timestamp" : 1469125397
      }, {
        "list_id" : 121,
        "timestamp" : 1469050965
      }, {
        "list_id" : 122,
        "timestamp" : 1469050965
      } ]
    }
  }
  </code></pre>
  
  <p>and if i perform delete based on <code>list_id</code> = 122 my record should look like</p>
  
  <pre><code>{
    "_index" : "test",
    "_type" : "test",
    "_id" : "1212",
    "_version" : 7,
    "found" : true,
    "_source" : {
      "count" : 41,
      "list_data" : [ {
        "list_id" : 11,
        "timestamp" : 1469125397
      }, {
        "list_id" : 121,
        "timestamp" : 1469050965
      }]
    }
  }
  </code></pre>