# Elasticsearch multilevel filter and update

**URL:** https://discuss.elastic.co/t/elasticsearch-multilevel-filter-and-update/182447
**Category:** Elasticsearch
**Created:** [May 23, 2019, 1:28pm UTC](https://discuss.elastic.co/t/elasticsearch-multilevel-filter-and-update/182447 "2019-05-23T13:28:35Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![User77](https://avatars.discourse-cdn.com/v4/letter/u/a183cd/32.png) [@User77](https://discuss.elastic.co/u/User77)
#### Post date: [May 23, 2019, 1:28pm UTC](https://discuss.elastic.co/t/elasticsearch-multilevel-filter-and-update/182447/1 "2019-05-23T13:28:35Z")

</div>

Elasticsearch : 6.3  
I'm trying to update the nested field by filtering the particular Book. Below is the sample record.

{  
"StoreName":"test",  
"StoreID":"12435",  
"BookInfo":[  
{  
"Name":"Book1",  
"Comments":[  
{  
"date":"2019-01-07",  
"Comment":"this is a nice book"  
},  
{  
"date":"2019-01-06",  
"Comment":"this is a nice book"  
},  
{  
"date":"2019-01-04",  
"Comment":"this is a nice book"  
},  
{  
"date":"2019-01-03",  
"Comment":"this is a nice book"  
}  
],  
"UPC":2435466,

```
  },
  {  
     "Name":"Book2",
     "Comments":[  
        {  
           "date":"2019-01-07",
           "Comment":"this is a nice book"
        },
        {  
           "date":"2019-01-06",
           "Comment":"this is a nice book"
        },
        {  
           "date":"2019-01-04",
           "Comment":"this is a nice book"
        },
        {  
           "date":"2019-01-03",
           "Comment":"this is a nice book"
        }
     ],
     "UPC":576868345657,

  },

```

}  
]  
}  
Here, we have multiple stores and each store has multiple books. For each book, we store the user comments on daily basis. I want to add the date and comment under [BookInfo.Comments] by checking whether the comment on that particular date is already there or not. If it's already there, then I'll need to skip it if not then append the new comment. I tried doing it by update API but I couldn't filter the particular book and update the comments for it from the list of available books. I want to do it as bulk update. Can someone help me with this? Thanks in advance.

---

<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: [June 20, 2019, 1:28pm UTC](https://discuss.elastic.co/t/elasticsearch-multilevel-filter-and-update/182447/2 "2019-06-20T13:28:36Z")

</div>

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