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

Question: How can I add a rollover_alias in the index_template file? #3077

Closed
thomass4t opened this issue Jul 28, 2023 · 2 comments
Closed
Labels
question Further information is requested

Comments

@thomass4t
Copy link

thomass4t commented Jul 28, 2023

Hello,
I tried many different syntaxes about rollover_alias but somehow, when data-prepper is creating the template in OpenSearch, the setting gets lost.

I have a simple pipeline with a sink:

  sink:
    - opensearch:
        hosts: [ "https://127.0.0.1:9200" ]
        index: "test_logs"
        template_type: "index-template"
        template_file: "/opt/data-prepper/pipelines/log.template"
        ism_policy_file: "/opt/data-prepper/pipelines/log.policy"

The template_file looks like this:

{
  "version": 3,
  "priority": 1,
  "template": {
      "settings": {
          "index": {
             "number_of_shards": "1",
             "number_of_replicas": "0",
             "plugins": {
                "index_state_management": {
                  "rollover_alias": "test_logs"
                }
             }
          }
      }
  }
}

The shards and replicas settings are applied. However, the rollover_alias always gets lost. I also tried the older syntax "opendistro.index_state_management.rollover_alias" but this setting gets lost too.
When the template is created, I can modify it without a problem and add the rollover_alias. I just can't get it work via data-preppers template_file.
Does anybody have a clue how to do it?

@dlvenable dlvenable added question Further information is requested and removed untriaged labels Aug 2, 2023
@JannikBrand
Copy link
Contributor

For the template_file option the following is documented for the opensearch sink plugin:

The json file content should be the json value of "template" key in the json content of OpenSearch Index templates API, e.g. otel-v1-apm-span-index-template.json

So for me it looks like you would only need to specify the following in your file:

"settings": {
   "index": {
      "number_of_shards": "1",
      "number_of_replicas": "0",
      "plugins": {
         "index_state_management": {
            "rollover_alias": "test_logs"
         }
      }
   }
}

I did not try it out, but this is how I would expect it to work

@HoffmannTom
Copy link

Thanks for your reply!
In the meantime, I chose another path and don't use template_file anymore.
This answer may help somebody else, who stumbles upon this. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Archived in project
Development

No branches or pull requests

4 participants