If a badly formatted object is passed to a geopoint when indexing a doc, it should throw an error. Instead, any fields after the bad geopoint are just ignored:
PUT /test
{
"mappings": {
"foo": {
"properties": {
"loc": {
"type": "geo_point"
}
}
}
}
}
PUT /test/foo/1
{
"loc": { "lat": 0, "lon": 0 },
"tag": "ok"
}
PUT /test/foo/2
{
"loc": {
"loc": {
"lat": 0,
"lon": 0
}
},
"tag": "not_ok"
}
GET /test/_search?search_type=count
{
"facets": {
"tags": {
"terms": {
"field": "tag"
}
}
}
}
Result:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 0,
"hits": []
},
"facets": {
"tags": {
"_type": "terms",
"missing": 1,
"total": 1,
"other": 0,
"terms": [
{
"term": "ok",
"count": 1
}
]
}
}
}
+1 for throwing an error @chilling can you take a look this should be straight forward
@s1monw @clintongormley I will fix it
Just in case somebody googles the corresponding exceptions. If you try to index a document containing incomplete or other invalid geo_point fields in Elasticsearch 1.1.0 and you get exceptions like "MapperParsingException[failed to parse]; nested: ElasticsearchParseException[field [lat] missing];" or "MapperParsingException[failed to parse]; nested: ElasticsearchParseException[geo_point expected];", the solution is to skip the whole geo_point field. See this gist: https://gist.github.com/hkorte/9936192
Most helpful comment
Just in case somebody googles the corresponding exceptions. If you try to index a document containing incomplete or other invalid geo_point fields in Elasticsearch 1.1.0 and you get exceptions like "MapperParsingException[failed to parse]; nested: ElasticsearchParseException[field [lat] missing];" or "MapperParsingException[failed to parse]; nested: ElasticsearchParseException[geo_point expected];", the solution is to skip the whole geo_point field. See this gist: https://gist.github.com/hkorte/9936192