弹性搜索,function_score SearchPhaseExecutionException
elasticsearch, function_score SearchPhaseExecutionException
我按照本page最后部分的教程进行操作。
POST /merchantindex/_search
{
"function_score": {
"query": {
{"query_string": { "query": "test"}}
},
"functions": [
{
"script_score":
{
"script": "return _score;"
}
}
]
}
}
我期待相关分数的返回。我想用 _score 做一些处理,例如_score * 一些其他的东西,但我只是在尝试代码现在是否有效。
我得到的错误是
"error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed;...
这个错误:
"error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed;...
通常意味着您的查询格式有误。
如果您检查查询,您会发现 query
和 query_string
之间有两个花括号:
"query": { {"query_string":
另外 function_score
需要位于查询内,functions
需要位于 function_score
.
内
试试这个:
curl -XPOST "http://localhost:9200/merchantindex/_search" -d '
{
"query": {
"function_score" : {
"query" :{
"query_string": { "query": "test"}
},
"functions": [
{
"script_score": {
"script": "return _score;"
}
}
]
}
}
}'
我按照本page最后部分的教程进行操作。
POST /merchantindex/_search
{
"function_score": {
"query": {
{"query_string": { "query": "test"}}
},
"functions": [
{
"script_score":
{
"script": "return _score;"
}
}
]
}
}
我期待相关分数的返回。我想用 _score 做一些处理,例如_score * 一些其他的东西,但我只是在尝试代码现在是否有效。
我得到的错误是
"error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed;...
这个错误:
"error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed;...
通常意味着您的查询格式有误。
如果您检查查询,您会发现 query
和 query_string
之间有两个花括号:
"query": { {"query_string":
另外 function_score
需要位于查询内,functions
需要位于 function_score
.
试试这个:
curl -XPOST "http://localhost:9200/merchantindex/_search" -d '
{
"query": {
"function_score" : {
"query" :{
"query_string": { "query": "test"}
},
"functions": [
{
"script_score": {
"script": "return _score;"
}
}
]
}
}
}'