# Problem with auto-mapping in ElasticSearch 5

**URL:** <https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095>\
**Category:** Elasticsearch\
**Created:** [August 16, 2016, 5:49am UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095 "2016-08-16T05:49:41Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![xldai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xldai/32/11388_2.png) [@xldai](https://discuss.elastic.co/u/xldai)\
**Post date:** [August 16, 2016, 5:49am UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/1 "2016-08-16T05:49:41Z")

</div>

Hello,

We are testing and want to move to ES 5 from ES 1.5.2, the log source PUT into ES looks like this:  
{code}  
{  
"\_index": "esb-2016.08.15",  
"\_type": "ESB",  
"\_id": "AVaM\_VjDQw5s6KmmdycR",  
"\_score": null,  
"\_source": {  
"eventUUID": "7f95b9a3-439e-4c11-ba10-a5649ec0a83d",  
"category": "osgi",  
"eventType": "OSGiEvent",  
"logMessage": "org.osgi.framework.BundleEvent[source=locator-monitor\_6.3.0.SNAPSHOT [310]]",  
"logSource": {  
"[host.name](http://host.name)": "xldai-PC",  
"[process.id](http://process.id)": "8244",  
"topic": "org/osgi/framework/BundleEvent/STARTED"  
},  
"logTimestamp": "2016-08-15T06:57:07.330+0000",  
"agentId": "agentXilai",  
"agentTimestamp": "2016-08-15T06:57:07.330+0000",  
"serverTimestamp": "2016-08-15T06:57:08.776+0000",  
"audit": false,  
"customInfo": {  
"bundle": "locator-monitor\_6.3.0.SNAPSHOT [310]",  
"[bundle.id](http://bundle.id)": "310",  
"bundle.symbolicName": "locator-monitor",  
"timestamp": "1471244227330"  
}  
}  
}  
{code}

It worked well when PUT this log into ES 1.5.2, but failed on ES 5 with this exception:  
{code}  
[2016-08-15 15:50:35,680][DEBUG][rest.suppressed] path: /talendesb-2016.08.16/ESB/123456, params: {pretty=true  
, index=esb-2016.08.15, id=123456, type=ESB}  
RemoteTransportException[[node-xld][127.0.0.1:9300][indices:data/write/index[p]]]; nested: IllegalArgumentException[Can'  
t merge a non object mapping [customInfo.bundle] with an object mapping [customInfo.bundle]];  
Caused by: java.lang.IllegalArgumentException: Can't merge a non object mapping [customInfo.bundle] with an object mappi  
ng [customInfo.bundle]  
at org.elasticsearch.index.mapper.object.ObjectMapper.merge(ObjectMapper.java:459)  
{code}

If rename the "bundle" field into something else e.g. "bundleObj", then it can be PUT into ES 5 successfully.  
{code}  
"customInfo": {  
"bundleObj": "locator-monitor\_6.3.0.SNAPSHOT [310]",  
"[bundle.id](http://bundle.id)": "310",  
"bundle.symbolicName": "locator-monitor",  
"timestamp": "1471244227330"  
}  
{code}

Any suggestions for this problem? (rename field name is not good because will incompatible with the existing our product)

Thanks in advance!  
Xldai

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 16, 2016, 9:08pm UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/2 "2016-08-16T21:08:30Z")

</div>

If you want to code format text, use the `</>` button.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 16, 2016, 10:10pm UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/3 "2016-08-16T22:10:07Z")

</div>

You will need first upgrade to 2.4 when out and apply a new setting to support dot in field names.  
Then you'll be able to upgrade to 5.0.

Upgrading directly from 1.x to 5.0 won't work if I'm not mistaken.

---

<div class="post-metadata">

**Author:** ![xldai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xldai/32/11388_2.png) [@xldai](https://discuss.elastic.co/u/xldai)\
**Post date:** [August 17, 2016, 2:07am UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/4 "2016-08-17T02:07:55Z")

</div>

Thanks David!

But seems the field names with dot (e.g. [bundle.id](http://bundle.id)) works well, the problem is happen only when the "bundle" and "[bundle.id](http://bundle.id)" co-existing in a same json element.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 17, 2016, 6:53am UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/5 "2016-08-17T06:53:34Z")

</div>

What is your mapping?

---

<div class="post-metadata">

**Author:** ![xldai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xldai/32/11388_2.png) [@xldai](https://discuss.elastic.co/u/xldai)\
**Post date:** [August 17, 2016, 7:56am UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/6 "2016-08-17T07:56:45Z")

</div>

We didn't POST any mapping into ES 5, just using the dynamic mapping. (this worked in ES 1.x)

After post the log json source above, the [http://localhost:9200/\_mapping?pretty](http://localhost:9200/_mapping?pretty) shows:  
"mappings" : { }

and got this exception in the ES 5 logs:  
[2016-08-17 15:47:35,266][DEBUG][rest.suppressed] path: /talendesb-2016.08.17/ESB, params: {index=talendesb-20  
16.08.17, type=ESB}  
RemoteTransportException[[\_-Moa3H][127.0.0.1:9300][indices:data/write/index[p]]]; nested: IllegalArgumentException[Can't  
merge a non object mapping [customInfo.bundle] with an object mapping [customInfo.bundle]];  
Caused by: java.lang.IllegalArgumentException: Can't merge a non object mapping [customInfo.bundle] with an object mappi  
ng [customInfo.bundle]  
at org.elasticsearch.index.mapper.object.ObjectMapper.merge(ObjectMapper.java:459)  
at org.elasticsearch.index.mapper.object.ObjectMapper.merge(ObjectMapper.java:57)  
at org.elasticsearch.index.mapper.DocumentParser.createDynamicUpdate(DocumentParser.java:211)  
at org.elasticsearch.index.mapper.DocumentParser.parseDocument(DocumentParser.java:91)  
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:286)  
at org.elasticsearch.index.shard.IndexShard.prepareIndex(IndexShard.java:511)

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 17, 2016, 9:24am UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/7 "2016-08-17T09:24:25Z")

</div>

May be open an issue then with a full recreation script?

---

<div class="post-metadata">

**Author:** ![xldai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xldai/32/11388_2.png) [@xldai](https://discuss.elastic.co/u/xldai)\
**Post date:** [August 18, 2016, 3:11am UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/8 "2016-08-18T03:11:25Z")

</div>

It can be reproduce with cURL.

> curl -H "Content-type: application/json" -X PUT -d "{ "eventUUID" : "0e8789c6-e9fb-4924-96eb-f8410c457fb9  
> ", "customInfo" : {"bundle" : "111", "bundle.id" : "222", "bundle.symbolicName": "locator-monitor", "tim  
> estamp": "1471244227330"} }" [http://localhost:9200/my\_index2/my\_type/3](http://localhost:9200/my_index2/my_type/3)

{"error":{"root\_cause":[{"type":"remote\_transport\_exception","reason":"[\_-Moa3H][127.0.0.1:9300][indices:data/write/inde  
x[p]]"}],"type":"illegal\_argument\_exception","reason":"Can't merge a non object mapping [customInfo.bundle] with an obje  
ct mapping [customInfo.bundle]"},"status":400}

I just want to be sure here it's an ES 5 mapping issue or invalid data issue before I open an issue ticket.

---

<div class="post-metadata">

**Author:** ![xldai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xldai/32/11388_2.png) [@xldai](https://discuss.elastic.co/u/xldai)\
**Post date:** [September 20, 2016, 7:09am UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/9 "2016-09-20T07:09:54Z")

</div>

Could you please point me that which setting I should configure to support dot in field names in ElasticSearch 2.4?

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [September 20, 2016, 10:08am UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/10 "2016-09-20T10:08:40Z")

</div>

The issue is that Elasticsearch interprets:

```auto
{
  "bundle.id": "222"
}

```

the same way as

```auto
{
  "bundle": {
    "id": "222"
  }
}

```

So it maps "bundle" as on object. But then "bundle" also needs to be mapped as a string due to

```auto
{
  "bundle": "111"
}

```

which causes mapping conflicts since `bundle` is also mapped as an object. You would need to organize you documents differently in order not to have such conflicts.

---

<div class="post-metadata">

**Author:** ![xldai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xldai/32/11388_2.png) [@xldai](https://discuss.elastic.co/u/xldai)\
**Post date:** [September 20, 2016, 10:23am UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/11 "2016-09-20T10:23:50Z")

</div>

Thanks Adrien!

Yes we solved this issue by better organize our json data.

I just asked another question related to ES 2.4.0, could you please also maybe give suggestions? Thanks

_Could you please point me that which setting I should configure to support dot in field names in ElasticSearch 2.4?_

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [September 20, 2016, 10:29am UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/12 "2016-09-20T10:29:41Z")

</div>

See [https://www.elastic.co/guide/en/elasticsearch/reference/2.4/dots-in-names.html#\_enabling\_support\_for\_dots\_in\_field\_names](https://www.elastic.co/guide/en/elasticsearch/reference/2.4/dots-in-names.html#_enabling_support_for_dots_in_field_names)

---

<div class="post-metadata">

**Author:** ![xldai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xldai/32/11388_2.png) [@xldai](https://discuss.elastic.co/u/xldai)\
**Post date:** [September 21, 2016, 3:45am UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/13 "2016-09-21T03:45:19Z")

</div>

This setting works well! Thank you Adrien!

---

<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 5, 2017, 10:18pm UTC](https://discuss.elastic.co/t/problem-with-auto-mapping-in-elasticsearch-5/58095/14 "2017-07-05T22:18:39Z")

</div>


