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

[BUG] Index template_file and template_content truncates index pattern incorrectly #3432

Open
graytaylor0 opened this issue Oct 3, 2023 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@graytaylor0
Copy link
Member

graytaylor0 commented Oct 3, 2023

Describe the bug

Index patterns are being created with a truncated index pattern from the index template index patterns passed in the config

This bug occurs when there is no ism_policy_file passed to the source. This is here in the code (

this.ismPolicyManagementStrategy = new NoIsmPolicyManagement(openSearchClient, restHighLevelClient);
) where the decision to use NoIsmPolicyManagement class is made. This class has the following method which does not add a pattern back ( ), which is called here (after removing the pattern suffix) (
final List<String> indexPatterns = ismPolicyManagementStrategy.getIndexPatterns(indexPrefixWithoutTrailingDash);
). With an ism policy file, this method will be called instead, which adds back the pattern ( )

To Reproduce
Steps to reproduce the behavior:

  1. Create a pipeline with the following opensearch sink configuration
sink:
  - opensearch:
       index: "test-index-1"
       template_type: "index-template"
       template_content: |
          {
            "index_patterns": [
              "test-*"
            ],
            "template": {
              "aliases": {
                  "my_test_logs": {}
              },
              "settings": {
                  "number_of_shards": 5,
                  "number_of_replicas": 2,
                  "refresh_interval": -1
              },
              "mappings": {
                "properties": {
                  "timestamp": {
                    "type": "date",
                    "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
                  },
                  "value": {
                    "type": "double"
                  }
                }
              }
            }
          }
  1. Run data prepper and then go to OpenSearch Dashboards to look at the created index template
GET _index_template/test-index-template

You will see that the index_pattern in the template is only test and not test-*

Expected behavior
To not truncate the index pattern

Additional context

@graytaylor0 graytaylor0 added bug Something isn't working untriaged labels Oct 3, 2023
@dlvenable dlvenable added this to the v2.6 milestone Oct 23, 2023
@graytaylor0 graytaylor0 removed their assignment Nov 1, 2023
@dlvenable dlvenable self-assigned this Nov 1, 2023
@dlvenable dlvenable modified the milestones: v2.6, v2.6.1 Nov 14, 2023
@dlvenable dlvenable modified the milestones: v2.6.1, v2.6.2 Dec 7, 2023
@dlvenable dlvenable modified the milestones: v2.6.2, v2.7 Jan 11, 2024
@dlvenable dlvenable modified the milestones: v2.7, v2.8 Jan 30, 2024
@LHozzan
Copy link

LHozzan commented Apr 23, 2024

Maybe same here.

@dlvenable dlvenable modified the milestones: v2.8, v2.9 May 14, 2024
@dlvenable dlvenable modified the milestones: v2.9, v2.10 Jun 25, 2024
@dlvenable dlvenable modified the milestones: v2.10, v2.11 Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

3 participants