Skip to content

_validate doesn't honour ignore_unavailable option with closed index #116594

@drempapis

Description

@drempapis

Elasticsearch version: current master

Descprition

Calling the _validate API against an existing and closed index with ignore_unavailable=true fails with cluster_block_exception.

Steps to Reproduce

PUT myindex

POST myindex/_close

POST myindex/_validate/query?explain=true&ignore_unavailable=true
{
  "query":{
    "query_string":{
      "query":"abc AND" 
    }
  }
}

The last step will fail with:

{
    "error": {
        "root_cause": [
            {
                "type": "cluster_block_exception",
                "reason": "index [myindex] blocked by: [FORBIDDEN/4/index closed];"
            }
        ],
        "type": "cluster_block_exception",
        "reason": "index [myindex] blocked by: [FORBIDDEN/4/index closed];"
    },
    "status": 403
}

Definition of Done

The API should return an index_closed_exception for the case of a closed index

GET myindex/_field_caps?fields=price

{
    "error": {
        "root_cause": [
            {
                "type": "index_closed_exception",
                "reason": "closed",
                "index_uuid": "B9sFIzOCRB-yPjh2Q9x1TA",
                "index": "myindex"
            }
        ],
        "type": "index_closed_exception",
        "reason": "closed",
        "index_uuid": "B9sFIzOCRB-yPjh2Q9x1TA",
        "index": "myindex"
    },
    "status": 400
}

And ignore the closed index, when ignore_unavailable=true



{
    "indices": [],
    "fields": {}
}

Metadata

Metadata

Assignees

Labels

:Search Foundations/SearchCatch all for Search Foundations>bugTeam:Search FoundationsMeta label for the Search Foundations team in Elasticsearchpriority:normalA label for assessing bug priority to be used by ES engineers

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions