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] Explain API endpoint mixes indices with metadata #66

Closed
adityaj1107 opened this issue Jun 3, 2021 · 2 comments
Closed

[BUG] Explain API endpoint mixes indices with metadata #66

adityaj1107 opened this issue Jun 3, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@adityaj1107
Copy link
Contributor

Issue by jurajseffer
Saturday May 01, 2021 at 16:25 GMT
Originally opened as opendistro-for-elasticsearch/index-management#443


Describe the bug
Documentation at https://opendistro.github.io/for-elasticsearch-docs/docs/im/ism/api/#explain-index states that a response for the explain API endpoint looks like this:

{
  "index_1": {
    "index.opendistro.index_state_management.policy_id": "policy_1"
  }
}

However, when I use a wildcard _opendistro/_ism/explain/* search to investigate all indices, I also get total_managed_indices in the response mixed up in the response object together with the indices.E.g.

{
  "index_1": {
    "index.opendistro.index_state_management.policy_id": "policy_1"
  },
  "total_managed_indices": 1
}

This makes for harder and unexpected response parsing. I think the results of indices should be separated from metadata, e.g. under a subkey or such so that iteration over the results doesn't have to have exceptions for what sort of key it is (index entry vs metadata).

To Reproduce
Query _opendistro/_ism/explain/* in (AWS) ES 7.9

Expected behavior
Separation of result items from metadata.

{
  "indices" : {
    "index_1": {
      "index.opendistro.index_state_management.policy_id": "policy_1"
    }
  },
  "total_managed_indices": 1
}
@adityaj1107 adityaj1107 added the bug Something isn't working label Jun 3, 2021
@adityaj1107
Copy link
Contributor Author

Comment by bowenlan-amzn
Tuesday May 04, 2021 at 18:01 GMT


Sorry for the inconvenience, but we are not able to change the structure of already released API response structure.

we need this total_managed_indices in our frontend, but didn't notice this could break user experience.

@adityaj1107
Copy link
Contributor Author

Comment by dbbaughe
Tuesday May 04, 2021 at 18:01 GMT


Hey @jurajseffer,

Thanks for opening the issue, agree it's not helpful to have them mixed like this (and would cause an issue with an index named total_managed_indices most likely). Unfortunately we cannot change the structure of the API response at this point anymore since it would break the parsing for everyone using it. Ideally this should have been caught during CR so we could have perhaps populated an x-header instead of the response body. For now I would suggest to handle the total_managed_indices explicitly in your parsing logic and perhaps we can look into supporting a v2 version of the API with the suggested format and keep around the v1 for users still using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants