mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
handle source index without any mappings (#112664)
This commit is contained in:
parent
659b295391
commit
65ec86da66
2 changed files with 15 additions and 1 deletions
|
@ -74,4 +74,18 @@ describe('disableUnknownTypeMappingFields', () => {
|
|||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('does not fail if the source mapping does not have `properties` defined', () => {
|
||||
const missingPropertiesMappings = {
|
||||
...sourceMappings,
|
||||
properties: undefined,
|
||||
};
|
||||
const result = disableUnknownTypeMappingFields(
|
||||
activeMappings,
|
||||
// @ts-expect-error `properties` should not be undefined
|
||||
missingPropertiesMappings
|
||||
);
|
||||
|
||||
expect(Object.keys(result.properties)).toEqual(['known_type']);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -154,7 +154,7 @@ export function disableUnknownTypeMappingFields(
|
|||
): IndexMapping {
|
||||
const targetTypes = Object.keys(activeMappings.properties);
|
||||
|
||||
const disabledTypesProperties = Object.keys(sourceMappings.properties)
|
||||
const disabledTypesProperties = Object.keys(sourceMappings.properties ?? {})
|
||||
.filter((sourceType) => {
|
||||
const isObjectType = 'properties' in sourceMappings.properties[sourceType];
|
||||
// Only Object/Nested datatypes can be excluded from the field count by
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue