Unable to do cross cluster replication , Please help here

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 .

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

Which version of Elasticsearch you are using?

Hi @Christian_Dahlqvist I am using 7.1 version

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.

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

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??

@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

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

Should give you errors something like

{
  "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

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

Which creates and error like you are seeing...

{
  "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.

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.

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 ?

Cross-cluster replication is a commercial feature, so you will need commercial licences for all involved clusters. It will naturally also work temporarily with a Trial license.

Thanks @Christian_Dahlqvist and @stephenb for the above information :slight_smile:

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