I am looking for tips and tricks for field case sensitivity in ElasticSearch and whether there is a global configuration to make field names case insensitive. In addition, if you can disable ES from adding different fields, if it does not exist in the mapping.
Here is an example illustrating the point;
1- create a mapping to a single field "name" in lowercase
curl -XPUT http:
"user" : {
"properties" : {
"name" : { "type" : "string" }
}
}
}'
2- Name the document using a different case for the name field (NAME)
curl -POST http:
"NAME" : "Yasir"
}'
In Elasticsearch logs, I noticed that the mapping was 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 that a new field "NAME" is added
curl -XGET http:
{
"user" : {
"properties" : {
"NAME" : {
"type" : "string"
},
"name" : {
"type" : "string"
}
}
}
}
Thanks Yasser
Yasir source
share