-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
geo_point runtime field implementation #63164
Conversation
Pinging @elastic/es-analytics-geo (:Analytics/Geo) |
Pinging @elastic/es-search (:Search/Search) |
...st/java/org/elasticsearch/xpack/runtimefields/mapper/GeoPointScriptMappedFieldTypeTests.java
Outdated
Show resolved
Hide resolved
@elasticmachine run elasticsearch-ci/packaging-sample-windows |
@elasticmachine run elasticsearch-ci/1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look and it looks pretty reasonable.
...plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/RuntimeFields.java
Outdated
Show resolved
Hide resolved
return new GeoPointScriptFieldGeoShapeQuery(script, leafFactory(context), fieldName, geometries); | ||
} | ||
|
||
private static LatLonGeometry[] toLuceneGeometry(String name, QueryShardContext context, Geometry geometry) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something we can move into core? It looks like something we'd have there already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats is my plan but it seems more difficult that it looks at first sight as every time we need to map a geometry to a Lucene geometry, it seems to be slightly different. As part of that effort I opened https://issues.apache.org/jira/browse/LUCENE-9552 but I didn't have much support so far. I try to move it.
@@ -67,6 +67,14 @@ protected static QueryShardContext mockContext(boolean allowExpensiveQueries) { | |||
return mockContext(allowExpensiveQueries, null); | |||
} | |||
|
|||
protected boolean supportsTermQueries() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it'd be better to make a new superclass that doesn't have these methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that we already have AbstractNonTextScriptFieldTypeTestCase
that extends this class. Those methods are worthy running so adding a superclass you will miss that. My feeling is that we need an abstract class for every type of query and field types will implement all the ones they support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So instead of an abstract superclass for the type of field it is per query? I could see that being better, maybe. I'm ok with this as is if we plan to refactor it soon enough anyway.
@elasticmachine run elasticsearch-ci/packaging-sample-windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks entirely sensible to me.
x-pack/plugin/src/test/resources/rest-api-spec/test/runtime_fields/100_geo_point.yml
Outdated
Show resolved
Hide resolved
Moved the PR to ready for review (although thanks Nik, you've done all the work already). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with it! I feel like I should find something worth changing because runtime fields are new and we don't have super established patterns, but I think this is the right things to do.
Run time field that emits geo points from lat/lon values.
Run time field that emits geo points from lat/lon values.
Run time field that emits geo points from lat/lon values. For example, given a mapping like:
A geo_point runtime field can be declared as:
where the emit function takes two arguments, the first argument is the latitude and the second argument the longitude.