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

**URL:** https://discuss.elastic.co/t/cross-cluster-search-fails-depending-on-characters-used-in-index-name-and-alias/126515
**Category:** Elasticsearch
**Created:** [April 3, 2018, 7:50am UTC](https://discuss.elastic.co/t/cross-cluster-search-fails-depending-on-characters-used-in-index-name-and-alias/126515 "2018-04-03T07:50:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![YuWatanabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuwatanabe/32/13259_2.png) [@YuWatanabe](https://discuss.elastic.co/u/YuWatanabe)
#### Post date: [April 3, 2018, 7:50am UTC](https://discuss.elastic.co/t/cross-cluster-search-fails-depending-on-characters-used-in-index-name-and-alias/126515/1 "2018-04-03T07:50:36Z")

</div>

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
  }
}
```

---

<div class="post-metadata">

### Author: ![YuWatanabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuwatanabe/32/13259_2.png) [@YuWatanabe](https://discuss.elastic.co/u/YuWatanabe)
#### Post date: [April 3, 2018, 8:09am UTC](https://discuss.elastic.co/t/cross-cluster-search-fails-depending-on-characters-used-in-index-name-and-alias/126515/2 "2018-04-03T08:09:35Z")

</div>

## 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
}
```

---

<div class="post-metadata">

### Author: ![YuWatanabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuwatanabe/32/13259_2.png) [@YuWatanabe](https://discuss.elastic.co/u/YuWatanabe)
#### Post date: [April 5, 2018, 7:57am UTC](https://discuss.elastic.co/t/cross-cluster-search-fails-depending-on-characters-used-in-index-name-and-alias/126515/3 "2018-04-05T07:57:05Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [May 3, 2018, 7:57am UTC](https://discuss.elastic.co/t/cross-cluster-search-fails-depending-on-characters-used-in-index-name-and-alias/126515/4 "2018-05-03T07:57:35Z")

</div>

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