خرید بک لینک

Vote count: 0

mapping:

    {
      "mappings": {
        "branch": {},
        "employee": {
          "_parent": {
            "type": "branch"
          }
        }
      }
   }

documents of branch:

{ "index": { "_id": "london" }}
{ "name": "London Westminster", "city": "London", "country": "UK" }
{ "index": { "_id": "liverpool" }}
{ "name": "Liverpool Central", "city": "Liverpool", "country": "UK" }
{ "index": { "_id": "paris" }}
{ "name": "Champs Élysées", "city": "Paris", "country": "France" }

documents of employee:

{ "index": { "_id": 1, "parent": "london" }}
{ "name": "Alice Smith", "dob": "1970-10-24", "hobby": "hiking" }

{ "index": { "_id": 2, "parent": "london" }}
{ "name": "Mark Thomas", "dob": "1982-05-16", "hobby": "diving" }

{ "index": { "_id": 3, "parent": "liverpool" }}
{ "name": "Barry Smith", "dob": "1979-04-01", "hobby": "hiking" }

{ "index": { "_id": 4, "parent": "paris" }}
{ "name": "Adrien Grand", "dob": "1987-05-11", "hobby": "horses" }

I want to find which documents have parent id london ,I tried the following query:

    {
    "query":{
       "has_parent":{
         "type":"branch",
         "query":{
           "term":{
               "_parent":"london"
           }
         } 
       }
     }

}

but ES retu no results.how to search child documents with the same parent id in Elasticsearch?

asked 59 secs ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 14 مرداد 1395 ساعت: 10:01

صفحه بندی