Cross cluster search fails depending on characters used in index name and alias

Hello .

Is there any characters that may not be used in index name (or alias name) when using cross cluster search ?
I was not able to use hyphen on remote index.

Environment

1.2 clusters
asia-northeast1-a
asia-northeast1-b

2.1node for asia-northeast1-a and 3 nodes for asia-northeast1-b
For asia-northeast1-a

[xxx@es-asia-northeast1-a-1 ~]$ curl -XGET  -H 'Content-Type: application/json' localhost:9200/_cat/nodes -s  | sort -k10
10.146.0.2 11 54 0 0.00 0.01 0.05 mdi * es-asia-northeast1-a-1

For asia-northeast1-b

[xxx@es-asia-northeast1-b-1 ~]$ curl -XGET  -H 'Content-Type: application/json' localhost:9200/_cat/nodes -s  | sort -k10
10.146.0.3 15 55 0 0.04 0.03 0.17 mdi - es-asia-northeast1-b-1
10.146.0.5 15 57 0 0.00 0.01 0.10 mdi - es-asia-northeast1-b-2
10.146.0.6 12 61 0 0.00 0.02 0.12 mdi * es-asia-northeast1-b-3

3.es version

[xxx@es-asia-northeast1-a-1 ~]$ curl -XGET -H 'Content-Type: application/json' localhost:9200
{
  "name" : "es-asia-northeast1-a-1",
  "cluster_name" : "asia-northeast1-a",
  "cluster_uuid" : "GWXxdPkUTUe0_rXBAyWv9Q",
  "version" : {
    "number" : "6.2.3",
    "build_hash" : "c59ff00",
    "build_date" : "2018-03-13T10:06:29.741383Z",
    "build_snapshot" : false,
    "lucene_version" : "7.2.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

Situation

I have an index on asia-northeast1-b with a single document.

[xxx@es-asia-northeast1-b-1 ~]$ curl -XGET -H 'Content-Type: application/json' localhost:9200/_cat/indices?v
health status index     uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   new-index DLpyOaM8Rh-T5aW5L-I-zg   5   1          1            0      8.8kb          4.4kb

I also have an alias defined to it.

[xxx@es-asia-northeast1-b-1 ~]$ curl -XGET  -H 'Content-Type: application/json' localhost:9200/_alias?pretty
{
  "new-index" : {
    "aliases" : {
      "asia-northeast1-b:new" : { }
    }
  }
}

Search works fine when searched locally.

[xxx@es-asia-northeast1-b-1 ~]$ curl -XGET  -H 'Content-Type: application/json' localhost:9200/asia-northeast1-b:new/_search?pretty
{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "new-index",
        "_type" : "newtype",
        "_id" : "4PlsimIBUF0WWWbrxHf7",
        "_score" : 1.0,
        "_source" : {
          "newfield" : "hello"
        }
      }
    ]
  }
}

However, search fails when cross cluster search is used.
In this case , from asia-northeast1-a to asia-northeast1-b

[xxx@es-asia-northeast1-a-1 ~]$ curl -XGET -H 'Content-Type: application/json' localhost:9200/asia-northeast1-b:new/_search?pretty
{
  "error" : {
    "root_cause" : [
      {
        "type" : "index_not_found_exception",
        "reason" : "no such index",
        "index_uuid" : "_na_",
        "resource.type" : "index_or_alias",
        "resource.id" : "new",
        "index" : "new"
      }
    ],
    "type" : "transport_exception",
    "reason" : "unable to communicate with remote cluster [asia-northeast1-b]",
    "caused_by" : {
      "type" : "index_not_found_exception",
      "reason" : "no such index",
      "index_uuid" : "_na_",
      "resource.type" : "index_or_alias",
      "resource.id" : "new",
      "index" : "new"
    }
  },
  "status" : 500
}

Remote cluster is registered properly on asia-northeast1-a .

[xxx@es-asia-northeast1-a-1 ~]$ curl -XGET -H 'Content-Type: application/json' localhost:9200/_remote/info?pretty
{
  "asia-northeast1-b" : {
    "seeds" : [
      "10.146.0.3:9300"
    ],
    "http_addresses" : [
      "10.146.0.3:9200",
      "10.146.0.6:9200",
      "10.146.0.5:9200"
    ],
    "connected" : true,
    "num_nodes_connected" : 2,
    "max_connections_per_cluster" : 3,
    "initial_connect_timeout" : "30s",
    "skip_unavailable" : false
  }
}

UPDATE

Below case worked.

Index name : newindex , alias : asia-northeast1-b:newindex

[xxx@es-asia-northeast1-b-1 ~]$ curl -XGET  -H 'Content-Type: application/json' localhost:9200/_alias?pretty
{
  "new-index" : {
    "aliases" : {
      "asia-northeast1-b:new" : { }
    }
  },
  "newindex" : {
    "aliases" : {
      "asia-northeast1-b:new2" : { },
      "asia-northeast1-b:newindex" : { }
    }
  }
}

Cross cluster search result,

[xxx@es-asia-northeast1-a-1 ~]$ curl -XGET -H 'Content-Type: application/json' localhost:9200/asia-northeast1-b:newindex/_search?pretty -d '{ "size" : 1 }'
{
  "took" : 22,
  "timed_out" : false,
  "_shards" : {
    "total" : 3,
    "successful" : 3,
    "skipped" : 0,
    "failed" : 0
  },
  "_clusters" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0
  },
  "hits" : {
    "total" : 7,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "asia-northeast1-b:newindex",
        "_type" : "newtype",
        "_id" : "WxcUimIB01qZ7AJhPXCS",
        "_score" : 1.0,
        "_source" : {
          "newfield" : "Creationline3"
        }
      }
    ]
  }
}

However, when alias name is a mixture of alphanumeric , it fails.

Index name : newindex , alias : asia-northeast1-b:new2

[xxx@es-asia-northeast1-a-1 ~]$ curl -XGET -H 'Content-Type: application/json' localhost:9200/asia-northeast1-b:new2/_search?pretty -d '{ "size" : 1 }'
{
  "error" : {
    "root_cause" : [
      {
        "type" : "index_not_found_exception",
        "reason" : "no such index",
        "index_uuid" : "_na_",
        "resource.type" : "index_or_alias",
        "resource.id" : "new2",
        "index" : "new2"
      }
    ],
    "type" : "transport_exception",
    "reason" : "unable to communicate with remote cluster [asia-northeast1-b]",
    "caused_by" : {
      "type" : "index_not_found_exception",
      "reason" : "no such index",
      "index_uuid" : "_na_",
      "resource.type" : "index_or_alias",
      "resource.id" : "new2",
      "index" : "new2"
    }
  },
  "status" : 500
}

I was misunderstanding the index naming concept of cross cluster search. I thought that actual index name needs to have the cluster alias included. However , this is not necessary.

To search the twitter index on remote cluster cluster_one the index name must be prefixed with the cluster alias separated by a : character:

Removing all the alias and now it works.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.