简体   繁体   中英

Elasticsearch geo_point alternative mapping

Is there an option for mapping of geo_point fields(lat, lon) as a separate fields inside 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:

Format 1: as an object

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

Format 2: as a string

"location": "32.11,-34.22"

Format 3: as a geohash

"location": "drm3btev3e86"

Format 4: as an array (beware longitude goes before latitude)

"location": [-34.22, 32.11]

Those are the only four ways to define a geo_point . You can see more info in the official documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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