Skip to content

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

@peterpramb

Description

@peterpramb

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

Activity

changed the title [-]Delete enrich policy fails with `action.destructive_requires_name[/-] [+]Delete enrich policy fails with 'action.destructive_requires_name'[/+] on Jan 20, 2020
changed the title [-]Delete enrich policy fails with 'action.destructive_requires_name'[/-] [+]Delete enrich policy fails when 'action.destructive_requires_name' is used[/+] on Jan 20, 2020
elasticmachine

elasticmachine commented on Jan 20, 2020

@elasticmachine
Collaborator

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

martijnvg

martijnvg commented on Jan 21, 2020

@martijnvg
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.

added a commit that references this issue on Feb 18, 2020
a80d8af
added a commit that references this issue on Feb 18, 2020
d17ecb5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @martijnvg@jasontedor@peterpramb@elasticmachine

        Issue actions

          Delete enrich policy fails when 'action.destructive_requires_name' is used · Issue #51228 · elastic/elasticsearch