# Renaming Values

**URL:** <https://discuss.elastic.co/t/renaming-values/296769>\
**Category:** Kibana\
**Created:** [February 9, 2022, 5:11pm UTC](https://discuss.elastic.co/t/renaming-values/296769 "2022-02-09T17:11:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chin1](https://avatars.discourse-cdn.com/v4/letter/c/edb3f5/32.png) [@chin1](https://discuss.elastic.co/u/chin1)\
**Post date:** [February 9, 2022, 5:11pm UTC](https://discuss.elastic.co/t/renaming-values/296769/1 "2022-02-09T17:11:21Z")

</div>

Hi there,

Is there away to rename values within visuals?  
so for example filtering Colors which outputs 1 , 2  
I want to rename these 1 == 'Red' 2== 'Blue' etc.

---

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [February 10, 2022, 1:43am UTC](https://discuss.elastic.co/t/renaming-values/296769/2 "2022-02-10T01:43:40Z")

</div>

Though I'm not sure these are only ways, you may use [runtime fields](https://www.elastic.co/guide/en/elasticsearch/reference/7.16/runtime.html) to manipulate the values.

Or of cource you may do it outside elasticsearch while indexing.

> [@Ingest pipeline : Getting lookup values from another index](https://discuss.elastic.co/t/ingest-pipeline-getting-lookup-values-from-another-index/164731/2):
>
> No this is not possible and should be done outside elasticsearch index process. Logstash for example. I wrote an example of this here: [http://david.pilato.fr/blog/2019/01/10/from-a-startup-to-a-listed-company-6-years-of-fun/](http://david.pilato.fr/blog/2019/01/10/from-a-startup-to-a-listed-company-6-years-of-fun/)

---

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [February 10, 2022, 2:09am UTC](https://discuss.elastic.co/t/renaming-values/296769/3 "2022-02-10T02:09:06Z")

</div>

```auto
PUT /test_map
{
  "mappings": {
    "properties": {
      "colorId":{
        "type":"keyword"
      }
    }
  }
}
PUT /test_map/_bulk
{"index":{}}
{"colorId":"1"}
{"index":{}}
{"colorId":"2"}

GET /test_map/_search
{
  "runtime_mappings": {
    "colorName": {
      "type": "keyword",
      "script": {
        "source": """
        for (val in doc['colorId']){
          emit(params.map[val])
        }
        """,
        "params":{
          "map":{
            "1": "Red",
            "2": "Blue"
          }
        }
      }
    }
  },
  "fields": [
    "colorName"
  ]
}

```

---

<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 10, 2022, 2:09am UTC](https://discuss.elastic.co/t/renaming-values/296769/4 "2022-03-10T02:09:25Z")

</div>

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