Created
April 2, 2014 15:13
-
-
Save hkorte/9936192 to your computer and use it in GitHub Desktop.
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…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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