эластичный поиск родительско-дочерних отношений - PullRequest
0 голосов
/ 05 января 2019

Попытка выяснить концепции и синтаксис для достижения родительско-дочерних отношений с использованием эластичной версии 6.0

PUT my_index
{
  "mappings": {
    "_doc": {
      "properties": {
        "my_join_field": {
          "type": "join",
          "relations": {
            "parentx": "childx",
            "parenty": "childy"
          }
        }
      }
    }
  }
}

PUT my_index/_doc/101?refresh
{
  "text": "This is a question",
  "my_join_field": {
    "name": ["parentx","parenty" ]
  }
}

PUT my_index/_doc/102?routing=101&refresh
{
  "text": "This is an answer",
  "my_join_field": {
    "name": "childx", 
    "parent": "101" 
  }
}

PUT my_index/_doc/103?routing=101&refresh
{
  "text": "This is another answer",
  "my_join_field": {
    "name": "childy",
    "parent": "101"
  }
}

GET my_index/_search
GET my_index/_search?routing=101

#so far so good

Но

GET my_index/_search?routing=101
{
  "query": {
    "has_child": {
      "type": "childx",
      "query": {
        "match_all": {}
      },
      "inner_hits": {}
    }
  }
}

не возвращает результатов Почему?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...