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

Add new point field. #53804

Merged
merged 14 commits into from
Apr 7, 2020
Merged

Add new point field. #53804

merged 14 commits into from
Apr 7, 2020

Conversation

iverase
Copy link
Contributor

@iverase iverase commented Mar 19, 2020

This commit adds a new point field that is able to index arbitrary pair of values (x/y) in the cartesian space. It only supports filtering using shape queries at the moment.

@iverase iverase added >feature :Analytics/Geo Indexing, search aggregations of geo points and shapes v8.0.0 labels Mar 19, 2020
@iverase iverase requested a review from nknize March 19, 2020 14:54
@elasticmachine
Copy link
Collaborator

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

@iverase
Copy link
Contributor Author

iverase commented Mar 19, 2020

@elasticmachine test this please

Copy link
Contributor

@nknize nknize left a comment

Choose a reason for hiding this comment

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

In general I'm good with this as a starting point. I think we should remove doc value support for now and add in a followup PR where we can have a dedicated ValuesSourceType.POINT in the spatial xpack plugin.

return builder.startObject().field("x", x).field("y", y).endObject();
}

public static CartesianPoint parsePoint(XContentParser parser, CartesianPoint point)
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is largely a mirror of GeoPoint but I'm wondering if we can achieve this using ObjectParser or ConstructingObjectParser? (something we've been meaning to address w/ GeoPoint as well). I'm not sure how that works with the parsing leniency we have on Point and GeoPoint (e.g., array vs comma delimited string). Curious if @nik9000 or @talevy have some ideas. Maybe that can be done in a followup PR.

if (fieldType().stored()) {
context.doc().add(new StoredField(fieldType().name(), point.toString()));
}
if (fieldType.hasDocValues()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The more I think about this the more I think it's best we disable doc values for this PR and give it some more thought in a future PR. That's fine considering we weren't planning to add cartesian aggregation support until a future version anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason I added doc values was to be able to execute IndexOrDocValuesQueries. This doc values are generated at Lucene level and my feeling is that it should not be a problem for backwards compatibility as they are already part of Lucene distribution.

@nknize
Copy link
Contributor

nknize commented Mar 24, 2020

I know we were originally planning to have this in time for 7.7 feature freeze. But given that it's a highly visible (and extremely useful) feature I'd rather it slide to 7.8 and make sure we've thought through the doc values than risk rushing it and having to support bwc.

Copy link
Contributor

@nknize nknize left a comment

Choose a reason for hiding this comment

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

LGTM thx @iverase.

@iverase iverase merged commit 6182db5 into elastic:master Apr 7, 2020
@iverase iverase added the v7.8.0 label Apr 7, 2020
iverase added a commit that referenced this pull request Apr 7, 2020
This commit adds a new point field that is able to index arbitrary pair of values (x/y)
in the cartesian space. It only supports filtering using shape queries at the moment.
try {
CartesianPoint.assertZValue(ignoreZValue, Float.parseFloat(vals[2].trim()));
} catch (NumberFormatException ex) {
throw new ElasticsearchParseException("[{}]] must be a number", Y_FIELD.getPreferredName());
Copy link
Contributor

Choose a reason for hiding this comment

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

@iverase, Y_FIELD.getPreferredName() should be Z_FIELD.getPreferredName()?

russcam added a commit to elastic/elasticsearch-net that referenced this pull request Jun 4, 2020
Relates: #4718, elastic/elasticsearch#53804

This commit adds a Point property to map the new point data type.
A CartesianPoint type is introduced to model points.
@iverase iverase deleted the pointField branch July 9, 2020 10:03
russcam added a commit to elastic/elasticsearch-net that referenced this pull request Sep 4, 2020
Relates: #4718, elastic/elasticsearch#53804

This commit adds a Point property to map the new point data type.
A CartesianPoint type is introduced to model points.
russcam added a commit to elastic/elasticsearch-net that referenced this pull request Sep 15, 2020
Relates: #4718, elastic/elasticsearch#53804

This commit adds a Point property to map the new point data type.
A CartesianPoint type is introduced to model points.
russcam added a commit to elastic/elasticsearch-net that referenced this pull request Sep 18, 2020
Relates: #4718, elastic/elasticsearch#53804

This commit adds a Point property to map the new point data type.
A CartesianPoint type is introduced to model points.
russcam added a commit to elastic/elasticsearch-net that referenced this pull request Sep 18, 2020
Relates: #4718, elastic/elasticsearch#53804

This commit adds a Point property to map the new point data type.
A CartesianPoint type is introduced to model points.
github-actions bot pushed a commit to elastic/elasticsearch-net that referenced this pull request Sep 18, 2020
Relates: #4718, elastic/elasticsearch#53804

This commit adds a Point property to map the new point data type.
A CartesianPoint type is introduced to model points.
russcam added a commit to elastic/elasticsearch-net that referenced this pull request Sep 20, 2020
Relates: #4718, elastic/elasticsearch#53804

This commit adds a Point property to map the new point data type.
A CartesianPoint type is introduced to model points.

Co-authored-by: Russ Cam <[email protected]>
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 >feature v7.8.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants