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

Delete enrich policy fails when 'action.destructive_requires_name' is used #51228

Closed
peterpramb opened this issue Jan 20, 2020 · 2 comments
Closed
Labels
>bug :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP

Comments

@peterpramb
Copy link

peterpramb commented Jan 20, 2020

Elasticsearch version:
Version: 7.5.1, Build: default/tar/3ae9ac9a93c95bd0cdc054951cf95d88e1e18d96/2019-12-16T22:57:37.835892Z, JVM: 11.0.5

JVM version:
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.5+10, mixed mode)

OS version:
Linux 3.10.0-1062.1.2.el7.x86_64 #1 SMP Mon Sep 16 14:19:51 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:
Deleting an unused enrich policy while action.destructive_requires_name: true is in effect fails with the following exception:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "Wildcard expressions or all indices are not allowed"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "Wildcard expressions or all indices are not allowed"
  },
  "status" : 400
}

After transiently setting action.destructive_requires_name: false the deletion is successful:

{
  "acknowledged" : true
}

Steps to reproduce:

  1. Create source index:
POST /gh-51228/_doc
{
  "field": "value"
}
  1. Create enrich policy:
PUT /_enrich/policy/gh-51228
{
    "match": {
        "indices": [
            "gh-51228"
        ],
        "match_field": "field",
        "enrich_fields": [
            "field"
        ]
    }
}
  1. Activate enrich policy:
PUT /_enrich/policy/gh-51228/_execute
  1. Disable wildcard deletes:
PUT /_cluster/settings
{
  "transient" : {
    "action" : {
      "destructive_requires_name" : "true"
    }
  }
}
  1. Delete enrich policy:
DELETE /_enrich/policy/gh-51228
@peterpramb peterpramb changed the title Delete enrich policy fails with `action.destructive_requires_name Delete enrich policy fails with 'action.destructive_requires_name' Jan 20, 2020
@peterpramb peterpramb changed the title Delete enrich policy fails with 'action.destructive_requires_name' Delete enrich policy fails when 'action.destructive_requires_name' is used Jan 20, 2020
@jasontedor jasontedor added the :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP label Jan 20, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Ingest)

@martijnvg martijnvg added the >bug label Jan 21, 2020
@martijnvg
Copy link
Member

In the TransportDeleteEnrichPolicyAction#deleteIndicesAndPolicy() method, we should list all enrich index for the policy that gets deleted instead of sending a delete index request with a wildcard suffix. The method that invokes deleteIndicesAndPolicy()method has the cluster state, so from that we can figure out the enrich indices for the policy that is getting removed.

martijnvg pushed a commit to martijnvg/elasticsearch that referenced this issue Feb 18, 2020
…delete index api (elastic#52179)

Don't rely on the delete index api to resolve all the enrich indices for a particular enrich policy using a '[policy_name]-*' wildcard expression. With this change, the delete policy api will resolve the indices to remove and pass that directly to the delete index api.

This resolves a bug, that if `action.destructive_requires_name` setting has been set to true then the delete policy api is unable to remove the enrich indices related to the policy being deleted.

Closes elastic#51228
martijnvg added a commit that referenced this issue Feb 18, 2020
…delete index api (#52448)

Backport from #52179

Don't rely on the delete index api to resolve all the enrich indices for a particular enrich policy using a '[policy_name]-*' wildcard expression. With this change, the delete policy api will resolve the indices to remove and pass that directly to the delete index api.

This resolves a bug, that if `action.destructive_requires_name` setting has been set to true then the delete policy api is unable to remove the enrich indices related to the policy being deleted.

Closes #51228 

Co-authored-by: bellengao <gbl_long@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP
Projects
None yet
Development

No branches or pull requests

4 participants