# Update where condition in elasticsearch

**URL:** <https://discuss.elastic.co/t/update-where-condition-in-elasticsearch/151646>\
**Category:** Elasticsearch\
**Created:** [October 9, 2018, 2:09pm UTC](https://discuss.elastic.co/t/update-where-condition-in-elasticsearch/151646 "2018-10-09T14:09:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![amit.patra](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@amit.patra](https://discuss.elastic.co/u/amit.patra)\
**Post date:** [October 9, 2018, 2:09pm UTC](https://discuss.elastic.co/t/update-where-condition-in-elasticsearch/151646/1 "2018-10-09T14:09:04Z")

</div>

Hi,  
We have thousand of records like below json.  
{  
"\_index": "commusat.mms\_cri",  
"\_type": "doc",  
"\_id": "pcolWGYBbjbfpczOv192",  
"\_version": 1,  
"\_score": null,  
"\_source": {  
"id": "236e66510e049b70",  
"case\_name": null,  
"calling\_lat": 57.26625,  
"calling\_tmsi": null,  
"interception\_mode": "L\_ONLY",  
"sms\_content": null,  
"terminal\_type": null,  
"endreason": null,  
"cld\_alias": null,  
"called\_imei": null,  
"interception\_system": "ISAT",  
"calling\_long": -16.57479,  
"country\_contacted": null,  
"starttime": "2016-04-24T10:43:56.000Z",  
"calling\_imei": "35303204178532",  
"duration": null,  
"calling\_spot": null,  
"noi\_flag": null,  
"calling\_imsi": "901112116285962",  
"establishment\_cause": "LOCATIONUPDATE",  
"direction": "O",  
"called\_spot": null,  
"country\_code": null,  
"satelite\_name": "PKSAT002",  
"type": "rcaproperty",  
"called\_tmsi": null,  
"lmby": 0,  
"@timestamp": "2018-10-09T09:26:00.690Z",  
"lmdt": null,  
"callingparty": null,  
"cli\_alias": null,  
"t2thop": null,  
"calledparty": null,  
"called\_long": null,  
"called\_lat": null,  
"lmdt1": "2017-10-04T10:42:30.000Z",  
"called\_imsi": null,  
"calltype": "LOC",  
"t2tid": null,  
"@version": "1"  
},  
"fields": {  
"@timestamp": [  
"2018-10-09T09:26:00.690Z"  
],  
"lmdt1": [  
"2017-10-04T10:42:30.000Z"  
],  
"starttime": [  
"2016-04-24T10:43:56.000Z"  
]  
},  
"sort": [  
1461494636000  
]  
}

We want to update the records in a where condition. We want to append a Field trans\_remarks on update that will store as array key value pair.

Like for id 236e66510e049b70 , we want to append

"trans\_remarks": [`{ "user_id": "50", "remarks": "keep on track" }` , `{ "user_id": "10", "remarks": "India on track" }`]

What will the update query for that.

Thanks,

---

<div class="post-metadata">

**Author:** ![amit.patra](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@amit.patra](https://discuss.elastic.co/u/amit.patra)\
**Post date:** [October 10, 2018, 7:20am UTC](https://discuss.elastic.co/t/update-where-condition-in-elasticsearch/151646/2 "2018-10-10T07:20:29Z")

</div>

Hi @Christian_Dahlqvist,

can please help me out.

Thanks,

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 10, 2018, 7:54am UTC](https://discuss.elastic.co/t/update-where-condition-in-elasticsearch/151646/3 "2018-10-10T07:54:32Z")

</div>

Read [this](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and specifically the "Also be patient" part.

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.

Do not ping people who are not yet in the thread

---

<div class="post-metadata">

**Author:** ![amit.patra](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@amit.patra](https://discuss.elastic.co/u/amit.patra)\
**Post date:** [October 12, 2018, 8:38am UTC](https://discuss.elastic.co/t/update-where-condition-in-elasticsearch/151646/4 "2018-10-12T08:38:25Z")

</div>

Hi

can anyone please help me out.

Thanks,

---

<div class="post-metadata">

**Author:** ![amit.patra](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@amit.patra](https://discuss.elastic.co/u/amit.patra)\
**Post date:** [October 22, 2018, 5:04am UTC](https://discuss.elastic.co/t/update-where-condition-in-elasticsearch/151646/5 "2018-10-22T05:04:04Z")

</div>

Hi

can anyone please help me out.

Thanks,

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 19, 2018, 5:04am UTC](https://discuss.elastic.co/t/update-where-condition-in-elasticsearch/151646/6 "2018-11-19T05:04:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
