Skip to content

Add synthetic source support for geo_shape via fallback implementation#108881

Merged
lkts merged 4 commits intoelastic:mainfrom
lkts:feature/synthetic_source_catch_all_stash
May 24, 2024
Merged

Add synthetic source support for geo_shape via fallback implementation#108881
lkts merged 4 commits intoelastic:mainfrom
lkts:feature/synthetic_source_catch_all_stash

Conversation

@lkts
Copy link
Copy Markdown
Contributor

@lkts lkts commented May 21, 2024

This PR enables geo_shape mapper to use fallback synthetic source infrastructure and as such adds synthetic source support for this field type.

Note that geo_shape fields are supported by ESQL but only using source to load data. ESQL will not work for geo_shape fields with synthetic source, tracked by #108883.

@lkts lkts added >feature :StorageEngine/Mapping The storage related side of mappings labels May 21, 2024
@lkts lkts requested review from kkrik-es and martijnvg May 21, 2024 22:13
@lkts lkts requested a review from a team as a code owner May 21, 2024 22:14
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Hi @lkts, I've created a changelog YAML for you.

@Override
protected SyntheticSourceSupport syntheticSourceSupport(boolean ignoreMalformed) {
throw new AssumptionViolatedException("not supported");
// Almost like GeoShapeType but no circles
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we skip circles? Also, shall we use GeoShapeType and skip the unsupported types in the switch?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd still use GeoShapeType and map the behavior for circle to a valid one, e.g. point. That way, this won't get out of sync if another type is added to GeoShapeType. Mostly nit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let me follow-up on that.

index: test
id: "3"
body:
shape: ["POINT (-77.03653 38.897676)", "potato", "POINT (-71.34 41.12)"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add a test were tha point is partially valid, e.g. (-71.34, 1000) ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 (basically a yml test with ignore malformed)

@kkrik-es kkrik-es requested a review from craigtaverner May 22, 2024 06:52
@kkrik-es
Copy link
Copy Markdown
Member

Looks good overall, adding @craigtaverner to double-check the tests.

Copy link
Copy Markdown
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

Left two comments. LGTM otherwise.

}

@Override
protected SyntheticSourceMode syntheticSourceMode() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note that it should be relatively easy to natively support synthetic source for GeoShapeWithDocValuesFieldMapper, because this field mapper can store shapes in an accurate and more efficient format as well. We should then default the store attribute to true, like we did for other field types as well. We can do this in a follow up.

Copy link
Copy Markdown
Contributor Author

@lkts lkts May 23, 2024

Choose a reason for hiding this comment

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

One benefit of current implementation is that it covers ignore_malformed automatically. We'll need to add "custom" support together with such change. I'll create an issue and we can prioritize it based on usage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

restResources {
restApi {
include '_common', 'bulk', 'cluster', 'nodes', 'indices', 'index', 'search'
include '_common', 'bulk', 'cluster', 'get', 'nodes', 'indices', 'index', 'search'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this change needed? The new yaml tests does do get api requests, but that is in a different module then this change is.

index: test
id: "3"
body:
shape: ["POINT (-77.03653 38.897676)", "potato", "POINT (-71.34 41.12)"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 (basically a yml test with ignore malformed)

@lkts
Copy link
Copy Markdown
Contributor Author

lkts commented May 23, 2024

buildkite test this please

@lkts lkts merged commit eea996c into elastic:main May 24, 2024
@lkts lkts deleted the feature/synthetic_source_catch_all_stash branch May 24, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants