-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ml-api-histograms
- Loading branch information
Showing
16 changed files
with
309 additions
and
44 deletions.
There are no files selected for viewing
This file contains 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
15 changes: 15 additions & 0 deletions
15
...ore/server/kibana-plugin-core-server.savedobjectscomplexfieldmapping.dynamic.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md) > [dynamic](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.dynamic.md) | ||
|
||
## SavedObjectsComplexFieldMapping.dynamic property | ||
|
||
The dynamic property of the mapping, either `false` or `'strict'`<!-- -->. If unspecified `dynamic: 'strict'` will be inherited from the top-level index mappings. | ||
|
||
Note: To limit the number of mapping fields Saved Object types should \*never\* use `dynamic: true`<!-- -->. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
dynamic?: false | 'strict'; | ||
``` |
11 changes: 11 additions & 0 deletions
11
...ore/server/kibana-plugin-core-server.savedobjectscomplexfieldmapping.enabled.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md) > [enabled](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.enabled.md) | ||
|
||
## SavedObjectsComplexFieldMapping.enabled property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
enabled?: boolean; | ||
``` |
This file contains 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
11 changes: 0 additions & 11 deletions
11
...t/core/server/kibana-plugin-core-server.savedobjectscorefieldmapping.enabled.md
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
88 changes: 88 additions & 0 deletions
88
src/core/server/saved_objects/migrations/core/migration_context.test.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { disableUnknownTypeMappingFields } from './migration_context'; | ||
|
||
describe('disableUnknownTypeMappingFields', () => { | ||
const sourceMappings = { | ||
_meta: { | ||
migrationMappingPropertyHashes: { | ||
unknown_type: 'md5hash', | ||
unknown_core_field: 'md5hash', | ||
known_type: 'oldmd5hash', | ||
}, | ||
}, | ||
properties: { | ||
unknown_type: { | ||
properties: { | ||
unused_field: { type: 'text' }, | ||
}, | ||
}, | ||
unknown_core_field: { type: 'keyword' }, | ||
known_type: { | ||
properties: { | ||
field_1: { type: 'text' }, | ||
old_field: { type: 'boolean' }, | ||
}, | ||
}, | ||
}, | ||
}; | ||
const activeMappings = { | ||
_meta: { | ||
migrationMappingPropertyHashes: { | ||
known_type: 'md5hash', | ||
}, | ||
}, | ||
properties: { | ||
known_type: { | ||
properties: { | ||
new_field: { type: 'binary' }, | ||
field_1: { type: 'keyword' }, | ||
}, | ||
}, | ||
}, | ||
}; | ||
const targetMappings = disableUnknownTypeMappingFields(activeMappings, sourceMappings); | ||
|
||
it('disables complex field mappings from unknown types in the source mappings', () => { | ||
expect(targetMappings.properties.unknown_type).toEqual({ dynamic: false, properties: {} }); | ||
}); | ||
|
||
it('retains unknown core field mappings from the source mappings', () => { | ||
expect(targetMappings.properties.unknown_core_field).toEqual({ type: 'keyword' }); | ||
}); | ||
|
||
it('overrides source mappings with known types from active mappings', () => { | ||
expect(targetMappings.properties.known_type).toEqual({ | ||
properties: { | ||
new_field: { type: 'binary' }, | ||
field_1: { type: 'keyword' }, // was type text in source mappings | ||
// old_field was present in source but ommited in active mappings | ||
}, | ||
}); | ||
}); | ||
|
||
it('retains the active mappings _meta ignoring any _meta fields in the source mappings', () => { | ||
expect(targetMappings._meta).toEqual({ | ||
migrationMappingPropertyHashes: { | ||
known_type: 'md5hash', | ||
}, | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.