【发布时间】:2014-09-03 22:37:30
【问题描述】:
有没有办法提升来自has_parent 查询的文档?
{
"query": {
"function_score": {
"query": {
"bool": {
"should": [
{
"multi_match": {
"fields": ["name^3", "tags^2", "content"],
"query": "xx"
}
},
{
"has_parent": {
"type": "theparent",
"query": {
"multi_match": {
"type": "best_fields",
"fields": ["name^5", "content"],
"query": "xx"
}
}
}
},
{
"has_child": {
"type": "thechild",
"query": {
"multi_match": {
"fields": ["name^3","content"],
"query": "xx"
}
}
}
}
]
}
},
"score_mode": "sum",
"functions": [
{
"linear": {
"date": {
"origin": "2014-08-29",
"scale": "700d",
"decay": 0.6
}
}
}
]
}
}
更准确地说,我只想在查询与父级的名称字段匹配时提升这些文档
(我还没有找到一种方法来引用 functions 中的父字段,即 theparent._source.name ~= "xx")
【问题讨论】:
标签: elasticsearch