June 2017
Beginner to intermediate
404 pages
8h 22m
English
We can set the geo-point data mapping for the geo_location field, as shown next:
PUT chapter3/_mapping/address { "properties": { "geo_location": { "type": "geo_point" } } }
In the following example, we will index an address document with geolocation:
PUT chapter3/address/1 { "street": "123 High Lane", "city": "Big City", "geo_location": { "lat": 37.3, "lon": 121.8 } }
Please make sure the mapping type for geo_location is set before you index the address document otherwise the geo_location field will be stored as an object with lat and lon as strings. If all goes well, you should see a response as follows:
{ "_index": "chapter3", "_type": "address", "_id": "1", "_version": 1, "result": "created", "_shards": { "total": ...Read now
Unlock full access