# Some Mapping Confusions to resolve

**URL:** <https://discuss.elastic.co/t/some-mapping-confusions-to-resolve/8698>\
**Category:** Elasticsearch\
**Created:** [August 10, 2012, 2:45am UTC](https://discuss.elastic.co/t/some-mapping-confusions-to-resolve/8698 "2012-08-10T02:45:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajasuja18](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@ajasuja18](https://discuss.elastic.co/u/ajasuja18)\
**Post date:** [August 10, 2012, 2:45am UTC](https://discuss.elastic.co/t/some-mapping-confusions-to-resolve/8698/1 "2012-08-10T02:45:40Z")

</div>

Hi Everyone,

Q1. Can anyone explain the concept of Merging and Conflicts written here:  
[http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html)

How to configure this settings?

Q2. Also what we mean by \*index.mapper.dynamic \*written here:  
[http://www.elasticsearch.org/guide/reference/mapping/dynamic-mapping.html](http://www.elasticsearch.org/guide/reference/mapping/dynamic-mapping.html)

Thanks in advance...!!!

---

<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 10, 2012, 6:21am UTC](https://discuss.elastic.co/t/some-mapping-confusions-to-resolve/8698/2 "2012-08-10T06:21:05Z")

</div>

Q1.  
When you send a document tweet with a property "user":"myname", ES detect automaticaly the mapping for "tweet" type and define "user" as String.  
Then, you send a new document Tweet with a property "user" AND a new property "age":23.  
ES detect the new field and has to merge the existing mapping definition with the new one.

But, if you send in age "hello", the merge mapping will failed as you are trying to modify an existing field.

To configure it, I think that it's when you use Put Mapping API (not sure it's here):  
$ curl -XPUT '[http://localhost:9200/twitter/tweet/\_mapping](http://localhost:9200/twitter/tweet/_mapping)' -d '  
{  
"tweet" : {  
"ignore\_conflicts":true,  
"properties" : {  
"message" : {"type" : "string", "store" : "yes"}  
}  
}  
}  
'

Q2.  
If you don't want that ES auto detect your mappings, you can disable it. I think that if you send a document with no mapping defined and with index.mapper.dynamic=false, you will get an exception???

## HTH David

Le 10 août 2012 à 04:45, ajasuja [jasuja.ankit@gmail.com](mailto:jasuja.ankit@gmail.com) a écrit :

> Hi Everyone,
> 
> Q1. Can anyone explain the concept of Merging and Conflicts written here:  
> [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html)  
> How to configure this settings?
> 
> Q2. Also what we mean by index.mapper.dynamic written here:  
> [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/reference/mapping/dynamic-mapping.html)
> 
> Thanks in advance...!!!

---

<div class="post-metadata">

**Author:** ![ajasuja18](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@ajasuja18](https://discuss.elastic.co/u/ajasuja18)\
**Post date:** [August 10, 2012, 5:40pm UTC](https://discuss.elastic.co/t/some-mapping-confusions-to-resolve/8698/3 "2012-08-10T17:40:39Z")

</div>

Hi David,

Thanks for your reply.

For Q1. With those settings, its not working for me.

Also what happens in case of "ignore\_conflicts: true". If the same field  
has two types, then which type it takes? What will be the mapping of that  
field?

For Q2. You are very correct and after posting the question I also tried it  
practically. It doesn't take the default mapping and gives an exception  
\*type missing: trying to autocreate mapping, but dynamic mapping is  
disabled. \*  
\*  
\*  
Till this point its fine but after that (with same config  
index.mapper.dynamic: false), I defined one mapping with four fields and  
its type. The mapping  
is there and I checked it using GetMapping. After that I index a document  
with those four fields and with proper types. The document gets indexed.  
Now I tried to index another document with one additional field(means total  
5 fields) which I didn't mention in my mapping. It index that document  
also and also updated the mapping. So now I have the mapping which has 4  
fields which I defined earlier and 5th field which dynamically gets  
created.

_My use-case:_ I want ES should index only those fields which I have  
mentioned in my mapping. All the other fields should not take any default  
mapping.

Thanks for your time..!!!

Ankit  
On Thursday, August 9, 2012 11:21:05 PM UTC-7, David Pilato wrote:

> Q1.  
> When you send a document tweet with a property "user":"myname", ES detect  
> automaticaly the mapping for "tweet" type and define "user" as String.  
> Then, you send a new document Tweet with a property "user" AND a new  
> property "age":23.  
> ES detect the new field and has to merge the existing mapping definition  
> with the new one.
> 
> But, if you send in age "hello", the merge mapping will failed as you are  
> trying to modify an existing field.
> 
> To configure it, I think that it's when you use Put Mapping API (not sure  
> it's here):
> 
> $ curl -XPUT '[http://localhost:9200/twitter/tweet/\_mapping](http://localhost:9200/twitter/tweet/_mapping)' -d '  
> {  
> "tweet" : {
> 
> ```
> "ignore_conflicts":true,
> 
> "properties" : {
> 
> "message" : {"type" : "string", "store" : "yes"}
> }
> }
> 
> ```
> 
> }  
> '
> 
> Q2.  
> If you don't want that ES auto detect your mappings, you can disable it. I  
> think that if you send a document with no mapping defined and with  
> index.mapper.dynamic=false, you will get an exception???
> 
> ## HTH David
> 
> Le 10 août 2012 à 04:45, ajasuja \<[jasuja...@gmail.com](mailto:jasuja...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> Hi Everyone,
> 
> Q1. Can anyone explain the concept of Merging and Conflicts written here:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html)
> 
> How to configure this settings?
> 
> Q2. Also what we mean by \*index.mapper.dynamic \*written here:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/dynamic-mapping.html)
> 
> Thanks in advance...!!!

--

---

<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 6, 2017, 3:16am UTC](https://discuss.elastic.co/t/some-mapping-confusions-to-resolve/8698/4 "2017-07-06T03:16:49Z")

</div>


