我用弹性搜索代码进行搜索:
es.search(index="article-index", fields="url", body={
"query": {
"query_string": {
"query": "keywordstr",
"fields": [
"text",
"title",
"tags",
"domain"
]
}
}
})
现在我想在搜索评分中插入另一个参数-“recencyboost”。在
我被告知功能性得分应该能解决问题
^{pr2}$这给了我一个错误:字典{"query_string": {"query": keywordstr}}
不可哈希。在
1)如何修复错误?在
2)如何改变衰变函数,使其赋予更高的近期提升权重?在
你的搜索中似乎有一个额外的} 作为顶层键。在
query
(总共三个),这给了你一个不需要的顶层。您需要删除顶层query
,并将其替换为^{注意:
score_mode
默认为"multiply"
,未使用的boost_mode
也是如此,因此不需要提供它。在你不能用字典作为字典中的键。您将在以下代码段中执行此操作:
下面的工作应该很好
^{pr2}$像这样用
相关问题 更多 >
编程相关推荐