# Super-noob needs help with a mapping error

**URL:** <https://discuss.elastic.co/t/super-noob-needs-help-with-a-mapping-error/161900>\
**Category:** Logstash\
**Created:** [December 21, 2018, 9:29pm UTC](https://discuss.elastic.co/t/super-noob-needs-help-with-a-mapping-error/161900 "2018-12-21T21:29:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manzobar\_Gregarin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manzobar_gregarin/32/39105_2.png) [@Manzobar\_Gregarin](https://discuss.elastic.co/u/Manzobar_Gregarin)\
**Post date:** [December 21, 2018, 9:29pm UTC](https://discuss.elastic.co/t/super-noob-needs-help-with-a-mapping-error/161900/1 "2018-12-21T21:29:24Z")

</div>

Hey everyone, I have an issue indexing a log message. It's a mapping error.

> "status"=\>400, "error"=\>{"type"=\>"mapper\_parsing\_exception", "reason"=\>"failed to parse field [messageObject] of type [text]", "caused\_by"=\>{"type"=\>"illegal\_state\_exception", "reason"=\>"Can't get text on a START\_OBJECT at 1:2364"

The field messageObject is mapped like so:

> "messageObject" : {  
> "properties" : {  
> "ClassName" : {  
> "type" : "text",  
> "fields" : {  
> "keyword" : {  
> "type" : "keyword",  
> "ignore\_above" : 256

The messages are being stored in a dead letter queue, so when I check an example, I can see that the message in question has a very long messageObject field. I'm really new at this, so any help interpreting and fixing this is much appreciated.

---

<div class="post-metadata">

**Author:** ![Magnus\_Kessler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnus_kessler/32/42001_2.png) [@Magnus\_Kessler](https://discuss.elastic.co/u/Magnus_Kessler)\
**Post date:** [December 22, 2018, 12:48pm UTC](https://discuss.elastic.co/t/super-noob-needs-help-with-a-mapping-error/161900/2 "2018-12-22T12:48:18Z")

</div>

It appears that you're sending an object to a field that is already mapped as a text field, e.g.

`{ "messageObject": { "someField": "someValue" }}`

where the mapping would expect

`{"messageObject": "someText"}`

Please ensure that the data is formatted in a consistent way. Elasticsearch does not support mixing text and object [data types](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html) for the same field.

---

<div class="post-metadata">

**Author:** ![Manzobar\_Gregarin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manzobar_gregarin/32/39105_2.png) [@Manzobar\_Gregarin](https://discuss.elastic.co/u/Manzobar_Gregarin)\
**Post date:** [December 22, 2018, 3:03pm UTC](https://discuss.elastic.co/t/super-noob-needs-help-with-a-mapping-error/161900/3 "2018-12-22T15:03:29Z")

</div>

Thanks Magnus  
We're pulling in data from multiple sources, so it may take some time to fix that. How would I go about changing the mapping to accommodate both a text field and an object? Can I cast the text as an object from logstash?

---

<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:** [January 19, 2019, 3:03pm UTC](https://discuss.elastic.co/t/super-noob-needs-help-with-a-mapping-error/161900/4 "2019-01-19T15:03:32Z")

</div>

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