fix(os-persistence): Migrate index templates to Composable API with priorities #593
+9
−7
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.
Pull Request type
Changes in this PR
This PR fixes a critical bug where OpenSearch index templates were not applying field mappings correctly, resulting in indices being created with empty mappings for
task_log
,event
, andmessage
indices.Root Cause
The code was using the deprecated Legacy Template API (
PUT /_template/
) while the template JSON files were structured in the Composable Template API format (with nested"template": {}
key). The Legacy API does not recognize the nestedtemplate
structure and silently ignored it, resulting in templates being created with empty mappings.Solution
OpenSearchRestDAO
to use/_index_template/
endpoint instead of/_template/
log
field type fromkeyword
totext
intemplate_task_log.json
to enable full-text search capabilities on task execution logsTestOpenSearchRestDAO
to verify templates using the new API endpointWhy This Approach
Testing
Alternatives considered
Legacy API format: Convert JSON templates to flat structure for Legacy API. Rejected because
/_template/
is deprecated in OpenSearch.Specific patterns without priorities: Use patterns like
*_task_log_*
to avoid overlap. Rejected because OpenSearch validation still requires priorities for any potential pattern conflicts.