Some Mapping Confusions to resolve

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

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

Thanks in advance...!!!

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' -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 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
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

Thanks in advance...!!!

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' -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 <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

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

Thanks in advance...!!!

--