# Getting null in dynamic mapping field

**URL:** <https://discuss.elastic.co/t/getting-null-in-dynamic-mapping-field/183687>\
**Category:** Kibana\
**Created:** [May 31, 2019, 8:49am UTC](https://discuss.elastic.co/t/getting-null-in-dynamic-mapping-field/183687 "2019-05-31T08:49:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumit.sipani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sumit.sipani/32/47217_2.png) [@sumit.sipani](https://discuss.elastic.co/u/sumit.sipani)\
**Post date:** [May 31, 2019, 8:49am UTC](https://discuss.elastic.co/t/getting-null-in-dynamic-mapping-field/183687/1 "2019-05-31T08:49:43Z")

</div>

Hi

I am using following version of Kibana:  
Version: 6.1.2

I have created dynamic mapping field using PUT MAPPINGS api in following way:

```
PUT /logstash-2019.05.31/doc/_mapping
{
      "properties":{
        "message": {
            "type": "text",
            "norms": false,
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 2048
              }
            }
          }
      }
}

```

Because I wanted to perform aggregate function of message field but it is text type. So i added message.keyword of keyword type.

But when I see the data, in many places, data is present in the message but message.keyword is empty. After some inspections, I realised that if any special character is present that message.keyword is null.

Kindly help me to resolve the issue.

Thanks!

---

<div class="post-metadata">

**Author:** ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)\
**Post date:** [May 31, 2019, 11:35pm UTC](https://discuss.elastic.co/t/getting-null-in-dynamic-mapping-field/183687/2 "2019-05-31T23:35:29Z")

</div>

Hi there! I found some other threads which look similar to the problem you're having. I think you might need to use a [custom analyzer](https://discuss.elastic.co/t/how-to-index-special-characters-and-search-those-special-characters-in-elasticsearch/42506/2) to prevent those special characters from being stripped. Note that this occurs at index-time, so you may need to create your custom analyzer, apply it to a new index, and then reindex your data to make it searchable the way you want.

Here are some related resources which you might also find helpful:

- [How to Index special characters and Search those special characters in Elasticsearch](https://discuss.elastic.co/t/how-to-index-special-characters-and-search-those-special-characters-in-elasticsearch/42506/2)
- [Analysis and Analyzers docs](https://www.elastic.co/guide/en/elasticsearch/guide/current/analysis-intro.html)
- [Search for special characters](https://discuss.elastic.co/t/search-for-special-characters/114495/5)
- [https://stackoverflow.com/questions/37703017/search-with-special-characters-in-elasticsearch](https://stackoverflow.com/questions/37703017/search-with-special-characters-in-elasticsearch)

---

<div class="post-metadata">

**Author:** ![sumit.sipani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sumit.sipani/32/47217_2.png) [@sumit.sipani](https://discuss.elastic.co/u/sumit.sipani)\
**Post date:** [June 4, 2019, 9:11am UTC](https://discuss.elastic.co/t/getting-null-in-dynamic-mapping-field/183687/3 "2019-06-04T09:11:38Z")

</div>

Thank you very much. I will try with custom analyzer.

---

<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 2, 2019, 9:11am UTC](https://discuss.elastic.co/t/getting-null-in-dynamic-mapping-field/183687/4 "2019-07-02T09:11:40Z")

</div>

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