gpt4 book ai didi

elasticsearch - Elastic Search Function Score Query 添加 multi_match

转载 作者:行者123 更新时间:2023-11-29 02:52:11 25 4
gpt4 key购买 nike

目前,我只是查询存储在 Elasticsearch 中的网页的“内容”以查找关键字匹配。我想为该等式添加标题。我正在使用顶部代码(在“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" ]
}
}

提前致谢!

最佳答案

经过反复试验,我想通了,它看起来是这样的:

{
"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"
}

关于elasticsearch - Elastic Search Function Score Query 添加 multi_match,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29124989/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com