Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions docs/reference/cluster/remote-info.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,18 @@ Returns configured remote cluster information.
[[cluster-remote-info-api-desc]]
==== {api-description-title}

The cluster remote info API allows you to retrieve all of the configured
remote cluster information. It returns connection and endpoint information keyed
The cluster remote info API allows you to retrieve information about configured
remote clusters. It returns connection and endpoint information keyed
by the configured remote cluster alias.

TIP: This endpoint returns the information that reflects state on the cluster
you are querying. The `connected` field does not necessarily reflect whether
the remote cluster is down or unavailable, only whether there is currently an open
connection to it. Elasticsearch does not spontaneously try to reconnect to a
disconnected remote cluster. To trigger a reconnection, attempt a
<<modules-cross-cluster-search,{ccs}>>, <<esql-cross-clusters,{esql} {ccs}>>,
or try the <<indices-resolve-cluster-api,resolve cluster>> endpoint.


[[cluster-remote-info-api-response-body]]
==== {api-response-body-title}
Expand All @@ -39,7 +47,10 @@ by the configured remote cluster alias.
`proxy`.

`connected`::
True if there is at least one connection to the remote cluster.
True if there is at least one open connection to the remote cluster. When
false, it means that the cluster no longer has an open connection to the
remote cluster. It does not necessarily mean that the remote cluster is
down or unavailable, just that at some point a connection was lost.

`initial_connect_timeout`::
The initial connect timeout for remote cluster connections.
Expand Down
22 changes: 19 additions & 3 deletions docs/reference/indices/resolve-cluster.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ with this endpoint.

For each cluster in scope, information is returned about:

1. whether the querying ("local") cluster is currently connected to it
1. whether the querying ("local") cluster was able to connect to each remote cluster
specified in the index expression. Note that this endpoint actively attempts to
contact the remote clusters, unlike the <<cluster-remote-info,remote/info>> endpoint.
2. whether each remote cluster is configured with `skip_unavailable` as `true` or `false`
3. whether there are any indices, aliases or data streams on that cluster that match
the index expression (if one provided)
Expand All @@ -42,7 +44,7 @@ Once the proper security permissions are obtained, then you can rely on the `con
in the response to determine whether the remote cluster is available and ready for querying.
====

NOTE: When querying older clusters that do not support the _resolve/cluster endpoint
NOTE: When querying older clusters that do not support the `_resolve/cluster` endpoint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please add the exact version? For example we could say that this is introduced on 8.18

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Added in next push.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this PR needs to backport to 8.17.2 so this note doesn't belong here in this PR. I'll pull it out into a separate PR, since I need to do some docs changes for the new timeout param as well that also only goes back to 8.18.

without an index expression, the local cluster will send the index expression `dummy*`
to those remote clusters, so if an errors occur, you may see a reference to that index
expression even though you didn't request it. If it causes a problem, you can instead
Expand Down Expand Up @@ -150,11 +152,25 @@ that takes no index expression.

[discrete]
[[usecases-for-resolve-cluster]]
=== Test availability of remote clusters

The <<cluster-remote-info,remote/info>> endpoint is commonly used to test whether the "local"
cluster (the cluster being queried) is connected to its remote clusters, but it does not
necessarily reflect whether the remote cluster is available or not. The remote cluster may
be available, while the local cluster is not currently connected to it.

You can use this API to attempt to reconnect to remote clusters
(for example with `GET _resolve/cluster/*:*`) and
the `connected` field in the response will indicate whether it was successful or not.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still isn't true given the (IMO misguided) move to using FAIL_IF_DISCONNECTED. The connected field indicates whether the responding node was connected to the remote cluster at the start of the check. If it's disconnected at that point then we return connected: false and trigger a background connection attempt (unless one was already running) in the hope that some future call will eventually return connected: true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks David. Pawan and I discussed this last week and came to a similar conclusion. We're going to revert #119516 in favor of another approach. We identified a couple of options and Pawan is going to follow up with the distributed team on some of the options that are thinking of. Once that's decided, I'll revise this PR according to the new model.

If a connection was (re-)established, this will also cause the
<<cluster-remote-info,remote/info>> endpoint to now indicate a connected status.


=== Advantages of using this endpoint before a {ccs}

You may want to exclude a cluster or index from a search when:

1. A remote cluster is not currently connected and is configured with `skip_unavailable`=`false`.
1. A remote cluster could not be connected to and is configured with `skip_unavailable`=`false`.
Executing a {ccs} under those conditions will cause
<<cross-cluster-search-failures,the entire search to fail>>.

Expand Down