# Update value of a filed in a list of objects - Elasticsearch (update by query)

**URL:** <https://discuss.elastic.co/t/update-value-of-a-filed-in-a-list-of-objects-elasticsearch-update-by-query/208740>\
**Category:** Elasticsearch\
**Created:** [November 20, 2019, 4:22pm UTC](https://discuss.elastic.co/t/update-value-of-a-filed-in-a-list-of-objects-elasticsearch-update-by-query/208740 "2019-11-20T16:22:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhilash\_Sathe1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhilash_sathe1/32/46158_2.png) [@Abhilash\_Sathe1](https://discuss.elastic.co/u/Abhilash_Sathe1)\
**Post date:** [November 20, 2019, 4:22pm UTC](https://discuss.elastic.co/t/update-value-of-a-filed-in-a-list-of-objects-elasticsearch-update-by-query/208740/1 "2019-11-20T16:22:05Z")

</div>

![Console_-_Kibana](https://us1.discourse-cdn.com/elastic/original/3X/8/d/8d8ee2f4be50e7d16f0b2d6f2ad8e23e6bcba3a8.png)

As shown in the image, I need to create a query that will accept a comma separated string of the `id` field and whichever `id` field's value matches, the flag **is\_read** will change to **true**.

I tried to create something like this. But failed. Can someone help me with this?

```
    POST myindex/_update_by_query
    {
      "query" : {
        "bool" : {
          "filter" : {
            "terms" : {
              "notifications.id" : ["1119bb5e819c482c9b311f2a3315ca1b, 1119bb5e819c482c9b311f2a3153451b"] 
            }
          }
        }
      },
        "script" : {
          "inline" : "ctx._source.notifications.is_read= true;", 
          "lang" : "painless"
          }
      }
```

---

<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:** [December 18, 2019, 4:22pm UTC](https://discuss.elastic.co/t/update-value-of-a-filed-in-a-list-of-objects-elasticsearch-update-by-query/208740/2 "2019-12-18T16:22:11Z")

</div>

Closed on December 18, 2019, 4:22pm UTC

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