# Update value on field with spaces

**URL:** <https://discuss.elastic.co/t/update-value-on-field-with-spaces/225652>\
**Category:** Kibana\
**Created:** [March 30, 2020, 10:18am UTC](https://discuss.elastic.co/t/update-value-on-field-with-spaces/225652 "2020-03-30T10:18:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elaak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elaak/32/55014_2.png) [@Elaak](https://discuss.elastic.co/u/Elaak)\
**Post date:** [March 30, 2020, 10:18am UTC](https://discuss.elastic.co/t/update-value-on-field-with-spaces/225652/1 "2020-03-30T10:18:32Z")

</div>

I have a field in my elasticsearch that I wish to be able to update using the `_update` API. Currently I make a request and change the value of field `FIELD` to `VALUE` using this body:

```
{
   "script": {
    "source": "ctx._source.FIELD= params.class",
    "lang": "painless",
    "params": {
        "class": "VALUE"
        }
    }
}

```

However, when I show my data in Kibana, I want to use a more descriptive fieldname, such as `TEST VALUES`. My question is if there is a simple solution two make my two wishes come true?

I have tried field alias in ES, but the field never shows up in the index pattern in Kibana (I made sure to even try create a new index for this). I `PUT` the following body to my elasticsearch instance at `http://localhost:9200/myindex/_mapping`:

```
{
  "properties": {
    "TEST VALUES": {
      "type": "alias",
      "path": "FIELD"
    }
  }
}

```

I was not sure if this belongs to Kibana or Elasticsearch, but I hope there is only something missing in Kibana for the alias field to be visible.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [March 30, 2020, 2:39pm UTC](https://discuss.elastic.co/t/update-value-on-field-with-spaces/225652/2 "2020-03-30T14:39:50Z")

</div>

Hi @Elaak,

unfortunately there is no way to do this in Kibana:

- Issue tracking support for Elasticsearch field aliases: [https://github.com/elastic/kibana/issues/21705](https://github.com/elastic/kibana/issues/21705)
- Issue tracking support for Kibana side renaming of fields: [https://github.com/elastic/kibana/issues/47659](https://github.com/elastic/kibana/issues/47659)

Currently Kibana will always reflect the actual field names.

---

<div class="post-metadata">

**Author:** ![Elaak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elaak/32/55014_2.png) [@Elaak](https://discuss.elastic.co/u/Elaak)\
**Post date:** [April 3, 2020, 7:00am UTC](https://discuss.elastic.co/t/update-value-on-field-with-spaces/225652/3 "2020-04-03T07:00:31Z")

</div>

Thank you for the solid answer. I am guessing for the time being it will have to be. But would Scripted fields be a possible solution? Do they update fields in real-time, so that I can calculate a new field based on the field I update, with no or minimal changes?

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [April 3, 2020, 7:54am UTC](https://discuss.elastic.co/t/update-value-on-field-with-spaces/225652/4 "2020-04-03T07:54:46Z")

</div>

Yes, scripted fields would be an option for this - they are calculated at request time, which gives them a lot of flexibility with the cost of performance when it comes to large amounts of data (as they can't be indexed because of their dynamic nature). It's definitely a good start though (especially because it's so easy to do).

If the performance penalty becomes a problem, consider re-indexing your data with an ingest pipeline using a [script processor](https://www.elastic.co/guide/en/elasticsearch/reference/master/script-processor.html) - this is basically the same thing, but executed just once at ingest time. This means it's way harder to change a script (because you have to crunch through all of your data once), but after that's done it's as fast a regular 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:** [May 1, 2020, 7:54am UTC](https://discuss.elastic.co/t/update-value-on-field-with-spaces/225652/5 "2020-05-01T07:54:52Z")

</div>

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