首页 > 解决方案 > Is mapping property names with dot is allowed in Elasticsearch Index Management?

问题描述

For example, a JSON file with key-value pair where the key name has a dot in between it. When this file is uploaded, the dot is treated as next line \n and the name will split into two properties. I tried to use mapper.allow_dots_in_name=True in the setting but no effect.

Similar question posted by someone else, but no reply https://discuss.elastic.co/t/disable-expansion-of-field-names-with-dots-in-mapping/84761

Appreciate if anyone could help.

标签: elasticsearch

解决方案


Elasticsearch 2.4 includes a property where the field names can include a dot. And the field will not get converted to object style mapping.

This setting can be enabled by

export ES_JAVA_OPTS="-Dmapper.allow_dots_in_name=true"

But from 5.x, it is not possible to get a field value with dots without converting it into object mapping. If you index a field like abc.foo.bar (with no explicit mapping). This will get converted to

{
  "mappings": {
    "properties": {
      "abc": {
        "properties": {
          "foo": {
            "properties": {
              "bar": {
                "type": "long"
              }
            }
          }
        }
      }
    }
  }
}

It is best to avoid dots in the field names. You can refer to this documentation, to know more about this


推荐阅读