# Getting error when trying o update field value (it is a keyword)

**URL:** <https://discuss.elastic.co/t/getting-error-when-trying-o-update-field-value-it-is-a-keyword/326891>\
**Category:** Kibana\
**Tags:** painless\
**Created:** [March 2, 2023, 10:36pm UTC](https://discuss.elastic.co/t/getting-error-when-trying-o-update-field-value-it-is-a-keyword/326891 "2023-03-02T22:36:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brunofl](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@brunofl](https://discuss.elastic.co/u/brunofl)\
**Post date:** [March 2, 2023, 10:36pm UTC](https://discuss.elastic.co/t/getting-error-when-trying-o-update-field-value-it-is-a-keyword/326891/1 "2023-03-02T22:36:06Z")

</div>

Trying to figure out this issue, the _pmdata1.pm\_data\_source.hw\_alias_ is a text field that is also mapped as keyword _pmdata1.pm\_data\_source.hw\_alias.key_.  
I tried this query (\_update\_by\_query) using the field it worked (fields are renamed), also tried with .key (no errors and no updates). Problem is that the kibana dashboard has an aggregation that uses hw\_alias to aggregate data and the new names never appear there, so I am trying to figure out if is there a specific procedure to make the renaming reflect on the dashboard.

```auto
POST /5g_account_sims/_update_by_query?wait_for_completion=false
{ 
  "script": {
	    "source": "ctx._source.pmdata1.pm_data_source.hw_alias = ‘newName’”,
	    "lang": "painless"
	  },
  "query":{
    "bool":{
      "must": [
        {"match": {"pmdata1.pm_data_source.hw_alias.keyword": “oldName”}}
        ]
    }
  }
}

```

---

<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:** [March 30, 2023, 10:36pm UTC](https://discuss.elastic.co/t/getting-error-when-trying-o-update-field-value-it-is-a-keyword/326891/2 "2023-03-30T22:36:29Z")

</div>

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