# Mapper\_parsing\_exception : elasticsearch json mapping with text

**URL:** <https://discuss.elastic.co/t/mapper-parsing-exception-elasticsearch-json-mapping-with-text/150513>\
**Category:** Elasticsearch\
**Created:** [October 1, 2018, 5:55am UTC](https://discuss.elastic.co/t/mapper-parsing-exception-elasticsearch-json-mapping-with-text/150513 "2018-10-01T05:55:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![76a99de1e92a429af5f9](https://avatars.discourse-cdn.com/v4/letter/7/b782af/32.png) [@76a99de1e92a429af5f9](https://discuss.elastic.co/u/76a99de1e92a429af5f9)\
**Post date:** [October 1, 2018, 5:55am UTC](https://discuss.elastic.co/t/mapper-parsing-exception-elasticsearch-json-mapping-with-text/150513/1 "2018-10-01T05:55:11Z")

</div>

Hi....

I logging nginx log with json, include request\_body.

My structure is [server - logstash - logstash - elasticsearch - kibana].

Request\_body's content is also json with escape characters, and sometimes just plain text.

That's is problem..!!

I successfully configure logstash config, but sometimes error occurred, when request\_body is text.

How to I configure elasticsearch index template - mapping?

I want to receive 1)+2) both type.

1. 

"request\_body": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
}

1. 

"request\_body": {  
"properties": {  
"enveloped\_message": {  
"properties": {  
"channel": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"app\_version": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
}, ....

Plz help me ㅠㅠ

Thanks.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 1, 2018, 6:07am UTC](https://discuss.elastic.co/t/mapper-parsing-exception-elasticsearch-json-mapping-with-text/150513/2 "2018-10-01T06:07:47Z")

</div>

A single field in an index can only be mapped one way, so the `request_body` field can not be mapped as both `text` and `object` in the same index. Either you need to change the structure so they are aligned, e.g. by moving the text content into a field under `request_body`, or store them in different indices.

---

<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:** [October 29, 2018, 6:42am UTC](https://discuss.elastic.co/t/mapper-parsing-exception-elasticsearch-json-mapping-with-text/150513/4 "2018-10-29T06:42:56Z")

</div>

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