美文网首页
5.5 父子关系文档

5.5 父子关系文档

作者: 秦汉邮侠 | 来源:发表于2020-05-23 23:54 被阅读0次

Mappings and Text Analysis

  • Configure an index that implements a parent/child relationship

如何检索

  • image.png
  • datatype属于join

示例

PUT my_index
{
  "mappings": {
    "properties": {
      "my_join_field": { 
        "type": "join",
        "relations": {
          "question": "answer" 
        }
      }
    }
  }
}

PUT my_index/_doc/1?refresh
{
  "text": "This is a question",
  "my_join_field": {
    "name": "question" 
  }
}

PUT my_index/_doc/2?refresh
{
  "text": "This is another question",
  "my_join_field": "question"
}


PUT my_index/_doc/3?routing=1&refresh=true
{
  "text": "This is an answer",
  "my_join_field": {
    "name": "answer", 
    "parent": "1" 
  }
}

PUT my_index/_doc/4?routing=1&refresh=true
{
  "text": "This is another answer",
  "my_join_field": {
    "name": "answer",
    "parent": "1"
  }
}
  • name属性是写死的,不可变更,或者完全不写

相关文章

网友评论

      本文标题:5.5 父子关系文档

      本文链接:https://www.haomeiwen.com/subject/tfdrahtx.html