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

Refactor geo_point validate* and normalize* for 2.x #12742

Merged
merged 1 commit into from Aug 17, 2015

Conversation

Projects
None yet
4 participants
@nknize
Member

nknize commented Aug 8, 2015

This PR refactors the old validate and normalize options for geo_point field type to ignore_malformed and coerce, respectively. Geo queries are also updated to ignore_malformed GeoPoints. This PR is for 2.0 only since mapping implementation has drastically changed from 1.x. For 1.7 changes see PR #12300

closes #10170

@colings86

This comment has been minimized.

Show comment
Hide comment
@colings86

colings86 Aug 10, 2015

Member

I like this change but it does mean that the meaning of coerce here would be subtly different from the meaning in other types. For example if I have an integer field and I set coerce: false and then try to index a document where the value of that field is "200" then it will produce and error (if ignore_malformed is also false). with this change (if I am reading correctly), a geo_point field with coerce: false (and ignore_malformed: false) will not error if I insert a geo_point [480.5, 160.9] but will index the geo_point with the un-normalised lat and long values.

Member

colings86 commented Aug 10, 2015

I like this change but it does mean that the meaning of coerce here would be subtly different from the meaning in other types. For example if I have an integer field and I set coerce: false and then try to index a document where the value of that field is "200" then it will produce and error (if ignore_malformed is also false). with this change (if I am reading correctly), a geo_point field with coerce: false (and ignore_malformed: false) will not error if I insert a geo_point [480.5, 160.9] but will index the geo_point with the un-normalised lat and long values.

@nknize

This comment has been minimized.

Show comment
Hide comment
@nknize

nknize Aug 10, 2015

Member

@colings86 The same applies. (e.g., see GeoPointFieldMapperTests.testValidateLatLonValues) If you set ignore_malformed: false and coerce: false and insert a malformed geo_point (e.g., coordinate [1.3, -91]) the parser will throw an Exception.

Member

nknize commented Aug 10, 2015

@colings86 The same applies. (e.g., see GeoPointFieldMapperTests.testValidateLatLonValues) If you set ignore_malformed: false and coerce: false and insert a malformed geo_point (e.g., coordinate [1.3, -91]) the parser will throw an Exception.

@colings86

This comment has been minimized.

Show comment
Hide comment
@colings86

colings86 Aug 10, 2015

Member

oh ok, great. Thanks for clarifying :)

Member

colings86 commented Aug 10, 2015

oh ok, great. Thanks for clarifying :)

@nknize nknize changed the title from Refactor geo_point validate* and normalize* to Refactor geo_point validate* and normalize* for 2.x Aug 10, 2015

@rjernst

View changes

Show outdated Hide outdated ...rc/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapper.java
@rjernst

View changes

Show outdated Hide outdated ...rc/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapper.java
@rjernst

View changes

Show outdated Hide outdated ...c/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryParser.java
@rjernst

View changes

Show outdated Hide outdated ...rc/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapper.java
@rjernst

View changes

Show outdated Hide outdated ...rc/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapper.java
@rjernst

View changes

Show outdated Hide outdated ...rc/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapper.java
@rjernst

View changes

Show outdated Hide outdated ...rc/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapper.java
@rjernst

View changes

Show outdated Hide outdated ...rc/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapper.java
@rjernst

View changes

Show outdated Hide outdated ...st/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperTests.java
@rjernst

This comment has been minimized.

Show comment
Hide comment
@rjernst

rjernst Aug 13, 2015

Member

@nknize I left a couple more comments. Mappings look good, I think we should add some more tests.

Member

rjernst commented Aug 13, 2015

@nknize I left a couple more comments. Mappings look good, I think we should add some more tests.

@rjernst

View changes

Show outdated Hide outdated ...rc/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapper.java
@rjernst

View changes

Show outdated Hide outdated ...st/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperTests.java
@rjernst

View changes

Show outdated Hide outdated ...st/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperTests.java
@rjernst

View changes

Show outdated Hide outdated ...st/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperTests.java
@rjernst

This comment has been minimized.

Show comment
Hide comment
@rjernst

rjernst Aug 14, 2015

Member

This looks great. I left couple more comments about the tests to make sure we have real backcompat checks there.

Member

rjernst commented Aug 14, 2015

This looks great. I left couple more comments about the tests to make sure we have real backcompat checks there.

@nknize

This comment has been minimized.

Show comment
Hide comment
@nknize

nknize Aug 14, 2015

Member

Thanks for the review @rjernst! Updated bwc testing and other minor edits from the comments.

Member

nknize commented Aug 14, 2015

Thanks for the review @rjernst! Updated bwc testing and other minor edits from the comments.

@rjernst

This comment has been minimized.

Show comment
Hide comment
@rjernst

rjernst Aug 14, 2015

Member

LGTM, 1 more minor suggestion for the tests.

Member

rjernst commented Aug 14, 2015

LGTM, 1 more minor suggestion for the tests.

@clintongormley clintongormley added v2.0.0 and removed v2.0.0-beta2 labels Aug 16, 2015

Refactor geo_point validate* and normalize* options to ignore_malform…
…ed and coerce*

For consistency geo_point mapper's validate and normalize options are converted to ignore_malformed and coerced

@nknize nknize merged commit b2ba384 into elastic:master Aug 17, 2015

1 check passed

CLA Commit author is a member of Elasticsearch
Details

@clintongormley clintongormley added v2.1.0 and removed v2.0.0 labels Aug 18, 2015

@nknize nknize deleted the nknize:deprecation/10170_2.0 branch May 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment