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

[Feature] Cross cluster field mappings query #6573

Open
seankao-az opened this issue Mar 7, 2023 · 3 comments
Open

[Feature] Cross cluster field mappings query #6573

seankao-az opened this issue Mar 7, 2023 · 3 comments
Labels
enhancement Enhancement or improvement to existing feature or request extensions

Comments

@seankao-az
Copy link

seankao-az commented Mar 7, 2023

Is your feature request related to a problem? Please describe.
Yes. We’re trying to support cross cluster search in the OpenSearch sql plugin. As part of our sql and ppl query execution flow, some metadata is required for query analysis and plan generation. We need field mappings for each index at remote clusters.

Related issue: opensearch-project/sql#789

Here are some example responses of REST api for mappings request. Though we will not be using the REST api directly for our use case, this shows the problem more clearly:

  • GET /remote-cluster:index/_mappings
{
    "error": {
        "root_cause": [
            {
                "type": "index_not_found_exception",
                "reason": "no such index [ccs-cluster:index]",
                "index": "ccs-cluster:index",
                "resource.id": "ccs-cluster:index",
                "resource.type": "index_or_alias",
                "index_uuid": "_na_"
            }
        ],
        "type": "index_not_found_exception",
        "reason": "no such index [ccs-cluster:index]",
        "index": "ccs-cluster:index",
        "resource.id": "ccs-cluster:index",
        "resource.type": "index_or_alias",
        "index_uuid": "_na_"
    },
    "status": 404
}
  • GET /*:index/_mappings
{
}

A side note on the second request: it returns nothing, which we consider a bug.

Describe the solution you'd like
We need some transport layer actions to support querying field mappings on cross clusters. We have no clear solution on how to achieve that. The requirement is that we can, for example, provide indices name with cross cluster syntax (*:index, ccs-cluster:index) for get mappings requests. For example, in this function.

Describe alternatives you've considered
We could get such info by making individual connections to each of the remote clusters, but that defeats the purpose of using cross cluster search in the first place. Following this path, we’ll also have to reinvent the wheel of cluster name resolving and request re-routing.

Additional context
Some context on how we’re querying field mappings currently:

@seankao-az seankao-az added enhancement Enhancement or improvement to existing feature or request untriaged labels Mar 7, 2023
@minalsha
Copy link
Contributor

@mch2 , @andrross. This requires some more deep dive. Can this be done without field mappers not registered on a cluster? This we think would be possible with Extensions, however this would be long term. cc @dagneyb

@vamsimanohar
Copy link
Member

Want to revive this issue, as we are planning to develop cross cluster tracing solutions.
cc: @anirudha @msfroh

@msfroh
Copy link
Collaborator

msfroh commented Oct 22, 2024

One thought is that you have a NodeClient from the plugin, which has the following method:

    @Override
    public Client getRemoteClusterClient(String clusterAlias) {
        return remoteClusterService.getRemoteClusterClient(threadPool(), clusterAlias);
    }

Of course, you'd still need to piece out the cluster alias from the index name. It would be nice if TransportGetMappingsAction could transparently search remote clusters the way that TransportSearchAction does.

Actually, while digging a big, I learned about the field capabilities (or _field_caps) API, which may give you exactly the mapping info that you're looking for. As a bonus, it looks like it already does have cross-cluster fetching:

// this is the cross cluster part of this API - we force the other cluster to not merge the results but instead
// send us back all individual index results.
for (Map.Entry<String, OriginalIndices> remoteIndices : remoteClusterIndices.entrySet()) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request extensions
Projects
None yet
Development

No branches or pull requests

4 participants