# How to delete a expecif field in a query elasticsearch

**URL:** <https://discuss.elastic.co/t/how-to-delete-a-expecif-field-in-a-query-elasticsearch/180422>\
**Category:** Elasticsearch\
**Created:** [May 9, 2019, 5:51pm UTC](https://discuss.elastic.co/t/how-to-delete-a-expecif-field-in-a-query-elasticsearch/180422 "2019-05-09T17:51:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![matheusribeirogarcia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matheusribeirogarcia/32/44363_2.png) [@matheusribeirogarcia](https://discuss.elastic.co/u/matheusribeirogarcia)\
**Post date:** [May 9, 2019, 5:51pm UTC](https://discuss.elastic.co/t/how-to-delete-a-expecif-field-in-a-query-elasticsearch/180422/1 "2019-05-09T17:51:33Z")

</div>

If i have that document:

```
 POST /contentman/sites
{
  "name":"jimmy_page",
  "author":"Jimmy Page",
  "instalacao":"MD",
  "raiz":"jimmy_oage",
  "url":"jimmy_oage",
  "PAGES":[
    {
      "name":"index",
      "site_id":"1",
      "AREAS":[
        {
          "name":"inicio",
          "page_id":"1"
        }
        ]
    },
    {
      "name":"another_index",
      "site_id":"2",
      "AREAS":[
        {
          "name":"inicio",
          "page_id":"1"
        }
        ]
    }
    ]
}

```

And I only want to delete the PAGE in that has the name equals to Index, what Query should I do to delete that Page?

---

<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:** [May 9, 2019, 8:25pm UTC](https://discuss.elastic.co/t/how-to-delete-a-expecif-field-in-a-query-elasticsearch/180422/2 "2019-05-09T20:25:56Z")

</div>

May be an update by query with a painless script but that looks super complicated to me.  
Can't you just find all the documents which are matching `PAGE.name=index` and then process them individually to remove whatever content you want and index again the modified document?

I believe this is doable with a Painless script but I can't help more as I'm not a painless user. 🙂

---

<div class="post-metadata">

**Author:** ![matheusribeirogarcia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matheusribeirogarcia/32/44363_2.png) [@matheusribeirogarcia](https://discuss.elastic.co/u/matheusribeirogarcia)\
**Post date:** [May 9, 2019, 8:56pm UTC](https://discuss.elastic.co/t/how-to-delete-a-expecif-field-in-a-query-elasticsearch/180422/3 "2019-05-09T20:56:56Z")

</div>

haha, i'll check that approach, i'll go for the painless solution 😃

---

<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 6, 2019, 8:56pm UTC](https://discuss.elastic.co/t/how-to-delete-a-expecif-field-in-a-query-elasticsearch/180422/4 "2019-06-06T20:56:59Z")

</div>

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