Changing local connections

As when changing remote connections you need an id of the local connection to change it. To list all connections for a multi-cluster view, both remote and local, you can do

graphql
query {
  searchDomain(name: "myMultiClusterView") {
    ... on View {
      remoteConnections {
        id
        ... on RemoteClusterConnection {
          publicUrl
        }
        ... on LocalClusterConnection {
          targetViewId
        }
      }
    }
  }
}

This will output the list of connections, with the local connections listed at the end:

graphql
{
  "data": {
    "searchDomain": {
      "remoteClusterConnection": {
        "id": "CW8ppOz5CUfabsT7zB5dKIRs05DqIHuR",
        "publicUrl": "https://remotelogscale2.com/"
      }, {
        "id": "lsQxFIyq0zU6LklhEJ2CkH4M7hQHEYOR",
        "targetViewId": "kvTm4oht5pOUqEQUK58h0wNk"
      }
    }
  }
}

The output indicates the connection id of the local connection: lsQxFIyq0zU6LklhEJ2CkH4M7hQHEYOR. To change which view it points to you can run this mutation:

graphql
mutation {
  updateLocalClusterConnection(
    input: {
      multiClusterViewName: "myMultiClusterView"
      connectionId: "lsQxFIyq0zU6LklhEJ2CkH4M7hQHEYOR"
      targetViewName: "humio-metrics"
    }
  )
}

After this the view will include data from humio-metrics rather than humio. To check that the change has been applied you can do,

graphql
query {
  searchDomain(name: "myMultiClusterView") {
    remoteClusterConnection(id: "lsQxFIyq0zU6LklhEJ2CkH4M7hQHEYOR") {
      id
      ... on LocalClusterConnection {
        targetViewId
      }
    }
  }
}

This will return the connection information:

graphql
{
  "data": {
    "searchDomain": {
      "remoteClusterConnection": {
        "id": "lsQxFIyq0zU6LklhEJ2CkH4M7hQHEYOR",
        "targetViewId": "to1amS163Pb6FH1PNv3JVjYG"
      }
    }
  }
}

Local connections identify their target view by id, not name, so you get the id of humio-metrics as the value of targetViewId instead of the name. If you want to be absolutely sure the value is correct you can do

graphql
query {
  searchDomain(name: "humio-metrics") {
    id
  }
}

In this case it generates the ID for the view:

graphql
{
  "data": {
    "searchDomain": {
      "id": "to1amS163Pb6FH1PNv3JVjYG"
    }
  }
}

This matches the value for targetViewId that we identified earlier.