# Unable to do cross cluster replication , Please help here

**URL:** https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345
**Category:** Elasticsearch
**Tags:** ccr-cross-cluster-replication
**Created:** [March 23, 2023, 11:52am UTC](https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345 "2023-03-23T11:52:41Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![JayaPavani\_Pathakota](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jayapavani_pathakota/32/117707_2.png) [@JayaPavani\_Pathakota](https://discuss.elastic.co/u/JayaPavani_Pathakota)
#### Post date: [March 23, 2023, 11:52am UTC](https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345/1 "2023-03-23T11:52:41Z")

</div>

I created two clusters in 2 data centers and I am trying to do cross cluster replication , in one of the cluster I configured leader index and in the other I did the remote configuration pointing to the cluster of leader index , in the final step of creating follower index I am getting some issues .

```auto
PUT /my-test-index-follower/_ccr/follow
{
  "remote_cluster" : "leader",
  "leader_index" : "my-test-index"
}

Error 

{
  "error": {
    "root_cause": [
      {
        "type": "invalid_type_name_exception",
        "reason": "Document mapping type name can't start with '_', found: [_ccr]"
      }
    ],
    "type": "invalid_type_name_exception",
    "reason": "Document mapping type name can't start with '_', found: [_ccr]"
  },
  "status": 400
}

I gave all permissions in my roles.yml file 

list_indices:
  reserved: false
  hidden: false
  static: false
  cluster_permissions:
   - "cluster:*"
  index_permissions:
  - index_patterns:
    - '*'
    allowed_actions:
    - "indices:*"
    - "read"
    - "indices:monitor/stats"
    - "indices:data/write/index"

And gave this role in roles_mapping.yml

list_indices:
  reserved: true
  hidden: false
  backend_roles:
  - "list_indices"
  users:
    - '*'

```

Can anyone please help me here

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [March 23, 2023, 12:25pm UTC](https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345/2 "2023-03-23T12:25:36Z")

</div>

Which version of Elasticsearch you are using?

---

<div class="post-metadata">

### Author: ![JayaPavani\_Pathakota](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jayapavani_pathakota/32/117707_2.png) [@JayaPavani\_Pathakota](https://discuss.elastic.co/u/JayaPavani_Pathakota)
#### Post date: [March 23, 2023, 1:21pm UTC](https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345/3 "2023-03-23T13:21:49Z")

</div>

Hi @Christian_Dahlqvist I am using 7.1 version

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [March 23, 2023, 1:43pm UTC](https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345/4 "2023-03-23T13:43:21Z")

</div>

I would recommend upgrading at least to 7.17 as a lot of fixes and improvements have been made since the very old version you are using was released.

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [March 23, 2023, 1:59pm UTC](https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345/5 "2023-03-23T13:59:42Z")

</div>

> [@JayaPavani\_Pathakota](#):
>
> Hi @Christian_Dahlqvist I am using 7.1 version

For both?

Can you share the mapping for the leader index?

And I agree you should really upgrade to lastest many many fixes to ccr

---

<div class="post-metadata">

### Author: ![JayaPavani\_Pathakota](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jayapavani_pathakota/32/117707_2.png) [@JayaPavani\_Pathakota](https://discuss.elastic.co/u/JayaPavani_Pathakota)
#### Post date: [March 24, 2023, 5:09am UTC](https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345/6 "2023-03-24T05:09:42Z")

</div>

Hi @stephenb ,

Yess I am using 7.1.1 version for both my clusters.

Steps I performed

1.In remote cluster I configured a leader index

PUT /my-test-index  
{  
"settings": {  
"index.soft\_deletes.enabled" : true,  
"index": {  
"number\_of\_replicas": 2  
}  
}  
}

2.In local cluster , I did remote config

PUT \_cluster/settings  
{  
"persistent" : {  
"cluster" : {  
"remote" : {  
"leader" : {  
"seeds" : [  
"10.85.103.24:48789"  
]  
}  
}  
}  
}  
}

and they both are connected

"connected" : true,  
"num\_nodes\_connected" : 2,  
"max\_connections\_per\_cluster" : 3,  
"initial\_connect\_timeout" : "30s",  
"skip\_unavailable" : false

And the last step when I am trying to create follower index as mentioned above I am getting error , I shared my roles.yml file and roles\_mapping.yml , Can you please help here , do I need to do any additional configurations like enabling Xpack??

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [March 24, 2023, 5:48am UTC](https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345/7 "2023-03-24T05:48:16Z")

</div>

@JayaPavani_Pathakota

**Please** format your code using the `</>` button going forward it only takes a minutes, I did it for you on your first post so we could even read it.

There is something else fundamental going on....

You are getting a mapping error

This command

```auto
PUT /my-test-index-follower/_ccr/follow
{
  "remote_cluster": "leader",
  "leader_index": "my-test-index"
}

```

Should give you errors something like

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "no_such_remote_cluster_exception",
        "reason" : "no such remote cluster: [leader]"
      }
    ],
    "type" : "no_such_remote_cluster_exception",
    "reason" : "no such remote cluster: [leader]"
  },
  "status" : 404
}

```

But you are getting and error like you are trying to post a document

```auto
POST /test-index/_ccr
{
  "foo": "bar"
}

```

Which creates and error like you are seeing...

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "invalid_type_name_exception",
        "reason": "Document mapping type name can't start with '_', found: [_ccr]"
      }
    ],
    "type": "invalid_type_name_exception",
    "reason": "Document mapping type name can't start with '_', found: [_ccr]"
  },
  "status": 400
}

```

So check that you are actually running the right commands

With respect to the roles ...

I would try to get it using with the `elastic` user first and if you can do that... then try with restricted roles.

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [March 24, 2023, 6:24am UTC](https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345/8 "2023-03-24T06:24:10Z")

</div>

If Elasticsearch interprets `_ccr` as a document type I suspect you do not have X-Pack installed and enabled on all nodes. This is no longer an issue in more recent versions of Elasticsearch and one of the reasons I recommended upgrading.

---

<div class="post-metadata">

### Author: ![JayaPavani\_Pathakota](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jayapavani_pathakota/32/117707_2.png) [@JayaPavani\_Pathakota](https://discuss.elastic.co/u/JayaPavani_Pathakota)
#### Post date: [March 24, 2023, 6:24am UTC](https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345/9 "2023-03-24T06:24:14Z")

</div>

Hi @stephenb ,

Yes sure I will make sure to format my code , I tried with elastic:elastic but getting same error , I just need to know is it due to version I am using or Do I need to have licensed version of Xpack in my elastic Stack ?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [March 24, 2023, 6:25am UTC](https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345/10 "2023-03-24T06:25:32Z")

</div>

[Cross-cluster replication is a commercial feature](https://www.elastic.co/subscriptions), so you will need commercial licences for all involved clusters. It will naturally also work temporarily with a Trial license.

---

<div class="post-metadata">

### Author: ![JayaPavani\_Pathakota](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jayapavani_pathakota/32/117707_2.png) [@JayaPavani\_Pathakota](https://discuss.elastic.co/u/JayaPavani_Pathakota)
#### Post date: [March 24, 2023, 6:28am UTC](https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345/11 "2023-03-24T06:28:14Z")

</div>

Thanks @Christian_Dahlqvist and @stephenb for the above information 🙂

---

<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: [April 21, 2023, 6:28am UTC](https://discuss.elastic.co/t/unable-to-do-cross-cluster-replication-please-help-here/328345/12 "2023-04-21T06:28:18Z")

</div>

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