# Removing field doesn't work

**URL:** <https://discuss.elastic.co/t/removing-field-doesnt-work/55165>\
**Category:** Elasticsearch\
**Created:** [July 11, 2016, 8:09am UTC](https://discuss.elastic.co/t/removing-field-doesnt-work/55165 "2016-07-11T08:09:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![muhamadli302](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@muhamadli302](https://discuss.elastic.co/u/muhamadli302)\
**Post date:** [July 11, 2016, 8:09am UTC](https://discuss.elastic.co/t/removing-field-doesnt-work/55165/1 "2016-07-11T08:09:49Z")

</div>

Hello,

I'm using ES 1.7  
I'm trying to remove a field that only appears in some of the documents on my index. Here is my query:  
`curl -XPOST 'localhost:9200/data/_update' -d '{"script" : "ctx._source.remove = \"publisher\""}'`

and the answer I get is:  
`{"error":"InvalidTypeNameException[mapping type name [_update] can't start with '_']", "status":400}`

So I removed the "\_" from "update":  
`curl -XPOST 'localhost:9200/data/update' -d '{"script" : "ctx._source.remove = \"publisher\""}'`

And the output:  
`{"_index":"df","_type":"case", "_id":update","_varsion":1,"created":true}`

But then I look at the index on kibana and it didn't delete the field.  
So I tried again, the output was a bit different:  
`{"_index":"df","_type":"case", "_id":update","_varsion":2,"created":false}`

But still didn't delete it. What am I doing wrong?

---

<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:** [July 11, 2016, 8:22am UTC](https://discuss.elastic.co/t/removing-field-doesnt-work/55165/2 "2016-07-11T08:22:23Z")

</div>

Update API in 1.7 requires a document ID. See [https://www.elastic.co/guide/en/elasticsearch/reference/1.7/docs-update.html](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/docs-update.html)

Something like

```auto
curl -XPOST 'localhost:9200/data/type/1/_update' -d '{ ... }'

```

---

<div class="post-metadata">

**Author:** ![muhamadli302](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@muhamadli302](https://discuss.elastic.co/u/muhamadli302)\
**Post date:** [July 11, 2016, 10:55am UTC](https://discuss.elastic.co/t/removing-field-doesnt-work/55165/3 "2016-07-11T10:55:42Z")

</div>

But what if I want to remove the field from ALL of the documents in that index?

---

<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:** [July 11, 2016, 11:13am UTC](https://discuss.elastic.co/t/removing-field-doesnt-work/55165/4 "2016-07-11T11:13:55Z")

</div>

Update to 2.3 would be the best option IMO.

---

<div class="post-metadata">

**Author:** ![muhamadli302](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@muhamadli302](https://discuss.elastic.co/u/muhamadli302)\
**Post date:** [July 11, 2016, 11:58am UTC](https://discuss.elastic.co/t/removing-field-doesnt-work/55165/5 "2016-07-11T11:58:33Z")

</div>

Hi,  
Thanks for the advice, but currently I can't update for a few reasons.  
Do you have any other advice for me?

---

<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:** [July 11, 2016, 8:02pm UTC](https://discuss.elastic.co/t/removing-field-doesnt-work/55165/6 "2016-07-11T20:02:33Z")

</div>

May be this? [https://github.com/yakaz/elasticsearch-action-updatebyquery](https://github.com/yakaz/elasticsearch-action-updatebyquery)

---

<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:** [July 5, 2017, 10:36pm UTC](https://discuss.elastic.co/t/removing-field-doesnt-work/55165/7 "2017-07-05T22:36:26Z")

</div>


