[7.x][ML] Refactor ML mappings and templates into JSON resources (#51…#52353
Merged
dimitris-athanasiou merged 4 commits intoelastic:7.xfrom Feb 14, 2020
Conversation
…stic#51765) ML mappings and index templates have so far been created programmatically. While this had its merits due to static typing, there is consensus it would be clear to maintain those in json files. In addition, we are going to adding ILM policies to these indices and the component for a plugin to register ILM policies is `IndexTemplateRegistry`. It expects the templates to be in resource json files. For the above reasons this commit refactors ML mappings and index templates into json resource files that are registered via `MlIndexTemplateRegistry`. Backport of elastic#51765
Collaborator
|
Pinging @elastic/ml-core (:ml) |
| return mapping(MapperService.SINGLE_MAPPING_NAME); | ||
| } | ||
|
|
||
| public static String mapping(String mappingType) { |
Contributor
Author
There was a problem hiding this comment.
In 7.x we need to still handle 6.x indices that have doc instead of _doc as the mapping type for the config and results index.
|
|
||
| try (XContentBuilder mapping = mappingSupplier.apply(mappingType)) { | ||
| try { | ||
| String mapping = mappingSupplier.apply(mappingType); |
Contributor
Author
There was a problem hiding this comment.
This is where we pass the mapping type to the mapping supplier method.
| return resultsMapping(MapperService.SINGLE_MAPPING_NAME); | ||
| } | ||
|
|
||
| public static String resultsMapping(String mappingType) { |
Contributor
Author
There was a problem hiding this comment.
In 7.x we need to still handle 6.x indices that have doc instead of _doc as the mapping type for the config and results index.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…765)
ML mappings and index templates have so far been created
programmatically. While this had its merits due to static typing,
there is consensus it would be clear to maintain those in json files.
In addition, we are going to adding ILM policies to these indices
and the component for a plugin to register ILM policies is
IndexTemplateRegistry. It expects the templates to be in resourcejson files.
For the above reasons this commit refactors ML mappings and index
templates into json resource files that are registered via
MlIndexTemplateRegistry.Backport of #51765