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] Error invoking _stats with expand_wildcards on closed indices #11180

Closed
mch2 opened this issue Nov 13, 2023 · 6 comments · Fixed by #13012
Closed

[BUG] Error invoking _stats with expand_wildcards on closed indices #11180

mch2 opened this issue Nov 13, 2023 · 6 comments · Fixed by #13012
Assignees
Labels
API Issues with external APIs bug Something isn't working Indexing Indexing, Bulk Indexing and anything related to indexing v2.14.0 v3.0.0 Issues and PRs related to version 3.0.0

Comments

@mch2
Copy link
Member

mch2 commented Nov 13, 2023

Describe the bug
The expand_wildcards parameter has the following options according to docs:

- all: Expand to all open and closed indexes, including hidden indexes.
- open: Expand to open indexes.
- closed: Expand to closed indexes.
- hidden: Include hidden indexes when expanding. Must be combined with open, closed, or both.
- none: Do not accept wildcard expressions.

all and closed options are supposed to expand on closed indices.

When either of these options are provided while the cluster contains a closed index, a bad request is returned:

{
  "error": {
    "root_cause": [
      {
        "type": "index_closed_exception",
        "reason": "closed",
        "index": "test-index",
        "index_uuid": "DH_Phg7YTpSG-KZfAPoddQ"
      }
    ],
    "type": "index_closed_exception",
    "reason": "closed",
    "index": "test-index",
    "index_uuid": "DH_Phg7YTpSG-KZfAPoddQ"
  },
  "status": 400
}

To Reproduce
Steps to reproduce the behavior:

  1. Create an index
  2. Close the index
  3. Query GET _stats?expand_wildcards=all or _stats?expand_wildcards=closed

Expected behavior
According to docs this request should succeed. I would assume returning the stats that are able to be fetched from a closed index, maybe not all?

Plugins
None

Screenshots
N/A

Host/Environment (please complete the following information):
Any

Additional context
Easily reproducible with ./gradlew run on main and 2.x branches, have not tried 1.x.
I am also not seeing any exception in stdout.

@mch2 mch2 added bug Something isn't working untriaged API Issues with external APIs labels Nov 13, 2023
@anasalkouz anasalkouz added the Indexing Indexing, Bulk Indexing and anything related to indexing label Jan 4, 2024
@srikanthpadakanti
Copy link
Contributor

Hello @anasalkouz @ankitkala @peternied Can you please assign this bug to me. I would like to work on this. Thanks.

@srikanthpadakanti
Copy link
Contributor

srikanthpadakanti commented Mar 20, 2024

@ankitkala @anasalkouz @andrross @mch2 @peternied

These are my findings so far -

Created an index called "sample-index" with sample docs.

curl -XPOST "http://localhost:9200/sample-index/_open"
curl -XGET "http://localhost:9200/sample-index/_stats" Printing the data 
curl -XPOST "http://localhost:9200/sample-index/_close"
curl -XGET "http://localhost:9200/sample-index/_stats"
{"error":{"root_cause":[{"type":"index_closed_exception","reason":"closed","index":"sample-index",
"index_uuid":"EOb53syfTa6SXZ-qPRfIPQ"}],"type":"index_closed_exception","reason":"closed",
"index":"sample-index","index_uuid":"EOb53syfTa6SXZ-qPRfIPQ"},"status":400}%
curl -XGET "http://localhost:9200/sample-index/_stats?expand_wildcards=all&forbid_closed_indices=false" 
printing the data | default value for forbid_closed_indices is true 
curl -XGET "http://localhost:9200/sample-index/_stats?expand_wildcards=closed&forbid_closed_indices=false"
printing the data  

Is this still a legit bug?
Can anyone please shed some light and explain more. Thanks.

@srikanthpadakanti
Copy link
Contributor

Hello @ankitkala @anasalkouz @andrross @mch2 @peternied,

Can you please answer the above?

@peternied
Copy link
Member

[Triage - attendees 1 2 3 4 5 6 7]
From our discussion, it sounds like a valid issue. How some parameters are treated in composition the default behavior should be different.

In the case mention where expand_wildcards=all or expand_wildcards=closed it seems like by default value of forbid_closed_indices should be false.

Its conflicting cases such as expand_wildcards=closed & forbid_closed_indices=true 400 error should be returned.

@srikanthpadakanti
Copy link
Contributor

Hi @ankitkala @anasalkouz @andrross @mch2 @peternied
I raised a PR to this bug. Can you please let me know if everything looks ok?
#13012

@reta reta added v3.0.0 Issues and PRs related to version 3.0.0 v2.14.0 labels Apr 2, 2024
@mch2
Copy link
Member Author

mch2 commented Apr 2, 2024

Apologies for chiming in late here and thanks for taking this @srikanthpadakanti

As @reta mentioned on the PR this would be breaking the rest spec. When I cut this I had not considered the default behavior with forbid_closed_indices so giving a better error message here would have helped me and does enough to resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Issues with external APIs bug Something isn't working Indexing Indexing, Bulk Indexing and anything related to indexing v2.14.0 v3.0.0 Issues and PRs related to version 3.0.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants