# Existing mapping for \[myfield\] must be of type object but found \[text\]

**URL:** <https://discuss.elastic.co/t/existing-mapping-for-myfield-must-be-of-type-object-but-found-text/97250>\
**Category:** Logstash\
**Created:** [August 16, 2017, 11:49am UTC](https://discuss.elastic.co/t/existing-mapping-for-myfield-must-be-of-type-object-but-found-text/97250 "2017-08-16T11:49:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sentinel](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@sentinel](https://discuss.elastic.co/u/sentinel)\
**Post date:** [August 16, 2017, 11:49am UTC](https://discuss.elastic.co/t/existing-mapping-for-myfield-must-be-of-type-object-but-found-text/97250/1 "2017-08-16T11:49:49Z")

</div>

I am encountering lots of error messages in the elastic logs as I send messages from logstash. What do I have to do to myfield in order to make it an object?

"message" =\> "^%{TIMESTAMP\_ISO8601:timestamp},%{NUMBER:tz} [%{LOGLEVEL:loglevel}\s\*][(?\< **myfield** \>[\w\d{=,\ (\()}:-.]+)][(?[\w\d:-.]+)]%{GREEDYDATA:unstructured\_data}"

Here's the log details  
message:  
2017-07-13T04:37:10,782 [INFO][**Client-Push:1:2**][PriceRequestListener] Received PriceRequest: std\_hdr { begin\_string: "SX" msg\_type: "PriceRequest"

I think it doesn't like the ":" in the myfield. But I need to catch everything. How can I exclude this? I think this is a logstash topic.

[2017-08-16T12:08:04,205][DEBUG][o.e.a.b.TransportShardBulkAction] [e2UIlPy] [logstash-2017.08.16-pf][1] failed to execute bulk item (index) BulkShardRequest [[logstash-2017.08.16-pf][1]] containing [26] requests  
org.elasticsearch.index.mapper.MapperParsingException: Could not dynamically add mapping for field [Thread.java]. Existing mapping for [**myfield**] must be of type object but found [text].  
at org.elasticsearch.index.mapper.DocumentParser.getDynamicParentMapper(DocumentParser.java:861) ~[elasticsearch-5.4.2.jar:5.4.2]  
at org.elasticsearch.index.mapper.DocumentParser.parseValue(DocumentParser.java:581) ~[elasticsearch-5.4.2.jar:5.4.2]  
at org.elasticsearch.index.mapper.DocumentParser.innerParseObject(DocumentParser.java:396) ~[elasticsearch-5.4.2.jar:5.4.2]  
at org.elasticsearch.index.mapper.DocumentParser.parseObjectOrNested(DocumentParser.java:373) ~[elasticsearch-5.4.2.jar:5.4.2]  
at org.elasticsearch.index.mapper.DocumentParser.internalParseDocument(DocumentParser.java:93) ~[elasticsearch-5.4.2.jar:5.4.2]  
at org.elasticsearch.index.mapper.DocumentParser.parseDocument(DocumentParser.java:66) ~[elasticsearch-5.4.2.jar:5.4.2]  
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:277) ~[elasticsearch-5.4.2.jar:5.4.2]  
at org.elasticsearch.index.shard.IndexShard.prepareIndex(IndexShard.java:536) ~[elasticsearch-5.4.2.jar:5.4.2]  
at org.elasticsearch.index.shard.IndexShard.prepareIndexOnPrimary(IndexShard.java:513) ~[elasticsearch-5.4.2.jar:5.4.2]  
at org.elasticsearch.action.bulk.TransportShardBulkAction.prepareIndexOperationOnPrimary(TransportShardBulkAction.java:450) ~[elasticsearch-5.4.2.jar:5.4.2]

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 18, 2017, 5:33am UTC](https://discuss.elastic.co/t/existing-mapping-for-myfield-must-be-of-type-object-but-found-text/97250/2 "2017-08-18T05:33:54Z")

</div>

What's the current mapping of `myfield`? Use Elasticsearch's get mapping API. Is `myfield` _supposed_ to be a string or an object (i.e. a field that contains nested fields)?

> I think it doesn’t like the “:” in the myfield.

No, that's not the problem.

---

<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:** [September 15, 2017, 5:34am UTC](https://discuss.elastic.co/t/existing-mapping-for-myfield-must-be-of-type-object-but-found-text/97250/3 "2017-09-15T05:34:12Z")

</div>

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