Skip to content

Enable synthetic_id by default under feature flag#144026

Merged
burqen merged 24 commits intoelastic:mainfrom
burqen:ap/2026.03.11.synthetic-id-enable-by-default-behind-ff
Mar 19, 2026
Merged

Enable synthetic_id by default under feature flag#144026
burqen merged 24 commits intoelastic:mainfrom
burqen:ap/2026.03.11.synthetic-id-enable-by-default-behind-ff

Conversation

@burqen
Copy link
Copy Markdown
Contributor

@burqen burqen commented Mar 11, 2026

Newly created time_series indices use synthetic id by default.

The new IndexVersion, TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT, prevent old indices (with older index version) from changing default behavior.

index.mapping.synthetic_id defaults to true if

  • Feature flag TSDB_SYNTHETIC_ID_FEATURE_FLAG is enabled
  • index mode is time_series
  • index version is TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT or later
  • codec is default or unset

The synthetic id setting is still allowed to be explicitly set if index version is TIME_SERIES_USE_SYNTHETIC_ID_94 or later. The new index version, TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT, only controls the default behavior.

This logic for if synthetic id should be used or not is duplicated from IndexSettings to IndexMetadata to make sure metadata always agree with settings.

IndexSettings.MODE is moved above SYNTHETIC_ID to allow access.

Relates ES-14156

Newly created time_series indices use synthetic id by default.

The new IndexVersion, TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT,  prevent old indices
(with older index version) from changing default behavior.

`index.mapping.synthetic_id` defaults to true if
- Feature flag TSDB_SYNTHETIC_ID_FEATURE_FLAG is enabled
- index mode is time_series
- index version is TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT or later
- codec is default or unset

and setting is still allowed to be explicitly set if index version
is TIME_SERIES_USE_SYNTHETIC_ID_94 or later. Only the default behavior
is controlled by TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT.

This default logic is duplicated by IndexMetadata to make sure metadata always
agree with Settings.

MODE setting moved above SYNTHETIC_ID to allow access.
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

/**
* The {@link IndexMode "mode"} of the index.
*/
public static final Setting<IndexMode> MODE = Setting.enumSetting(
Copy link
Copy Markdown
Contributor Author

@burqen burqen Mar 11, 2026

Choose a reason for hiding this comment

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

Needed to move this to have access in SYNTHETIC_ID, but the code is unchanged

Copy link
Copy Markdown
Contributor

@fcofdez fcofdez left a comment

Choose a reason for hiding this comment

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

Looks good! I think that you're right regarding the node feature, but maybe for safety we might want to bump that too?

@burqen
Copy link
Copy Markdown
Contributor Author

burqen commented Mar 12, 2026

Looks good! I think that you're right regarding the node feature, but maybe for safety we might want to bump that too?

Yeah, it will be difficult to introduce it retrospectively. We can't remove the existing one (it will prevent clusters from forming), but I'll add a new one in this PR.

burqen added 4 commits March 12, 2026 10:59
Making sure to add this node feature in the same PR as adding the new
index version, `TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT` to make sure the
node feature can be used as a shortcut / replacement for checking
version in tests.
The compat tests run with a copy of the yaml file from the BWC branch,
which doesn't contain the skip for index.time_series_synthetic_id.

This means the hardcoded ids in the test doesn't match with actual
default behavior anymore, so we skip those tests in the compatibility
run.

This is safe because the behavior is not changed for existing indices
that don't use synthetic id. Only new indices will have the changed
behavior, so there is no compatibility issue.

To make this work we nedd to make it possible to skip compatibility
tests with overloaded names.

If the name of the test is also a name of an operation such as `get` or
`delete` in below examples, then the build would fail with

```
Execution failed for task ':rest-api-spec:yamlRestCompatTestTransform'.
> class com.fasterxml.jackson.databind.node.ObjectNode cannot be cast to
 class com.fasterxml.jackson.databind.node.ArrayNode
```

Instead of throwing an (assert) exception if the node to transform
(skip) is of the wrong type, we now just ignore it instead.

Example of test that could not be skipped before, but that can be
skipped now:
```
get:
  - do:
      get:
        index:   id_generation_test
        id:      cZZNs7B9sSWsyrL5AAABeRnSA5M
```

Written together with Cursor
This is an attempt at avoiding this failure:
```
TSDBSyntheticIdsIT > testDefaultSetting FAILED
java.lang.AssertionError: searcher was not warmed up yet for
source[assert_no_id_stored_field]
```

If replica hasn't caught up to primary before calling flushAndRefresh
the replica would not be refreshed and isWarmedUp would not be set in
InternalEngine.ExternalReaderManager.refreshIfNeeded. By calling
ensureGreen we make sure that replicate has caught up and that searcher
will be warmed up.
@burqen burqen requested a review from a team as a code owner March 12, 2026 13:08
@fcofdez
Copy link
Copy Markdown
Contributor

fcofdez commented Mar 12, 2026

@elasticmachine update branch

@burqen
Copy link
Copy Markdown
Contributor Author

burqen commented Mar 13, 2026

Another green run ✅ Triggering a third one

"Malformed values are now stored in binary doc values which sort differently than stored fields"
)
task.skipTest("delete/70_tsdb/basic tsdb delete", "ids have changed after introduction of synthetic id")
task.skipTest("tsdb/25_id_generation/routing_path matches object", "ids have changed after introduction of synthetic id")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can't we set the setting to false in this test suite?

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.

This is only for the compatibility tests. They copy the old yaml file from the bwc branch and updating all of those is not worth it IMO.

@burqen
Copy link
Copy Markdown
Contributor Author

burqen commented Mar 13, 2026

Upgrade test failing to build buildBwcLinuxTar. Unrelated, retriggering the failing upgrade build step.

* What went wrong:
--
Execution failed for task ':distribution:bwc:main:buildBwcLinuxTar'.
> Process './gradlew [-g, /opt/buildkite-agent/.gradle-main, -Dorg.elasticsearch.build.cache.url=https://gradle-enterprise.elastic.co/cache/, -Dscan.tag.NESTED, -Dbuild.snapshot=true, --full-stacktrace, --parallel, -p, distribution/archives/linux-tar, extractedAssemble, --build-cache]' finished with non-zero exit value 1

Copy link
Copy Markdown
Contributor

@fcofdez fcofdez left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@fcofdez fcofdez requested a review from martijnvg March 13, 2026 11:39
@fcofdez fcofdez requested a review from kkrik-es March 13, 2026 11:39
@fcofdez fcofdez added the test-release Trigger CI checks against release build label Mar 13, 2026
@burqen burqen requested a review from mosche March 13, 2026 13:41
@burqen
Copy link
Copy Markdown
Contributor Author

burqen commented Mar 13, 2026

Hi @mosche 👋 I see your name in the git blame of org.elasticsearch.gradle.internal.test.rest.transform.skip.Skip. We could use your eyes on 8358b29 that makes task.skipTest a bit more lenient. Feel free to forward this request to someone more fitting if needed. The commit description has, well... a description.

@mosche
Copy link
Copy Markdown
Contributor

mosche commented Mar 13, 2026

@elastic/es-delivery is probably more knowledgable on the these build tools

@burqen
Copy link
Copy Markdown
Contributor Author

burqen commented Mar 13, 2026

The test failures from the last run doesn't look relevant, but will trigger a new one.

Test / area Cause
MixedClusterDownsampleRestIT – Downsample index k8s.pod.multi-counter field null.
ESQL VerifierTests Parser: “no viable alternative at input 'BY'”; tests expect different exception/behavior.
XPackRestIT – ESQL usage (telemetry) × 2 esql.features length 37 vs expected 35; esql.functions.json_extract present but should be absent.

Copy link
Copy Markdown
Contributor

@jozala jozala left a comment

Choose a reason for hiding this comment

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

I've reviewed the change in the Skip.java file and it looks like a good improvement.
I've left one minor comment.

@burqen
Copy link
Copy Markdown
Contributor Author

burqen commented Mar 16, 2026

Last test failures:

org.elasticsearch.xpack.test.rest.XPackRestIT.test {p0=esql/60_usage/Basic ESQL usage output (telemetry) non-snapshot version} fails with unrelated failure. Fixed here: #144332

org.elasticsearch.xpack.esql.analysis.AnalyzerUnmappedGoldenTests.testSubqueryKeepUnmapped Fixed here: #144334

@burqen
Copy link
Copy Markdown
Contributor Author

burqen commented Mar 17, 2026

Latest test failures are a lot around ESQL:

:x-pack:plugin:esql:internalClusterTest
org.elasticsearch.xpack.esql.CsvIT
Caused by: java.lang.IllegalStateException: failed to find action [indices:admin/esql/view/put] to execute
org.elasticsearch.xpack.esql.action.EsqlReductionLateMaterializationSingleNodeIT
org.elasticsearch.xpack.esql.action.EsqlReductionLateMaterializationMultiNodeIT
org.elasticsearch.action.ActionRequestValidationException: Validation Failed: 1: [pragma] only allowed in snapshot builds;
org.elasticsearch.xpack.esql.action.CrossClusterViewIT
java.lang.IllegalStateException: failed to find action [indices:admin/esql/view/put] to execute
org.elasticsearch.xpack.esql.action.ResolveIndexActionIT
java.lang.IllegalStateException: failed to find action [indices:admin/esql/view/put] to execute

Trigger another build.

@burqen burqen removed the test-release Trigger CI checks against release build label Mar 17, 2026
@burqen
Copy link
Copy Markdown
Contributor Author

burqen commented Mar 19, 2026

Latest test failures

As theses two failures are known issues and unrelated to the enabling of synthetic_id.

@burqen burqen merged commit b636be3 into elastic:main Mar 19, 2026
36 checks passed
ncordon pushed a commit to ncordon/elasticsearch that referenced this pull request Mar 20, 2026
* Enable synthetic_id by default if settings are valid

Newly created time_series indices use synthetic id by default.

The new IndexVersion, TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT,  prevent old indices
(with older index version) from changing default behavior.

`index.mapping.synthetic_id` defaults to true if
- Feature flag TSDB_SYNTHETIC_ID_FEATURE_FLAG is enabled
- index mode is time_series
- index version is TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT or later
- codec is default or unset

and setting is still allowed to be explicitly set if index version
is TIME_SERIES_USE_SYNTHETIC_ID_94 or later. Only the default behavior
is controlled by TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT.

This default logic is duplicated by IndexMetadata to make sure metadata always
agree with Settings.

MODE setting moved above SYNTHETIC_ID to allow access.

* NodeFeature index.time_series_synthetic_id_default

Making sure to add this node feature in the same PR as adding the new
index version, `TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT` to make sure the
node feature can be used as a shortcut / replacement for checking
version in tests.

* Skip tsdb/25_id... and delete/70_tsdb in yamlRestCompatTest

The compat tests run with a copy of the yaml file from the BWC branch,
which doesn't contain the skip for index.time_series_synthetic_id.

This means the hardcoded ids in the test doesn't match with actual
default behavior anymore, so we skip those tests in the compatibility
run.

This is safe because the behavior is not changed for existing indices
that don't use synthetic id. Only new indices will have the changed
behavior, so there is no compatibility issue.

To make this work we nedd to make it possible to skip compatibility
tests with overloaded names.

If the name of the test is also a name of an operation such as `get` or
`delete` in below examples, then the build would fail with

```
Execution failed for task ':rest-api-spec:yamlRestCompatTestTransform'.
> class com.fasterxml.jackson.databind.node.ObjectNode cannot be cast to
 class com.fasterxml.jackson.databind.node.ArrayNode
```

Instead of throwing an (assert) exception if the node to transform
(skip) is of the wrong type, we now just ignore it instead.

Example of test that could not be skipped before, but that can be
skipped now:
```
get:
  - do:
      get:
        index:   id_generation_test
        id:      cZZNs7B9sSWsyrL5AAABeRnSA5M
```
---
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> and Cursor
michalborek pushed a commit to michalborek/elasticsearch that referenced this pull request Mar 23, 2026
* Enable synthetic_id by default if settings are valid

Newly created time_series indices use synthetic id by default.

The new IndexVersion, TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT,  prevent old indices
(with older index version) from changing default behavior.

`index.mapping.synthetic_id` defaults to true if
- Feature flag TSDB_SYNTHETIC_ID_FEATURE_FLAG is enabled
- index mode is time_series
- index version is TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT or later
- codec is default or unset

and setting is still allowed to be explicitly set if index version
is TIME_SERIES_USE_SYNTHETIC_ID_94 or later. Only the default behavior
is controlled by TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT.

This default logic is duplicated by IndexMetadata to make sure metadata always
agree with Settings.

MODE setting moved above SYNTHETIC_ID to allow access.

* NodeFeature index.time_series_synthetic_id_default

Making sure to add this node feature in the same PR as adding the new
index version, `TIME_SERIES_USE_SYNTHETIC_ID_DEFAULT` to make sure the
node feature can be used as a shortcut / replacement for checking
version in tests.

* Skip tsdb/25_id... and delete/70_tsdb in yamlRestCompatTest

The compat tests run with a copy of the yaml file from the BWC branch,
which doesn't contain the skip for index.time_series_synthetic_id.

This means the hardcoded ids in the test doesn't match with actual
default behavior anymore, so we skip those tests in the compatibility
run.

This is safe because the behavior is not changed for existing indices
that don't use synthetic id. Only new indices will have the changed
behavior, so there is no compatibility issue.

To make this work we nedd to make it possible to skip compatibility
tests with overloaded names.

If the name of the test is also a name of an operation such as `get` or
`delete` in below examples, then the build would fail with

```
Execution failed for task ':rest-api-spec:yamlRestCompatTestTransform'.
> class com.fasterxml.jackson.databind.node.ObjectNode cannot be cast to
 class com.fasterxml.jackson.databind.node.ArrayNode
```

Instead of throwing an (assert) exception if the node to transform
(skip) is of the wrong type, we now just ignore it instead.

Example of test that could not be skipped before, but that can be
skipped now:
```
get:
  - do:
      get:
        index:   id_generation_test
        id:      cZZNs7B9sSWsyrL5AAABeRnSA5M
```
---
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> and Cursor
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.

6 participants