Skip to content

Emit a warning when an unknown geo strategy is passed in #63975

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,14 @@ public void setDistanceErrorPct(double distanceErrorPct) {
public static boolean parse(String name, String fieldName, Object fieldNode, DeprecatedParameters deprecatedParameters) {
if (Names.STRATEGY.match(fieldName, LoggingDeprecationHandler.INSTANCE)) {
checkPrefixTreeSupport(fieldName);
deprecatedParameters.setSpatialStrategy(SpatialStrategy.fromString(fieldNode.toString()));
SpatialStrategy strategy = SpatialStrategy.fromString(fieldNode.toString());
if (strategy == null) {
DEPRECATION_LOGGER.deprecate("geo_mapper_strategy",
"Unknown strategy [" + fieldNode.toString() + "], falling back to [recursive]. " +
"Available strategies are [recursive,term]. In a future release, this fallback " +
"will be removed and an unknown strategy will throw an error");
}
deprecatedParameters.setSpatialStrategy(strategy);
} else if (Names.TREE.match(fieldName, LoggingDeprecationHandler.INSTANCE)) {
checkPrefixTreeSupport(fieldName);
deprecatedParameters.setTree(fieldNode.toString());
Expand Down