mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[index mgmt] Fix preview of index templates which are used by data streams (#217604)
## Summary Fixes error message when attempting to preview an index template which is used by a data stream. When previewing a saved index template, a index template name and index pattern were provided. If the index pattern didn't match data streams that relied on the index template (and they never did) an error would be shown. As it turns out, supplying the index pattern was entirely unnecessary. This PR simply removes the index pattern from the api call and adds a test to make sure that preview functionality works when index templates match data streams. Follow up to https://github.com/elastic/kibana/pull/195174 Closes https://github.com/elastic/kibana/issues/212781
This commit is contained in:
parent
b6de659199
commit
b542a760cf
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,
|
||||
|
|
|
@ -519,6 +519,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