简体   繁体   English

Elasticsearch geo_point替代映射

[英]Elasticsearch geo_point alternative mapping

Is there an option for mapping of geo_point fields(lat, lon) as a separate fields inside JSON? 是否可以将geo_point字段(纬度,经度)映射为JSON中的单独字段?

My object has to be like this: 我的对象必须是这样的:

{
    "location": {
        "lat":"",
        "lon":""
    }
}

instead of this i want to define my object like below: 而不是我想定义我的对象,如下所示:

{
    "latitude"  :"",
    "longitude" :""
}

When declaring a geo_point you have the choice between a few different formats: 声明geo_point您可以选择几种不同的格式:

Format 1: as an object 格式1:作为对象

"location": {
    "lat":"32.11",
    "lon":"-34.22"
}

Format 2: as a string 格式2:字符串

"location": "32.11,-34.22"

Format 3: as a geohash 格式3:作为geohash

"location": "drm3btev3e86"

Format 4: as an array (beware longitude goes before latitude) 格式4:作为数组(请注意经度先于纬度)

"location": [-34.22, 32.11]

Those are the only four ways to define a geo_point . 这些是定义geo_point的仅有四种方法。 You can see more info in the official documentation 您可以在官方文档中查看更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM