这join
是关于在 elasticsearch 中键入的示例。我有插入映射,父母和孩子:
PUT my_index
{
"mappings": {
"doc": {
"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 a another question",
"my_join_field": {
"name": "question"
}
}
PUT my_index/doc/1?refresh
{
"text": "This is a question",
"my_join_field": "question"
}
PUT my_index/doc/2?refresh
{
"text": "This is another question",
"my_join_field": "question"
}
现在我正在尝试按孩子搜索父母:
GET /my_index/doc/_search
{
"query": {
"has_child": {
"type": "my_join_field",
"query": {
"match" : {
"text": "question"
}
},
"ignore_unmapped": true
}
},
"highlight" : {
"fields" : {
"content" : {}
}
}
}
我没有得到任何结果。:( >:(
首先type
应该是什么字段???他们被告知类型已删除其次,我必须添加ignore_unmapped
(看这里)但仍然没有结果
那么如何通过has_child
查询elasticsearch示例中的数据来找到父级呢?