Elasticsearch文档映射类型与存储类型不同

时间:2018-10-16 17:35:26

标签: arrays elasticsearch mapping

嗨,我在Elasticsearch 2中有一个索引,其中包含以下属性联系人定义:

...
,
"contacts": {
   "properties": {
        "domains": {
             "type": "string",
              "index": "not_analyzed"
         },
         "emails": {
              "type": "string",
              "index": "not_analyzed"
         },
         "phones": {
              "type": "string",
              "index": "not_analyzed"
         }
    }
},
...

并且正如我所看到的,该联系人属性索引中的数据包含数组,而不是映射所表示的字符串。怎么可能?

    "contacts": {
        "domains": [
            "http://www.xxxxx.sk",
            "http://www.sssss.sk",
            "http://ddddd.sk",
            "http://www.ddddd.sk",
            "http://www.wwwww.sk",
            "http://www.ffffffff.sk"
        ],
        "phones": [
            "123456789",
            "987456321",
            "852147963"
        ],
        "emails": [
            "ccc@cccccc.sk",
            "ggggggg@vggggg.sk",
            "qqqqqqq@qqqqq.sk",
            "sssssssss@sssss.sk",
            "nadacia@volkswagen.sk",
            "vvvvvv@vvvvvvv.sk",
        ]
    },

1 个答案:

答案 0 :(得分:2)

从ES文档中:https://www.elastic.co/guide/en/elasticsearch/reference/current/array.html

  

在Elasticsearch中,没有专用的array类型。任何领域都可以   默认情况下,包含零个或多个值,但是,   数组必须具有相同的数据类型。