弹性搜索:地理点字段的动态模板映射

时间:2016-11-29 00:38:46

标签: string templates elasticsearch mapping geopoints

地理点的动态映射是否仍在Elastic Search 2.x / 5.x中运行?

这是模板:

{
        "template": "*",
        "mappings": {
            "_default_": {
                "dynamic_templates": [
                    {
                        "geo_point_type": {
                            "match_mapping_type": "string",
                            "match": "t_gp_*",
                            "mapping": {
                                "type": "geo_point"
                            }
                        }
                    }
                ]
            }
        }
    }

这是我查询字段时遇到的错误:

"reason": "failed to parse [geo_bbox] query. field [t_gp_lat-long@en] is expected to be of type [geo_point], but is of [string] type instead"

我似乎记得我在文档中看到某些内容并不起作用,但我认为只有在根本没有动态模板时才会这样做。

有什么想法吗?

更新1

这是文档的一个示例。实际文件非常大,所以我选了它唯一相关的部分。

{
    "_index": "route",
    "_type": "route",
    "_id": "583a014edd76239997fca5e4",
    "_score": 1,
    "_source": {
        "t_b_highway@en": false,
        "t_n_number-of-floors@en": 33,
        "updatedBy@_id": "58059fe368d0a739916f0888",
        "updatedOn": 1480196430596,
        "t_n_ceiling-height@en": 2.75,
        "t_gp_lat-long@en": "13.736248,100.5604997"
    }
}

数据对我来说是正确的,因为你也可以使用lat / long字符串索引Geo Point字段。

更新2

映射绝对是错误的。这就是为什么我想知道你是否可以动态映射Geo Point字段。

"t_gp_lat-long@en": {
    "type": "string",
    "fields": {
        "english": {
            "type": "string",
            "analyzer": "english"
        },
        "raw": {
            "type": "string",
            "index": "not_analyzed",
            "ignore_above": 256
        }
    }
},

0 个答案:

没有答案
相关问题