mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
support dotted notation in elasticsearch settings and mappings (#144570)
(cherry picked from commit 4de8993fe96824ae125622bff264a4b15b42516e)
This commit is contained in:
parent
a7923d12d1
commit
9e6ee2a58c
2 changed files with 25 additions and 9 deletions
|
@ -54,6 +54,9 @@ describe('parseDefaultIngestPipeline', () => {
|
|||
});
|
||||
|
||||
describe('parseDataStreamElasticsearchEntry', () => {
|
||||
it('Should handle undefined elasticsearch', () => {
|
||||
expect(parseDataStreamElasticsearchEntry()).toEqual({});
|
||||
});
|
||||
it('Should handle empty elasticsearch', () => {
|
||||
expect(parseDataStreamElasticsearchEntry({})).toEqual({});
|
||||
});
|
||||
|
@ -108,4 +111,15 @@ describe('parseDataStreamElasticsearchEntry', () => {
|
|||
},
|
||||
});
|
||||
});
|
||||
it('Should handle dotted values for mappings and settings', () => {
|
||||
expect(
|
||||
parseDataStreamElasticsearchEntry({
|
||||
'index_template.mappings': { dynamic: false },
|
||||
'index_template.settings': { 'index.lifecycle.name': 'reference' },
|
||||
})
|
||||
).toEqual({
|
||||
'index_template.mappings': { dynamic: false },
|
||||
'index_template.settings': { 'index.lifecycle.name': 'reference' },
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -503,7 +503,7 @@ export function parseAndVerifyInputs(manifestInputs: any, location: string): Reg
|
|||
}
|
||||
|
||||
export function parseDataStreamElasticsearchEntry(
|
||||
elasticsearch: Record<string, any>,
|
||||
elasticsearch?: Record<string, any>,
|
||||
ingestPipeline?: string
|
||||
) {
|
||||
const parsedElasticsearchEntry: Record<string, any> = {};
|
||||
|
@ -520,16 +520,18 @@ export function parseDataStreamElasticsearchEntry(
|
|||
parsedElasticsearchEntry.source_mode = elasticsearch.source_mode;
|
||||
}
|
||||
|
||||
if (elasticsearch?.index_template?.mappings) {
|
||||
parsedElasticsearchEntry['index_template.mappings'] = expandDottedEntries(
|
||||
elasticsearch.index_template.mappings
|
||||
);
|
||||
const indexTemplateMappings =
|
||||
elasticsearch?.index_template?.mappings || elasticsearch?.['index_template.mappings'];
|
||||
if (indexTemplateMappings) {
|
||||
parsedElasticsearchEntry['index_template.mappings'] =
|
||||
expandDottedEntries(indexTemplateMappings);
|
||||
}
|
||||
|
||||
if (elasticsearch?.index_template?.settings) {
|
||||
parsedElasticsearchEntry['index_template.settings'] = expandDottedEntries(
|
||||
elasticsearch.index_template.settings
|
||||
);
|
||||
const indexTemplateSettings =
|
||||
elasticsearch?.index_template?.settings || elasticsearch?.['index_template.settings'];
|
||||
if (indexTemplateSettings) {
|
||||
parsedElasticsearchEntry['index_template.settings'] =
|
||||
expandDottedEntries(indexTemplateSettings);
|
||||
}
|
||||
|
||||
return parsedElasticsearchEntry;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue