Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A change in geo_point parsing in Elasticsearch 1.1.0 leads to a different treatment of input documents without a valid geo_point. My application produced JSON documents containing "location:{}", which is not accepted as a missing value anymore. So in case you also see Exceptions like "MapperParsingException[failed to parse]; nested: Elasticsearc…
curl -XDELETE 'http://localhost:9200/testindex?pretty=true'
curl -XPOST 'http://localhost:9200/testindex?pretty=true' -d '
{
"mappings": {
"testdoc": {
"properties": {
"name": {
"type": "string"
},
"location": {
"type": "geo_point",
"lat_lon": "true"
}
}
}
}
}'
# works
curl -XPUT 'http://localhost:9200/testindex/testdoc/doc1?pretty=true' -d '
{
"location": {
"lat": 52.521927,
"lon": 13.413187
},
"name": "Document 1"
}'
# works
curl -XPUT 'http://localhost:9200/testindex/testdoc/doc2?pretty=true' -d '
{
"name": "Document 2"
}'
# works up to ES 1.0.2, but throws ElasticsearchParseException[field [lat] missing] in ES 1.1.0
curl -XPUT 'http://localhost:9200/testindex/testdoc/doc3?pretty=true' -d '
{
"location": {},
"name": "Document 3"
}'
# works up to ES 1.0.2, but throws ElasticsearchParseException[geo_point expected] in ES 1.1.0
curl -XPUT 'http://localhost:9200/testindex/testdoc/doc4?pretty=true' -d '
{
"location": null,
"name": "Document 4"
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.