-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Updating TransportSimulateIndexTemplateAction.resolveTemplate() to account for data stream overrides #132131
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
Updating TransportSimulateIndexTemplateAction.resolveTemplate() to account for data stream overrides #132131
Conversation
…count for data stream overrides
|
Hi @masseyke, I've created a changelog YAML for you. |
…e' of github.com:masseyke/elasticsearch into fix/TransportSimulateIndexTemplateAction-resolveTemplate
|
Pinging @elastic/es-data-management (Team:Data Management) |
|
Hi @masseyke, I've updated the changelog YAML for you. |
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.
Pull Request Overview
This PR fixes the simulate index template API to properly account for data stream mapping and setting overrides. The core issue was that when simulating templates for data streams, the API wasn't considering the overrides that had been applied to the data stream, leading to inaccurate simulation results.
Key changes:
- Modified
resolveTemplate()method to accept an additionalProjectMetadataparameter for accessing actual project data - Added logic to retrieve and apply data stream mapping and setting overrides when the template is for a data stream
- Updated all callers of
resolveTemplate()to provide the new parameter
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| TransportSimulateIndexTemplateAction.java | Core fix - adds data stream override logic to resolveTemplate() method |
| TransportSimulateBulkAction.java | Updated to pass actual project metadata to resolveTemplate() |
| TransportSimulateTemplateAction.java | Updated to pass project metadata (with explanatory comment) |
| TransportSimulateIndexTemplateActionTests.java | Updated test to provide new parameter |
| 10_basic.yml | Added integration test for data stream overrides |
| 80_ingest_simulate.yml | Added test for ingest simulation with data stream mapping overrides |
| 132131.yaml | Changelog entry for the bug fix |
...g/elasticsearch/action/admin/indices/template/post/TransportSimulateIndexTemplateAction.java
Outdated
Show resolved
Hide resolved
...g/elasticsearch/action/admin/indices/template/post/TransportSimulateIndexTemplateAction.java
Outdated
Show resolved
Hide resolved
...g/elasticsearch/action/admin/indices/template/post/TransportSimulateIndexTemplateAction.java
Outdated
Show resolved
Hide resolved
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.
LGTM, I left two really minor comments
| ); | ||
| } | ||
|
|
||
| private static List<CompressedXContent> collectMappings( |
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.
Can you add javadocs for this method?
| private static Settings collectSettings( | ||
| final ProjectMetadata simulatedProject, | ||
| final DataStream dataStream, | ||
| String templateNmae, |
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.
Minor typo: templateNmae -> templateName
💔 Backport failed
You can use sqren/backport to manually backport by running |
|
Removing the backport labels because data stream settings did not appear until 9.2.0. |
As reported in #131425, the simulate index API does not account for data stream mapping overrides. It also does not account for data stream setting overrides. Here is how it impacts the simulate APIs:
_index_template/_simulate_index/{index_name})_ingest/_simulate)_index_template/_simulate)_ingest/pipeline)This PR fixes TransportSimulateIndexTemplateAction.resolveTemplate() by reading the data stream for the index (if it exists) in a new ProjectMetadata argument. It adds the data stream's mapping and setting overrides to the template it is creating.
Closes #131425