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] Cluster State API is undocumented and unavailable in clients #3784

Open
dbwiddis opened this issue Apr 11, 2023 · 4 comments
Open

[BUG] Cluster State API is undocumented and unavailable in clients #3784

dbwiddis opened this issue Apr 11, 2023 · 4 comments
Labels
1 - Backlog Issue: The issue is unassigned or assigned but not started Sev2 High-medium priority. Upcoming release or incorrect information.

Comments

@dbwiddis
Copy link
Member

dbwiddis commented Apr 11, 2023

Describe the bug

Coming from opensearch-project/OpenSearch#7066 (comment)

Internally to OpenSearch, the cluster state is retrieved by handling the ClusterStateAction / TransportClusterStateAction / ClusterStateRequest / ClusterStateResponse implementations. The RestClusterStateAction exposes the API (?) as:

  • /_cluster/state
  • /_cluster/state/{metric}
  • /_cluster/state/{metric}/{indices}

However, there is no (0 / zero / null) documentation of this API on the OpenSearch website. Entering "/_cluster/state" in the search bar at https://opensearch.org/ gives 17 responses, out of which zero contain the text "/_cluster/state".

Entering "/_cluster/state" and "OpenSearch" as key words into your favorite search engine give no results on https://opensearch.org/ (other than one of the previous 17 that doesn't actually include that text). There are some third-party references to the API, a reference to the API at ElasticSearch, and inclusion as a "common" API request on AOS documentation page.

More importantly, this "API" is not accessible via OpenSearch clients. Clients are spec-driven, but the Cluster APIs do not include it. While it's possible to reverse-engineer the ClusterStateRequest to construct a raw endpoint for performRequest() on the clients, the returned response is just JSON and parsing it into a ClusterStateResponse is an exercise in futility.

Expected behavior

  1. The API is documented on the OpenSearch website. (Definitely.)
  2. The ClusterStateRequest/ClusterStateResponse objects are usable in OpenSearch clients in all languages. (Maybe not, see comments below.)
@dbwiddis
Copy link
Member Author

But, I wonder if we want to expose all _cluster/state API constructs to clients. I foresee lot of challenges:

  1. To start with "custom" that you mentioned above. Plugins can add any custom data in cluster state and it would be breaking change if fromXContent is enforced. Also, plugins can choose not to send certain data in API response and mark it private.
  2. Today, these internal data structures are updated just thinking about server side backward compatibility. Now changing anything in those structures could potentially break clients and would result in too much overhead.
  3. If you look at the toXContent method of some of the classes you will notice, not all fields are serialized, only a subset which might not be sufficient to deserialize the object back to current ClusterState data structures. e.g. anywhere Index is serialized in routing information, only its name is serialized not Index UUID. Metadata classes have fromXContent already implemented as it is used to serde to and from disk as well.

I see this API more of helping in debugging and providing it as official Cluster APIs in client could cause lot of maintenance overhead. Until community feels the need with real use cases, we should refrain from exposing it.

Originally posted by @shwetathareja in opensearch-project/OpenSearch#7066 (comment)

@dblock
Copy link
Member

dblock commented Apr 13, 2023

Should we move this to documentation-website as a documentation bug?

@minalsha
Copy link

moving it to documentation-website repo as a documentation bug

@minalsha minalsha transferred this issue from opensearch-project/OpenSearch Apr 14, 2023
@Naarcha-AWS Naarcha-AWS added 1 - Backlog Issue: The issue is unassigned or assigned but not started Sev2 High-medium priority. Upcoming release or incorrect information. and removed bug Technical problem with the doc site or broken link untriaged labels May 1, 2023
@dbwiddis
Copy link
Member Author

Should we move this to documentation-website as a documentation bug?

@dblock this should probably be either moved to the api repo now, or closed if it's actually already been completed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Backlog Issue: The issue is unassigned or assigned but not started Sev2 High-medium priority. Upcoming release or incorrect information.
Projects
None yet
Development

No branches or pull requests

4 participants