Cross Cluster Search search parent children relation


(bharat) #1

Hi,

I have two cluster named is "cluster1" and "cluster2". Both cluster has Elasticsearch 5.4 version.
Cluster1 have 2 data node and 1 master
Cluster2 have 2 data node and 1 master

and I put same mapping on both cluster but i stored parent data on cluster1 and children data on cluster2

But when i search query on cluster1 with children query then it is not working.

Cross cluster setting is
I put below setting on cluster2 on each nodes

curl -XPUT '127.0.0.1:9200/_cluster/settings?pretty' -H 'Content-Type: application/json' -d'{ "persistent" : { "indices.recovery.max_bytes_per_sec" : "50mb"}}'

And on cluster2

PUT _cluster/settings
  {
   "persistent": {
     "search": {
       "remote": {
         "cluster1": {
           "seeds": ["127.1.0.1:9300"]
         },
         "cluster2": {
           "seeds": ["127.1.0.1:9300"]
         }
       }
     }
   }
  }

I have index testindex and type is user

PUT /testindex/
{
   "analysis": {
    "analyzer": {
      "string_lowercase": {
          "tokenizer": "keyword",
          "filter": "lowercase"
      }
    }
   }



PUT /testindex/_mapping/order
{
         "order": {
            "_parent": {
               "type": "user"
            },
            "_routing": {
               "required": true
            },
            "dynamic_templates": [
               {
                  "string_template": {
                     "mapping": {
                        "type": "string",
                        "index": "analyzed",
                        "analyzer": "string_lowercase"
                     },
                     "match": "*",
                     "match_mapping_type": "string"
                  }
               }
            ],
            "properties": {
               "projectId": {
                  "type": "long"
               }
   
            }
         }
      }


PUT /testindex/user/_mapping
{
   "user": {
    "_routing": {
      "required": true 
    },
    "properties": {
       "projectId": {
                  "type": "long"
               }
   }
}

And i put data on cluster1

PUT testindex/user/10?routing=10
{
  "projectId":"10"
}

And on cluster2

PUT testindex/order/30932_1?routing=10&parent=10
              {
               "clientOrderId": "1",
               "createdTime": "2015-10-06T11:46:00",
               "projectId": 10,
               "userId": "10",
               "name":"second order"
            }



PUT testindex/order/30932_2?routing=10&parent=10
              {
               "clientOrderId": "2",
               "createdTime": "2015-10-06T11:46:00",
               "projectId": 10,
               "userId": "10",
               "name":"second order" 
            }

My query is

GET *:testindex/user/_search
{
   "query": {
      "bool": {
         "must": [
            {
               "match": {
                  "name": "bharat"
               }
            },
            {
               "has_child": {
                  "type": "order",
                  "query": {
                     "bool": {
                        "must": [
                           {
                              "match": {
                                 "projectId": 10
                              }
                           }
                        ]
                     }
                  }
               }
            }
         ]
      }
   }
}

Please help me to search query with children on cluster1.

Thanks in advance


(Mark Walkom) #2

You cannot do that. P/C requires documents to be in the same shard, thus in the same cluster.


(system) #3

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