Skip to content

Instantly share code, notes, and snippets.

@tstibbs
Created May 13, 2014 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tstibbs/1c337313115de57a7229 to your computer and use it in GitHub Desktop.
Save tstibbs/1c337313115de57a7229 to your computer and use it in GitHub Desktop.
Geo and Date fields return different values if fetched from stored value or _source
curl -XPUT "http://localhost:9200/test" -d '
{
"mappings": {
"document": {
"properties": {
"date": {
"type": "date",
"store": "true"
},
"date2": {
"type": "date",
"format": "dd-MM-yyyy",
"store": "true"
},
"location_double": {
"type": "geo_point",
"store": "true"
},
"location_string": {
"type": "geo_point",
"store": "true"
},
"location_hash": {
"type": "geo_point",
"store": "true"
},
"location_geojson": {
"type": "geo_point",
"store": "true"
}
}
}
}
}
'
curl -XPUT "http://localhost:9200/test/document/1" -d '
{
"date": "2011-12-31",
"date2": "31-12-2011",
"location_double": {
"lat": 41.12,
"lon": -71.34
},
"location_string": "41.12,-71.34",
"location_hash": "drm3btev3e86",
"location_geojson": [
-71.34,
41.12
]
}
'
curl -XPOST "http://localhost:9200/test/document/_search" -d '
{
"fields": [
"*",
"_source"
]
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment