Skip to content

Instantly share code, notes, and snippets.

@sourcec0de
Last active September 13, 2018 13:44
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sourcec0de/5673720 to your computer and use it in GitHub Desktop.
Save sourcec0de/5673720 to your computer and use it in GitHub Desktop.
Elastic Search geo_point Mapping Example. Geo_Point has been mapped to venue.location.coords
{
"settings": {
"number_of_shards": 1,
"mapper": {
"dynamic": false
}
},
"mappings": {
"venue": {
"properties": {
"contact": {
"dynamic": "true",
"properties": {
"facebook": {
"type": "string"
},
"formattedPhone": {
"type": "string"
},
"phone": {
"type": "string"
},
"twitter": {
"type": "string"
}
}
},
"location": {
"properties": {
"address": {
"type": "string"
},
"cc": {
"type": "string"
},
"city": {
"type": "string"
},
"coords": {
"type":"geo_point"
},
"country": {
"type": "string"
},
"crossStreet": {
"type": "string"
},
"distance": {
"type": "long"
},
"postalCode": {
"type": "string"
},
"state": {
"type": "string"
}
}
},
"name": {
"type": "string"
},
"nix_brand_id": {
"type": "string"
}
}
}
}
}
{
"_id": "4b29b04ef964a5208ba224e3",
"name": "Taco Del Mar",
"contact": {
"formattedPhone": "(503) 390-1267",
"phone": "5033901267"
},
"location": {
"cc": "US",
"country": "United States",
"state": "OR",
"city": "Keizer",
"postalCode": "97303",
"crossStreet": "in Keizer Station",
"address": "6379 Ulali Dr NE",
"coords": {
"lat": 45.0112511097505,
"lon": -122.9980246311445
}
},
"nix_brand_id": "513fbc1283aa2dc80c0000ca"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment