-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Adding _meta.template_version
to kibana reporting mappings
#133846
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Part of elastic/kibana#231200 . We realized that when the mappings are updated in a version upgrade, the mappings are in fact updated, but not applied to the current reporting datastream. To fix this, we'll make a determination in Kibana that we should roll over the data stream if the version in the template does not match the version in the mappings of the datastream. If they match, we don't need to do anything. If they don't match, or the version of the mappings is not in the datastream (from before this PR), we will need to roll over the data stream to apply the new mappings. To make this happen, we need to add a new field to the mapping `_meta`, which should match the template version. references: - https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-meta-field
Pinging @elastic/es-data-management (Team:Data Management) |
ymao1
approved these changes
Aug 29, 2025
@elasticmachine merge upstream |
💔 Backport failed
You can use sqren/backport to manually backport by running |
pmuellr
added a commit
to pmuellr/elasticsearch
that referenced
this pull request
Sep 2, 2025
…33846) Part of elastic/kibana#231200 . We realized that when the mappings are updated in a version upgrade, the mappings are in fact updated, but not applied to the current reporting datastream. To fix this, we'll make a determination in Kibana that we should roll over the data stream if the version in the template does not match the version in the mappings of the datastream. If they match, we don't need to do anything. If they don't match, or the version of the mappings is not in the datastream (from before this PR), we will need to roll over the data stream to apply the new mappings. To make this happen, we need to add a new field to the mapping `_meta`, which should match the template version. references: - https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-meta-field Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit ebb94bd) # Conflicts: # x-pack/plugin/stack/src/main/java/org/elasticsearch/xpack/stack/StackTemplateRegistry.java
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
pmuellr
added a commit
that referenced
this pull request
Sep 2, 2025
…134014) Part of elastic/kibana#231200 . We realized that when the mappings are updated in a version upgrade, the mappings are in fact updated, but not applied to the current reporting datastream. To fix this, we'll make a determination in Kibana that we should roll over the data stream if the version in the template does not match the version in the mappings of the datastream. If they match, we don't need to do anything. If they don't match, or the version of the mappings is not in the datastream (from before this PR), we will need to roll over the data stream to apply the new mappings. To make this happen, we need to add a new field to the mapping `_meta`, which should match the template version. references: - https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-meta-field Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit ebb94bd) # Conflicts: # x-pack/plugin/stack/src/main/java/org/elasticsearch/xpack/stack/StackTemplateRegistry.java
pmuellr
added a commit
that referenced
this pull request
Sep 3, 2025
…134015) Part of elastic/kibana#231200 . We realized that when the mappings are updated in a version upgrade, the mappings are in fact updated, but not applied to the current reporting datastream. To fix this, we'll make a determination in Kibana that we should roll over the data stream if the version in the template does not match the version in the mappings of the datastream. If they match, we don't need to do anything. If they don't match, or the version of the mappings is not in the datastream (from before this PR), we will need to roll over the data stream to apply the new mappings. To make this happen, we need to add a new field to the mapping `_meta`, which should match the template version. references: - https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-meta-field Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit ebb94bd) # Conflicts: # x-pack/plugin/stack/src/main/java/org/elasticsearch/xpack/stack/StackTemplateRegistry.java
pmuellr
added a commit
to pmuellr/kibana
that referenced
this pull request
Sep 5, 2025
… changed resolves: elastic#231200 This PR adds code run at startup to check the version in the reporting index template against the `_meta.template_version` value stamped into each backing index's mappings via elastic/elasticsearch#133846 If it determines there are existing reporting indices that have not been created with the current index template version, it will roll over the reporting data stream, to ensure future indexing will use the latest mappings. Startup processing for reporting has changed to apply the current index template mappings to the kibana reporting index, if it exists. This fixes a problem where a new field added to the index template, however it was not applied, so the field could not reliably used. The field was `space_id`, which could cause reports in non-default spaces to not appear in the reports list.
pmuellr
added a commit
to pmuellr/kibana
that referenced
this pull request
Sep 8, 2025
… changed resolves: elastic#231200 This PR adds code run at startup to check the version in the reporting index template against the `_meta.template_version` value stamped into each backing index's mappings via elastic/elasticsearch#133846 If it determines there are existing reporting indices that have not been created with the current index template version, it will roll over the reporting data stream, to ensure future indexing will use the latest mappings. Startup processing for reporting has changed to apply the current index template mappings to the kibana reporting index, if it exists. This fixes a problem where a new field added to the index template, however it was not applied, so the field could not reliably used. The field was `space_id`, which could cause reports in non-default spaces to not appear in the reports list.
sarog
pushed a commit
to portsbuild/elasticsearch
that referenced
this pull request
Sep 11, 2025
…33846) (elastic#134015) Part of elastic/kibana#231200 . We realized that when the mappings are updated in a version upgrade, the mappings are in fact updated, but not applied to the current reporting datastream. To fix this, we'll make a determination in Kibana that we should roll over the data stream if the version in the template does not match the version in the mappings of the datastream. If they match, we don't need to do anything. If they don't match, or the version of the mappings is not in the datastream (from before this PR), we will need to roll over the data stream to apply the new mappings. To make this happen, we need to add a new field to the mapping `_meta`, which should match the template version. references: - https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-meta-field Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit ebb94bd) # Conflicts: # x-pack/plugin/stack/src/main/java/org/elasticsearch/xpack/stack/StackTemplateRegistry.java
pmuellr
added a commit
to pmuellr/kibana
that referenced
this pull request
Sep 18, 2025
… changed resolves: elastic#231200 This PR adds code run at startup to check the version in the reporting index template against the `_meta.template_version` value stamped into each backing index's mappings via elastic/elasticsearch#133846 If it determines there are existing reporting indices that have not been created with the current index template version, it will roll over the reporting data stream, to ensure future indexing will use the latest mappings. Startup processing for reporting has changed to apply the current index template mappings to the kibana reporting index, if it exists. This fixes a problem where a new field added to the index template, however it was not applied, so the field could not reliably used. The field was `space_id`, which could cause reports in non-default spaces to not appear in the reports list.
pmuellr
added a commit
to pmuellr/kibana
that referenced
this pull request
Sep 18, 2025
… changed resolves: elastic#231200 This PR adds code run at startup to check the version in the reporting index template against the `_meta.template_version` value stamped into each backing index's mappings via elastic/elasticsearch#133846 If it determines there are existing reporting indices that have not been created with the current index template version, it will roll over the reporting data stream, to ensure future indexing will use the latest mappings. Startup processing for reporting has changed to apply the current index template mappings to the kibana reporting index, if it exists. This fixes a problem where a new field added to the index template, however it was not applied, so the field could not reliably used. The field was `space_id`, which could cause reports in non-default spaces to not appear in the reports list.
sarog
pushed a commit
to portsbuild/elasticsearch
that referenced
this pull request
Sep 19, 2025
…33846) (elastic#134015) Part of elastic/kibana#231200 . We realized that when the mappings are updated in a version upgrade, the mappings are in fact updated, but not applied to the current reporting datastream. To fix this, we'll make a determination in Kibana that we should roll over the data stream if the version in the template does not match the version in the mappings of the datastream. If they match, we don't need to do anything. If they don't match, or the version of the mappings is not in the datastream (from before this PR), we will need to roll over the data stream to apply the new mappings. To make this happen, we need to add a new field to the mapping `_meta`, which should match the template version. references: - https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-meta-field Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit ebb94bd) # Conflicts: # x-pack/plugin/stack/src/main/java/org/elasticsearch/xpack/stack/StackTemplateRegistry.java
pmuellr
added a commit
to elastic/kibana
that referenced
this pull request
Sep 29, 2025
… changed (#234119) resolves: #231200 This PR adds code run at startup to check the version in the reporting index template against the `_meta.template_version` value stamped into each backing index's mappings via elastic/elasticsearch#133846 If it determines there are existing reporting indices that have not been created with the current index template version, it will roll over the reporting data stream, to ensure future indexing will use the latest mappings. This is done with the "lazy" option, which will perform the roll over on the next write to the datastream. This will prevent situations where multiple Kibanas restarting at the same time would roll over multiple times. --------- Co-authored-by: Elastic Machine <[email protected]>
niros1
pushed a commit
to elastic/kibana
that referenced
this pull request
Sep 30, 2025
… changed (#234119) resolves: #231200 This PR adds code run at startup to check the version in the reporting index template against the `_meta.template_version` value stamped into each backing index's mappings via elastic/elasticsearch#133846 If it determines there are existing reporting indices that have not been created with the current index template version, it will roll over the reporting data stream, to ensure future indexing will use the latest mappings. This is done with the "lazy" option, which will perform the roll over on the next write to the datastream. This will prevent situations where multiple Kibanas restarting at the same time would roll over multiple times. --------- Co-authored-by: Elastic Machine <[email protected]>
VladimirFilonov
pushed a commit
to VladimirFilonov/kibana
that referenced
this pull request
Sep 30, 2025
… changed (elastic#234119) resolves: elastic#231200 This PR adds code run at startup to check the version in the reporting index template against the `_meta.template_version` value stamped into each backing index's mappings via elastic/elasticsearch#133846 If it determines there are existing reporting indices that have not been created with the current index template version, it will roll over the reporting data stream, to ensure future indexing will use the latest mappings. This is done with the "lazy" option, which will perform the roll over on the next write to the datastream. This will prevent situations where multiple Kibanas restarting at the same time would roll over multiple times. --------- Co-authored-by: Elastic Machine <[email protected]>
pmuellr
added a commit
to pmuellr/kibana
that referenced
this pull request
Oct 1, 2025
… changed (elastic#234119) resolves: elastic#231200 This PR adds code run at startup to check the version in the reporting index template against the `_meta.template_version` value stamped into each backing index's mappings via elastic/elasticsearch#133846 If it determines there are existing reporting indices that have not been created with the current index template version, it will roll over the reporting data stream, to ensure future indexing will use the latest mappings. This is done with the "lazy" option, which will perform the roll over on the next write to the datastream. This will prevent situations where multiple Kibanas restarting at the same time would roll over multiple times. --------- Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit c89ba82) # Conflicts: # .github/CODEOWNERS # x-pack/platform/test/reporting_api_integration/reporting_without_security.config.ts # x-pack/platform/test/tsconfig.json
pmuellr
added a commit
to pmuellr/kibana
that referenced
this pull request
Oct 1, 2025
… changed (elastic#234119) resolves: elastic#231200 This PR adds code run at startup to check the version in the reporting index template against the `_meta.template_version` value stamped into each backing index's mappings via elastic/elasticsearch#133846 If it determines there are existing reporting indices that have not been created with the current index template version, it will roll over the reporting data stream, to ensure future indexing will use the latest mappings. This is done with the "lazy" option, which will perform the roll over on the next write to the datastream. This will prevent situations where multiple Kibanas restarting at the same time would roll over multiple times. --------- Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit c89ba82) # Conflicts: # .github/CODEOWNERS # x-pack/test/reporting_api_integration/reporting_without_security.config.ts # x-pack/test/reporting_api_integration/reporting_without_security/index.ts # x-pack/test/reporting_api_integration/reporting_without_security/roll_datastream.ts # x-pack/test/tsconfig.json
pmuellr
added a commit
to pmuellr/kibana
that referenced
this pull request
Oct 1, 2025
… changed (elastic#234119) resolves: elastic#231200 This PR adds code run at startup to check the version in the reporting index template against the `_meta.template_version` value stamped into each backing index's mappings via elastic/elasticsearch#133846 If it determines there are existing reporting indices that have not been created with the current index template version, it will roll over the reporting data stream, to ensure future indexing will use the latest mappings. This is done with the "lazy" option, which will perform the roll over on the next write to the datastream. This will prevent situations where multiple Kibanas restarting at the same time would roll over multiple times. --------- Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit c89ba82) # Conflicts: # .github/CODEOWNERS # x-pack/platform/test/reporting_api_integration/reporting_without_security.config.ts # x-pack/platform/test/tsconfig.json
pmuellr
added a commit
to pmuellr/kibana
that referenced
this pull request
Oct 1, 2025
… changed (elastic#234119) resolves: elastic#231200 This PR adds code run at startup to check the version in the reporting index template against the `_meta.template_version` value stamped into each backing index's mappings via elastic/elasticsearch#133846 If it determines there are existing reporting indices that have not been created with the current index template version, it will roll over the reporting data stream, to ensure future indexing will use the latest mappings. This is done with the "lazy" option, which will perform the roll over on the next write to the datastream. This will prevent situations where multiple Kibanas restarting at the same time would roll over multiple times. --------- Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit c89ba82) # Conflicts: # .github/CODEOWNERS # x-pack/test/reporting_api_integration/reporting_without_security.config.ts # x-pack/test/reporting_api_integration/reporting_without_security/index.ts # x-pack/test/reporting_api_integration/reporting_without_security/roll_datastream.ts # x-pack/test/tsconfig.json
pmuellr
added a commit
to elastic/kibana
that referenced
this pull request
Oct 2, 2025
…ate has changed (#234119) (#237115) # Backport This will backport the following commits from `main` to `8.19`: - [[Reporting] roll over the reporting data stream when the template has changed (#234119)](#234119) <!--- Backport version: 10.0.2 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Patrick Mueller","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-09-29T23:06:34Z","message":"[Reporting] roll over the reporting data stream when the template has changed (#234119)\n\nresolves: https://github.com/elastic/kibana/issues/231200\n\nThis PR adds code run at startup to check the version in the reporting\nindex template against the `_meta.template_version` value stamped into\neach backing index's mappings via\nhttps://github.com/elastic/elasticsearch/pull/133846\n\nIf it determines there are existing reporting indices that have not been\ncreated with the current index template version, it will roll over the\nreporting data stream, to ensure future indexing will use the latest\nmappings. This is done with the \"lazy\" option, which will perform the\nroll over on the next write to the datastream. This will prevent\nsituations where multiple Kibanas restarting at the same time would roll\nover multiple times.\n\n---------\n\nCo-authored-by: Elastic Machine <[email protected]>","sha":"c89ba8264f5a43c01d69b42577d79925cb020c04","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:ResponseOps","backport missing","backport:all-open","Feature:Reporting:Framework","v9.2.0"],"title":"[Reporting] roll over the reporting data stream when the template has changed","number":234119,"url":"https://github.com/elastic/kibana/pull/234119","mergeCommit":{"message":"[Reporting] roll over the reporting data stream when the template has changed (#234119)\n\nresolves: https://github.com/elastic/kibana/issues/231200\n\nThis PR adds code run at startup to check the version in the reporting\nindex template against the `_meta.template_version` value stamped into\neach backing index's mappings via\nhttps://github.com/elastic/elasticsearch/pull/133846\n\nIf it determines there are existing reporting indices that have not been\ncreated with the current index template version, it will roll over the\nreporting data stream, to ensure future indexing will use the latest\nmappings. This is done with the \"lazy\" option, which will perform the\nroll over on the next write to the datastream. This will prevent\nsituations where multiple Kibanas restarting at the same time would roll\nover multiple times.\n\n---------\n\nCo-authored-by: Elastic Machine <[email protected]>","sha":"c89ba8264f5a43c01d69b42577d79925cb020c04"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/234119","number":234119,"mergeCommit":{"message":"[Reporting] roll over the reporting data stream when the template has changed (#234119)\n\nresolves: https://github.com/elastic/kibana/issues/231200\n\nThis PR adds code run at startup to check the version in the reporting\nindex template against the `_meta.template_version` value stamped into\neach backing index's mappings via\nhttps://github.com/elastic/elasticsearch/pull/133846\n\nIf it determines there are existing reporting indices that have not been\ncreated with the current index template version, it will roll over the\nreporting data stream, to ensure future indexing will use the latest\nmappings. This is done with the \"lazy\" option, which will perform the\nroll over on the next write to the datastream. This will prevent\nsituations where multiple Kibanas restarting at the same time would roll\nover multiple times.\n\n---------\n\nCo-authored-by: Elastic Machine <[email protected]>","sha":"c89ba8264f5a43c01d69b42577d79925cb020c04"}}]}] BACKPORT--> --------- Co-authored-by: Elastic Machine <[email protected]>
pmuellr
added a commit
to elastic/kibana
that referenced
this pull request
Oct 2, 2025
…te has changed (#234119) (#237049) # Backport This will backport the following commits from `main` to `9.1`: - [[Reporting] roll over the reporting data stream when the template has changed (#234119)](#234119) <!--- Backport version: 10.0.2 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Patrick Mueller","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-09-29T23:06:34Z","message":"[Reporting] roll over the reporting data stream when the template has changed (#234119)\n\nresolves: https://github.com/elastic/kibana/issues/231200\n\nThis PR adds code run at startup to check the version in the reporting\nindex template against the `_meta.template_version` value stamped into\neach backing index's mappings via\nhttps://github.com/elastic/elasticsearch/pull/133846\n\nIf it determines there are existing reporting indices that have not been\ncreated with the current index template version, it will roll over the\nreporting data stream, to ensure future indexing will use the latest\nmappings. This is done with the \"lazy\" option, which will perform the\nroll over on the next write to the datastream. This will prevent\nsituations where multiple Kibanas restarting at the same time would roll\nover multiple times.\n\n---------\n\nCo-authored-by: Elastic Machine <[email protected]>","sha":"c89ba8264f5a43c01d69b42577d79925cb020c04","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:ResponseOps","backport missing","backport:all-open","Feature:Reporting:Framework","v9.2.0"],"title":"[Reporting] roll over the reporting data stream when the template has changed","number":234119,"url":"https://github.com/elastic/kibana/pull/234119","mergeCommit":{"message":"[Reporting] roll over the reporting data stream when the template has changed (#234119)\n\nresolves: https://github.com/elastic/kibana/issues/231200\n\nThis PR adds code run at startup to check the version in the reporting\nindex template against the `_meta.template_version` value stamped into\neach backing index's mappings via\nhttps://github.com/elastic/elasticsearch/pull/133846\n\nIf it determines there are existing reporting indices that have not been\ncreated with the current index template version, it will roll over the\nreporting data stream, to ensure future indexing will use the latest\nmappings. This is done with the \"lazy\" option, which will perform the\nroll over on the next write to the datastream. This will prevent\nsituations where multiple Kibanas restarting at the same time would roll\nover multiple times.\n\n---------\n\nCo-authored-by: Elastic Machine <[email protected]>","sha":"c89ba8264f5a43c01d69b42577d79925cb020c04"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/234119","number":234119,"mergeCommit":{"message":"[Reporting] roll over the reporting data stream when the template has changed (#234119)\n\nresolves: https://github.com/elastic/kibana/issues/231200\n\nThis PR adds code run at startup to check the version in the reporting\nindex template against the `_meta.template_version` value stamped into\neach backing index's mappings via\nhttps://github.com/elastic/elasticsearch/pull/133846\n\nIf it determines there are existing reporting indices that have not been\ncreated with the current index template version, it will roll over the\nreporting data stream, to ensure future indexing will use the latest\nmappings. This is done with the \"lazy\" option, which will perform the\nroll over on the next write to the datastream. This will prevent\nsituations where multiple Kibanas restarting at the same time would roll\nover multiple times.\n\n---------\n\nCo-authored-by: Elastic Machine <[email protected]>","sha":"c89ba8264f5a43c01d69b42577d79925cb020c04"}}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
auto-backport
Automatically create backport pull requests when merged
backport pending
:Data Management/Data streams
Data streams and their lifecycles
>non-issue
Team:Data Management
Meta label for data/management team
v8.19.4
v9.1.4
v9.2.0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of elastic/kibana#231200
We realized that when the mappings are updated in a version upgrade, the mappings are in fact updated, but not applied to the current reporting datastream.
To fix this, we'll make a determination in Kibana that we should roll over the data stream if the version in the template does not match the version in the mappings of the datastream. If they match, we don't need to do anything. If they don't match, or the version of the mappings is not in the datastream (from before this PR), we will need to roll over the data stream to apply the new mappings.
To make this happen, we need to add a new field to the mapping
_meta
, which should match the template version.references:
To test applying this template over an existing template, you can run Kibana and ES from a local Kibana repo, create a report, then run the ES built from here and the same Kibana. Then roll over the reporting index.
Some details since I was unfamiliar with how to run ES from a local build in this repo:
./gradlew assemble
distribution/archives/darwin-aarch64-tar/build/distributions/elasticsearch-9.2.0-SNAPSHOT-darwin-aarch64.tar.gz
, for examplebin/elasticsearch
-E path.data=<path-used-by-previous-ES-run>
export ES_PATH_CONF=<path-to-your-kibana-repo/.es/9.2.0/config