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

Deprecate GeoDistance enums and remove geo distance script helpers #19783

Merged
merged 1 commit into from
Aug 6, 2016

Conversation

nknize
Copy link
Contributor

@nknize nknize commented Aug 3, 2016

GeoDistance is implemented using a crazy enum that causes issues with the scripting modules. This PR moves all distance calculations to arcDistance and planeDistance static methods in GeoUtils. It also removes unnecessary distance helper methods from ScriptDocValues.GeoPoints. Docs and tests are updated to reflect changes.

@nknize nknize added :Analytics/Geo Indexing, search aggregations of geo points and shapes :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v5.0.0-alpha5 review labels Aug 3, 2016
*/
@Deprecated
Copy link
Member

Choose a reason for hiding this comment

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

Why are we deprecating and not removing these? We know they don't work in scripts, so what uses could their be other than in our own code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

None. I'll remove the deprecation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Forgot to mention the GeoDistance class is coupled with the GeoDistance query parser. That's why I started w/ deprecation. I plan to completely remove the GeoDistance class but would rather do it in a few small PRs than one large one. Any issue keeping it in this one and I'll remove it in the next PR?

Copy link
Member

Choose a reason for hiding this comment

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

Sure, Ok.

@rjernst
Copy link
Member

rjernst commented Aug 3, 2016

I left a couple comments. This is a good start, but I think we should cut it down further to have one way to calculate distance (GeoUtils methods) and leave edge cases (wanting to convert from meters to something else) as an exercise for the user (finding a constant and multiplying).

@nknize
Copy link
Contributor Author

nknize commented Aug 4, 2016

Thx for the feedback @rjernst. I went ahead and removed the DistanceUnit argument. I'll tackle the enum removal in the next PR and look at removing the GeoPoint allocations in a follow up PR.

@nknize nknize removed the review label Aug 5, 2016
@nknize nknize force-pushed the deprecate/geodistance_enums branch from e67f910 to cbc233d Compare August 5, 2016 23:40
GeoDistance is implemented using a crazy enum that causes issues with the scripting modules. This commit moves all distance calculations to arcDistance and planeDistance static methods in GeoUtils. It also removes unnecessary distance helper methods from ScriptDocValues.GeoPoints.
@nknize nknize force-pushed the deprecate/geodistance_enums branch from cbc233d to 2d590af Compare August 5, 2016 23:42
@nknize nknize merged commit 2d590af into elastic:master Aug 6, 2016
@clintongormley
Copy link

@nknize given that this is a breaking change, please can we have a note in the migration docs?

@nknize
Copy link
Contributor Author

nknize commented Aug 16, 2016

Thx @clintongormley! I updated the migration docs to reflect the breaking change to geo scripts.

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 >breaking :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v5.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants