我试图使用弹性搜索来提升查询。最近公布的头条新闻必须得到提升,并且应该是最重要的。但是,我已经返回以下代码:
{
"query": {
"function_score": {
"query": {
"bool": {
"must": {
"match": {
"keywords": {
"query":"trump"
}
}
},
"should": [
{ "match": {
"type": {
"query": "headline"
}
}}
]}},
"functions": [
{ "boost": 5 },
{
"gauss": {
"versioncreated": {
"origin": "now/d",
"scale": "50w",
"offset": "4w",
"decay": "0.5"
}}}],
"score_mode": "sum"
}
}}
我收到此错误: -
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "no [score_function] registered for [params]",
"line": 24,
"col": 20
}
],
"type": "parsing_exception",
"reason": "no [score_function] registered for [params]",
"line": 24,
"col": 20
},
"status": 400
}
答案 0 :(得分:0)
你查询有点不对劲。你想做什么呢?
lookup()
如果您想提升它,请尝试使用此查询
"functions": [
{ "boost": 5 },