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

Enforce synthetic source for time series indices #93380

Merged
merged 16 commits into from
Feb 2, 2023

Conversation

martijnvg
Copy link
Member

@martijnvg martijnvg commented Jan 31, 2023

Synthetic source is the only allowed source mode with tsdb.

Closes #92319

This field can be used as dimension and metric in tsdb
and now that synthetic source is always enabled, it needs
to support synthetic source too.
First validate index mode than source mode.
@@ -148,94 +148,3 @@ clone:

- match: {hits.total.value: 1}
- match: {hits.hits.0.fields._tsid: [{k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507, metricset: pod}]}

---
clone no source index:
Copy link
Member Author

Choose a reason for hiding this comment

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

Tsdb indices only support source mode synthetic now.

@@ -93,13 +93,12 @@ public void validate(IndexSettings settings, boolean checkLimits) {
}
}

settings.getMode().validateMapping(mappingLookup);
Copy link
Member Author

Choose a reason for hiding this comment

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

Validate index more before loading/validating source mode/loader.

The nested fields yaml tests validate the time series index mode doesn't support nested field type.
But without this the error returned is that synthetic source doesn't support nested field type.

The test can be adjusted, but logically it makes more sense to me that index mode reports the error than source mode, so that is why I moved settings.getMode().validateMapping(mappingLookup); before sourceMapper().newSourceLoader(mapping());.


@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
if (hasDocValues == false) {
Copy link
Member Author

Choose a reason for hiding this comment

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

The unsigned_long field type can be used a dimension / metric in tsdb indices.
Adding synthetic source support for this, since that is the only supported source mode for tsdb indices.

Copy link
Member

Choose a reason for hiding this comment

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

👍 I imagine there are a bunch of tests that need poking for this.

return DEFAULT;
return indexMode == IndexMode.TIME_SERIES ? TSDB_DEFAULT : DEFAULT;
}
if (indexMode == IndexMode.TIME_SERIES) {
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to have a method on IndexMode that does this stuff if possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

Turns out that the usage of include and exclude in combination with synthetic source is already not allowed by validation in SourceFieldMapper's constructor.

I'll just validate that here that synthetic source is enabled.


@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
if (hasDocValues == false) {
Copy link
Member

Choose a reason for hiding this comment

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

👍 I imagine there are a bunch of tests that need poking for this.

@martijnvg martijnvg added :StorageEngine/TSDB You know, for Metrics >non-issue labels Feb 1, 2023
@martijnvg martijnvg marked this pull request as ready for review February 1, 2023 20:56
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Feb 1, 2023
@elasticsearchmachine
Copy link
Collaborator

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

mark-vieira pushed a commit to mark-vieira/elasticsearch that referenced this pull request Feb 2, 2023
Support for synthetic source is also added to `unsigned_long` field as part of this change.
This is required because `unsigned_long` field types can be used in tsdb indices and
this change would prohibit the usage of these field type otherwise.

Closes elastic#92319
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :StorageEngine/TSDB You know, for Metrics Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable synthetic source by default if index.mode=time_series
3 participants