-
Notifications
You must be signed in to change notification settings - Fork 8.6k
APEX-72 Enforce Kibana >= 8.18.0; Remove switchToModelVersionAt
#220985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
58cfa3d
dd4af37
79e0c7a
de8ce54
2ced6d7
3ca7c68
abb8ad3
a01627d
d62dadb
b30f672
9205ce0
0f06a10
c3b5655
a13bc45
64d438a
e0c2f79
ed0ca90
c4651c2
e487c4d
5900e85
386a784
ea9a457
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| import { SemVer } from 'semver'; | ||
| import type { IndexMapping, IndexMappingMeta } from '../mappings'; | ||
| import type { VirtualVersionMap } from './version_map'; | ||
| import { assertValidVirtualVersion } from './conversion'; | ||
|
|
@@ -16,6 +17,7 @@ export interface GetModelVersionsFromMappingsOpts { | |
| source: 'mappingVersions' | 'docVersions'; | ||
| /** if specified, will filter the types with the provided list */ | ||
| knownTypes?: string[]; | ||
| minimumVirtualVersion?: string; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -25,6 +27,7 @@ export const getVirtualVersionsFromMappings = ({ | |
| mappings, | ||
| source, | ||
| knownTypes, | ||
| minimumVirtualVersion, | ||
| }: GetModelVersionsFromMappingsOpts): VirtualVersionMap | undefined => { | ||
| if (!mappings._meta) { | ||
| return undefined; | ||
|
|
@@ -34,6 +37,7 @@ export const getVirtualVersionsFromMappings = ({ | |
| meta: mappings._meta, | ||
| source, | ||
| knownTypes, | ||
| minimumVirtualVersion, | ||
| }); | ||
| }; | ||
|
|
||
|
|
@@ -42,6 +46,7 @@ export interface GetModelVersionsFromMappingMetaOpts { | |
| source: 'mappingVersions' | 'docVersions'; | ||
| /** if specified, will filter the types with the provided list */ | ||
| knownTypes?: string[]; | ||
| minimumVirtualVersion?: string; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -51,16 +56,23 @@ export const getVirtualVersionsFromMappingMeta = ({ | |
| meta, | ||
| source, | ||
| knownTypes, | ||
| minimumVirtualVersion, | ||
| }: GetModelVersionsFromMappingMetaOpts): VirtualVersionMap | undefined => { | ||
| const indexVersions = source === 'mappingVersions' ? meta.mappingVersions : meta.docVersions; | ||
| if (!indexVersions) { | ||
| return undefined; | ||
| } | ||
|
|
||
| const minVersion = minimumVirtualVersion ? new SemVer(minimumVirtualVersion) : undefined; | ||
| const typeSet = knownTypes ? new Set(knownTypes) : undefined; | ||
|
|
||
| return Object.entries(indexVersions).reduce<VirtualVersionMap>((map, [type, rawVersion]) => { | ||
| if (!typeSet || typeSet.has(type)) { | ||
| map[type] = assertValidVirtualVersion(rawVersion); | ||
| const validatedVersion = assertValidVirtualVersion(rawVersion); | ||
| map[type] = | ||
| minimumVirtualVersion && minVersion!.compare(validatedVersion) === 1 | ||
| ? minimumVirtualVersion | ||
| : validatedVersion; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With #219329 |
||
| } | ||
| return map; | ||
| }, {}); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just extracting
mappingVersionsin a common interface, as it is the same for V2 and ZDT.