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

Alias field does not work with geo_shape query #74895

Merged
merged 1 commit into from
Jul 8, 2021

Conversation

iverase
Copy link
Contributor

@iverase iverase commented Jul 5, 2021

When using an alias field on a geo_shape query, the final field name is not resolve properly. This PR fixes it by using the field type name when calling geoShapeQuery. Note that this still works if the geo_shape field is using legacy parameters.

In addition, this PR is refactoring further the GeoShape query Test in order to separate the test that goes to the legacy implementation.

@iverase iverase added >bug :Analytics/Geo Indexing, search aggregations of geo points and shapes v8.0.0 v7.15.0 labels Jul 5, 2021
@iverase iverase requested a review from imotov July 5, 2021 08:08
@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jul 5, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

Copy link
Contributor

@imotov imotov left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -160,7 +160,7 @@ public Query buildShapeQuery(SearchExecutionContext context, MappedFieldType fie
"Field [" + fieldName + "] is of unsupported type [" + fieldType.typeName() + "] for [" + NAME + "] query");
}
final GeoShapeQueryable ft = (GeoShapeQueryable) fieldType;
return new ConstantScoreQuery(ft.geoShapeQuery(shape, fieldName, strategy, relation, context));
return new ConstantScoreQuery(ft.geoShapeQuery(shape, fieldType.name(), strategy, relation, context));
Copy link
Contributor

Choose a reason for hiding this comment

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

good one :)

@iverase iverase merged commit ebe8a9b into elastic:master Jul 8, 2021
@iverase iverase deleted the aliasFieldBug branch July 8, 2021 05:19
iverase added a commit that referenced this pull request Jul 8, 2021
Fixes the resolution of the field name in the geo_shape query.
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 >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v7.15.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants