Dad*_*Moe 6 sorting parent parent-child elasticsearch
到目前为止,我可以过滤父母与孩子,并对儿童领域的反应进行排序,就像一个魅力.见下文.
GET /parent_child_meta_poc/paren_doc/_search
{
"query": {
"has_child": {
"inner_hits": {},
"type": "most_read_doc",
"query": {
"function_score": {
"functions": [
{
"field_value_factor": {
"factor": 1,
"field": "read_count"
}
}
]
}
},
"score_mode": "avg"
}
}
}
Run Code Online (Sandbox Code Playgroud)
资料来源:Matts要点
子映射示例:
{
"mappings": {
"most_read_doc": {
"_parent": {
"type": "paren_doc"
},
"properties": {
"parent_uri": {
"type": "string"
},
"read_count": {
"type": "long"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,这种限制来自于以下要求:
向我提供符合此搜索条件的所有文档,仅返回具有子项"most_read_doc"的文档,并在"most_read_doc.read_count"上对返回的父文档进行排序
基本上我想:
父/子似乎没有达到1.在任何类型的查询导致"嵌套:QueryParsingException ...没有为[functions]注册的查询]"异常.根据我的搜索,没有正式的Elasticsearch解决方案.到目前为止,努力寻找一个可行的工作......
其他类似的:
注意:我不能使用嵌套文档/将"read_count"与父项合并,因为我有两个系统对此索引应用更新.
| 归档时间: |
|
| 查看次数: |
1097 次 |
| 最近记录: |