Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad geopoint field should throw error #5390

Closed
clintongormley opened this issue Mar 11, 2014 · 3 comments

Comments

@clintongormley
Copy link
Member

commented Mar 11, 2014

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
            }
         ]
      }
   }
}
@s1monw

This comment has been minimized.

Copy link
Contributor

commented Mar 12, 2014

+1 for throwing an error @chilling can you take a look this should be straight forward

@chilling

This comment has been minimized.

Copy link
Contributor

commented Mar 12, 2014

@s1monw @clintongormley I will fix it

@chilling chilling self-assigned this Mar 12, 2014
chilling added a commit to chilling/elasticsearch that referenced this issue Mar 19, 2014
* moved `geo_point` parsing to GeoUtils
* cleaned up `gzipped.json` for bulktest
* merged `GeoPointFieldMapper` and `GeoPoint` parsing methods

Closes elastic#5390
@chilling chilling closed this in 689fd15 Mar 19, 2014
chilling added a commit that referenced this issue Mar 19, 2014
* moved `geo_point` parsing to GeoUtils
* cleaned up `gzipped.json` for bulktest
* merged `GeoPointFieldMapper` and `GeoPoint` parsing methods

Closes #5390
@hkorte

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.