mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[8.18] [index mgmt] Fix preview of index templates which are used by data streams (#217604) (#217737)
# Backport This will backport the following commits from `main` to `8.18`: - [[index mgmt] Fix preview of index templates which are used by data streams (#217604)](https://github.com/elastic/kibana/pull/217604) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Matthew Kime","email":"matt@mattki.me"},"sourceCommit":{"committedDate":"2025-04-09T17:29:12Z","message":"[index mgmt] Fix preview of index templates which are used by data streams (#217604)\n\n## Summary\n\nFixes error message when attempting to preview an index template which\nis used by a data stream.\n\nWhen previewing a saved index template, a index template name and index\npattern were provided. If the index pattern didn't match data streams\nthat relied on the index template (and they never did) an error would be\nshown. As it turns out, supplying the index pattern was entirely\nunnecessary. This PR simply removes the index pattern from the api call\nand adds a test to make sure that preview functionality works when index\ntemplates match data streams.\n\nFollow up to https://github.com/elastic/kibana/pull/195174\n\nCloses https://github.com/elastic/kibana/issues/212781","sha":"b542a760cf5c87900c87b3f5424749eec52366c6","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Feature:Index Management","Team:Kibana Management","backport:prev-major","v9.1.0"],"title":"[index mgmt] Fix preview of index templates which are used by data streams","number":217604,"url":"https://github.com/elastic/kibana/pull/217604","mergeCommit":{"message":"[index mgmt] Fix preview of index templates which are used by data streams (#217604)\n\n## Summary\n\nFixes error message when attempting to preview an index template which\nis used by a data stream.\n\nWhen previewing a saved index template, a index template name and index\npattern were provided. If the index pattern didn't match data streams\nthat relied on the index template (and they never did) an error would be\nshown. As it turns out, supplying the index pattern was entirely\nunnecessary. This PR simply removes the index pattern from the api call\nand adds a test to make sure that preview functionality works when index\ntemplates match data streams.\n\nFollow up to https://github.com/elastic/kibana/pull/195174\n\nCloses https://github.com/elastic/kibana/issues/212781","sha":"b542a760cf5c87900c87b3f5424749eec52366c6"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217604","number":217604,"mergeCommit":{"message":"[index mgmt] Fix preview of index templates which are used by data streams (#217604)\n\n## Summary\n\nFixes error message when attempting to preview an index template which\nis used by a data stream.\n\nWhen previewing a saved index template, a index template name and index\npattern were provided. If the index pattern didn't match data streams\nthat relied on the index template (and they never did) an error would be\nshown. As it turns out, supplying the index pattern was entirely\nunnecessary. This PR simply removes the index pattern from the api call\nand adds a test to make sure that preview functionality works when index\ntemplates match data streams.\n\nFollow up to https://github.com/elastic/kibana/pull/195174\n\nCloses https://github.com/elastic/kibana/issues/212781","sha":"b542a760cf5c87900c87b3f5424749eec52366c6"}}]}] BACKPORT--> Co-authored-by: Matthew Kime <matt@mattki.me>
This commit is contained in:
parent
9d35cfb9f8
commit
b652d91bd4
2 changed files with 17 additions and 1 deletions
|
@ -40,7 +40,6 @@ export function registerSimulateRoute({ router, lib: { handleEsError } }: RouteD
|
|||
const params: estypes.IndicesSimulateTemplateRequest = templateName
|
||||
? {
|
||||
name: templateName,
|
||||
index_patterns,
|
||||
}
|
||||
: {
|
||||
...template,
|
||||
|
|
|
@ -510,6 +510,23 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
// cleanup
|
||||
await deleteTemplates([{ name: templateName }]);
|
||||
});
|
||||
|
||||
it('should simulate an index template by name with a related data stream', async () => {
|
||||
const dataStreamName = `test-foo`;
|
||||
const templateName = `template-${getRandomString()}`;
|
||||
const payload = getTemplatePayload(templateName);
|
||||
|
||||
await createTemplate({ ...payload, dataStream: {} }).expect(200);
|
||||
|
||||
// Matches index template
|
||||
await es.indices.createDataStream({ name: dataStreamName });
|
||||
|
||||
await simulateTemplateByName(templateName).expect(200);
|
||||
|
||||
// cleanup
|
||||
await deleteTemplates([{ name: templateName }]);
|
||||
await es.indices.deleteDataStream({ name: dataStreamName });
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue