# Update the nested fields in json using partial update or update queries

**URL:** <https://discuss.elastic.co/t/update-the-nested-fields-in-json-using-partial-update-or-update-queries/147798>\
**Category:** Elasticsearch\
**Created:** [September 8, 2018, 5:32am UTC](https://discuss.elastic.co/t/update-the-nested-fields-in-json-using-partial-update-or-update-queries/147798 "2018-09-08T05:32:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![savya\_Dhurve](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@savya\_Dhurve](https://discuss.elastic.co/u/savya_Dhurve)\
**Post date:** [September 8, 2018, 5:32am UTC](https://discuss.elastic.co/t/update-the-nested-fields-in-json-using-partial-update-or-update-queries/147798/1 "2018-09-08T05:32:21Z")

</div>

I am using elasticsearch,i want to update specific fields in json using specific key in my case it's macid,the json looks like this

```
    {
        macid:'mac1234',
        attri:
            {
                data:{

                    ch1:12,
                    ch2:123
                },
                settings:
                    {
                        log_time:1min

                    }

            }

    }

```

and i want to update data,settings field with matching macid,and also their will be multiple records.  
if i found the macid with specific name then update the "data" or "setting" which is inside "attri".  
And i am using javascript

---

<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:** [October 6, 2018, 5:32am UTC](https://discuss.elastic.co/t/update-the-nested-fields-in-json-using-partial-update-or-update-queries/147798/2 "2018-10-06T05:32:26Z")

</div>

Closed on October 6, 2018, 5:32am UTC

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