I am looking for advise and best practice regarding field name case sensitivity in ElasticSearch and whether there is a global configuration to make field names case insensitive. Also, if it is possible to disable ES from adding different fields if it does not exists in the mapping.
here is an example to illustrate the point;
1- create mapping with one field "name" in lowercase
curl -XPUT http://localhost:9200/twitter/user/_mapping -d '{
"user" : {
"properties" : {
"name" : { "type" : "string" }
}
}
}'
2- Index a document, using a different case for the name field (NAME)
curl -POST http://localhost:9200/twitter/user/1 -d '{
"NAME" : "Yasir"
}'
In the Elasticsearch logs, I noticed that the mapping is updated.
[2014-01-26 20:58:19,074][INFO ][cluster.metadata ] [Mad-Dog] [twitter] update_mapping [user] (dynamic)
3- check the mapping, you will notice a new field has been added "NAME"
curl -XGET http://localhost:9200/twitter/user/_mapping?pretty
{
"user" : {
"properties" : {
"NAME" : {
"type" : "string"
},
"name" : {
"type" : "string"
}
}
}
}
Thanks Yasir