目前,我只查询存储在弹性搜索中的关键字匹配网页的“内容”。我想在这个等式中添加标题。我正在使用顶级代码(在“MARRY THIS”下),并希望以某种方式插入底部代码(“WITH THIS”),但似乎无法找到有关如何执行此操作的说明。
MARRY THIS
{
"query": {
"function_score": {
"query": {
"match": {
"content": "keyword"
}
},
"functions": [{
"field_value_factor": {
"field": "obls",
"factor": 0.5,
"modifier": "ln2p"
}
}]
}
},
"from": "0",
"size": "100"
}
WITH THIS
{
"multi_match" : {
"query": "keyword",
"fields": [ "title^3", "content" ]
}
}
提前致谢!
答案 0 :(得分:2)
经过大量的反复试验后,我想出来了,看起来像这样:
{
"query": {
"function_score": {
"query": {
"multi_match": {
"query": "baseball",
"fields": ["content", "title"]
}
},
"functions": [{
"field_value_factor": {
"field": "obls",
"factor": 0.5,
"modifier": "ln2p"
}
}]
}
},
"from": "10",
"size": "100"
}