Skip to content
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

Fix import of index analysis objects (#225) #227

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gonz-cint
Copy link

Description

Previously, when importing an existing index, the analysis configuration (analyzers, tokenizers, filters, char_filters, and normalizers) was not fully populated into the Terraform state. As a result, users would not see these analysis settings after import, leading to missing or incomplete configurations in state.

This commit introduces logic to reconstruct nested analysis objects from the flattened index.analysis.* keys returned by OpenSearch on import. By converting these flattened keys back into a nested JSON structure, the imported index state now includes the analysis settings as users typically define them in their Terraform configuration.

Note: This change may reveal differences for existing configurations if they rely on unquoted numeric values or trailing whitespace in analysis-related JSON. Such configurations may now produce diffs where they did not before, potentially resulting in forced replacements.

Issues Resolved

#225

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@gonz-cint gonz-cint force-pushed the fix/index-import-analysis branch 4 times, most recently from f94c888 to 88c7a2f Compare December 11, 2024 16:17
Previously, when importing an existing index, the analysis configuration
(analyzers, tokenizers, filters, char_filters, and normalizers) was not
fully populated into the Terraform state. As a result, users would not see
these analysis settings after import, leading to missing or incomplete
configurations in state.

This commit introduces logic to reconstruct nested analysis objects from
the flattened `index.analysis.*` keys returned by OpenSearch on import. By
converting these flattened keys back into a nested JSON structure, the
imported index state now includes the analysis settings as users typically
define them in their Terraform configuration.

**Note**: This change may reveal differences for existing configurations if
they rely on unquoted numeric values or trailing whitespace in
analysis-related JSON. Such configurations may now produce diffs where they
did not before, potentially resulting in forced replacements.

Signed-off-by: Gonzalo Arce <gonzalo.arce@cint.com>
@gonz-cint gonz-cint force-pushed the fix/index-import-analysis branch from 88c7a2f to d3e151f Compare December 11, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant