Skip to content

Conversation

@nknize
Copy link
Contributor

@nknize 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

@nknize nknize added :Analytics/Geo Indexing, search aggregations of geo points and shapes v2.1.0 labels Aug 8, 2015
@colings86
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor

oh ok, great. Thanks for clarifying :)

@nknize nknize changed the title Refactor geo_point validate* and normalize* Refactor geo_point validate* and normalize* for 2.x Aug 10, 2015
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this bwc member. It is non-descript, and requires jumping to where it is set to figure out under what version this setting is no longer allowed. I think we should put the version check with the setting parsing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also just name it, as a local, so that the name implies what version is being checked for, but I would personally just put the version check directly here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually now that I see the rest of how this works, I think we should just be checking version here, and set the equivalent setting using ignoreMalformed/coerce. You can also add the version check into the conditional next to the name check, and let it fall through on newer indexes (this will cause an unknown setting exception). All of the old names can then be removed from the fieldtype/builder/mapper.

@nknize nknize force-pushed the deprecation/10170_2.0 branch from d8055d8 to 6df27a5 Compare August 13, 2015 19:04
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to make this needs to be change, it can't be beta1 anymore?

@rjernst
Copy link
Member

rjernst commented Aug 13, 2015

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the name a little confusing, since we already have this exact same name in FieldMapper, and it means before beta1. A better name would be good...I don't have a suggestion though...

@rjernst
Copy link
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
Copy link
Contributor Author

nknize commented Aug 14, 2015

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

@rjernst
Copy link
Member

rjernst commented Aug 14, 2015

LGTM, 1 more minor suggestion for the tests.

@nknize nknize force-pushed the deprecation/10170_2.0 branch from 596592b to 5db4a93 Compare August 14, 2015 21:41
@nknize nknize force-pushed the deprecation/10170_2.0 branch 3 times, most recently from 5fb3b8d to c490170 Compare August 17, 2015 19:42
…ed and coerce*

For consistency geo_point mapper's validate and normalize options are converted to ignore_malformed and coerced
@nknize nknize force-pushed the deprecation/10170_2.0 branch from c490170 to b2ba384 Compare August 17, 2015 19:46
@nknize nknize merged commit b2ba384 into elastic:master Aug 17, 2015
@nknize nknize deleted the deprecation/10170_2.0 branch May 27, 2016 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/Geo Indexing, search aggregations of geo points and shapes >enhancement v2.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GEO] Deprecate 'validate_*' options in GeoPointMapping

4 participants