Elasticsearch field field name case sensitive

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://localhost:9200/twitter/user/_mapping -d '{ 
        "user" : { 
            "properties" : { 
            "name" : { "type" : "string" } 
        } 
    } 
}' 

2- Name the document using a different case for the name field (NAME)

curl -POST http://localhost:9200/twitter/user/1 -d '{ 
   "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://localhost:9200/twitter/user/_mapping?pretty

{
  "user" : {
    "properties" : {
      "NAME" : {
        "type" : "string"
      },
      "name" : {
        "type" : "string"
      }
    }
  }
}

Thanks Yasser

+4
source share
1 answer

, , .

action.auto_create_index false.

, . . .

EDIT:

@javanna, . index.mapper.dynamic false.

. , elasticsearch , strict.

+3

Source: https://habr.com/ru/post/1523815/


All Articles