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] Policy update wont work with min_doc_count dropped in new policy. #1378

Open
ijunaid8989 opened this issue Feb 19, 2025 · 0 comments
Open
Labels
bug Something isn't working untriaged

Comments

@ijunaid8989
Copy link

ijunaid8989 commented Feb 19, 2025

What is the bug?
https://opensearch.org/docs/latest/im-plugin/ism/api/#update-managed-index-policy
Updating the policy of managed index is not working.

How can one reproduce the bug?
Steps to reproduce the behavior:
I have added a policy for an index such as

    %{
      "policy" => %{
        "description" => "ISM Policy for rollover and deletion",
        "default_state" => "hot",
        "states" => [
          %{
            "name" => "hot",
            "actions" => [
              %{
                "rollover" => %{
                  "min_index_age" => "30d",
                  "min_doc_count" => 100_000 <----issue
                }
              }
            ],
            "transitions" => [
              %{
                "state_name" => "delete",
                "conditions" => %{
                  "min_index_age" => "30d"
                }
              }
            ]
          },
          %{
            "name" => "delete",
            "actions" => [
              %{
                "delete" => %{}
              }
            ]
          }
        ],
        "ism_template" => %{
          "index_patterns" => ["benefits_program_user-*"]
        }
      }
    }

policy is available.
Its attached to benefits_program_user-* index pattern and being shown as well when I try to get 'http://localhost:9200/_plugins/_ism/explain/benefits_program_user?show_policy=true'

Image

Now I want to update the policy of this managed index with this

    %{
      "policy" => %{
        "description" => "ISM Policy for rollover and deletion",
        "default_state" => "hot",
        "states" => [
          %{
            "name" => "hot",
            "actions" => [
              %{
                "rollover" => %{
                  "min_index_age" => "10d"
                }
              }
            ],
            "transitions" => [
              %{
                "state_name" => "delete",
                "conditions" => %{
                  "min_index_age" => "10d"
                }
              }
            ]
          },
          %{
            "name" => "delete",
            "actions" => [
              %{
                "delete" => %{}
              }
            ]
          }
        ],
        "ism_template" => %{
          "index_patterns" => ["benefits_program_user-*"]
        }
      }
    }

So I first updated the policy.

Image which worked. then I made a request to change_policy endpoint POST. Image

it worked as expected but when I go to this page again

Image I still see the old policy.

When I start with min_doc_count in policy and then change the min age, it works but when old policy has min_doc_count and new has not.

then It wont get updated on index. I have waited for almost 12 hours.

What is the expected behavior?
It should update the new version of policy

What is your host/environment?

  • OS: Docker
  • Version Latest
  • Plugins
@ijunaid8989 ijunaid8989 added bug Something isn't working untriaged labels Feb 19, 2025
@ijunaid8989 ijunaid8989 changed the title [BUG] [BUG] Policy update wont work with min_doc_count dropped in new policy. Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged
Projects
None yet
Development

No branches or pull requests

1 participant