# Trying to delete a tag

**URL:** https://discuss.elastic.co/t/trying-to-delete-a-tag/135034
**Category:** Elasticsearch
**Created:** [June 7, 2018, 5:28pm UTC](https://discuss.elastic.co/t/trying-to-delete-a-tag/135034 "2018-06-07T17:28:18Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![reswob](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/reswob/32/38015_2.png) [@reswob](https://discuss.elastic.co/u/reswob)
#### Post date: [June 7, 2018, 5:28pm UTC](https://discuss.elastic.co/t/trying-to-delete-a-tag/135034/1 "2018-06-07T17:28:18Z")

</div>

I was looking for a way to delete a tag from docs in an index and I found the following two discussions on github

> <https://github.com/elastic/elasticsearch/issues/1583>

> <https://github.com/elastic/elasticsearch/issues/21375>

I tried the suggestion in the first discussion:

> <https://github.com/elastic/elasticsearch/issues/1583#issuecomment-395489270>

And then I tried the suggestion in the second discussion:

> <https://github.com/elastic/elasticsearch/issues/21375#issuecomment-258918172>

But when I tried the syntax mentioned in that thread:

```
POST logstash-*/_update_by_query
{
"query" : {
"match" : { "tags": "GREEN" }
},
"script":{"inline":"ctx._source.tags.remove(ctx._source.field.indexOf(params.value))","lang":"painless","params": {"tag":"NEWTAG"}
}
}

```

I got the following error:

```
"type": "script_exception:,
"reason":"runtime error",
"script_stack": [
"ctx._source.tags.remove(ctx._source.field.indexOf(params.tag))",
" ^---- HERE"
],
"script":"ctx._source.tags.remove(ctx._source.field.indexOf(params.tag))",
"lang":"painless",
"caused_by": {
"type":"null_pointer_exception",
"reason": null
}
},
"status":500
}

```

I'm still looking, but I'm hoping someone has a suggestion about either my syntax for another method...

Or, I've also read that these errors can be caused by a single field NOT being an array, then the whole operation crashes. Is there a way to find that one (or few) fields?

---

<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, 2018, 5:28pm UTC](https://discuss.elastic.co/t/trying-to-delete-a-tag/135034/2 "2018-07-05T17:28:19Z")

</div>

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