为了更新使用旧版本的ES(v0.94之前的版本)创建的查询,我会看到一个名为这样的查询:
json.query.bool.should = [
{
"custom_filters_score" : {
"query": {
"match_all" : {}
},
"filters": filters,
"score_mode" : "multiply"
}
}
];
我正在尝试将此更新到最新的function_score,但我发现文档并不完全清楚某些字段,我的非功能性尝试:
json.query.bool.should = [
{
"function_score" : {
"query": {
"match_all" : {}
},
"functions": filters,
"score_mode" : "multiply"
}
}
];
过滤器
var filters = [
{
"filter":{
"numeric_range" : {
"population" : {
"from" : "1000"
}
}
},
"boost":2
},
{
"filter":{
"numeric_range" : {
"population" : {
"from" : "10000"
}
}
},
"boost":5
},
{
"filter":{
"numeric_range" : {
"population" : {
"from" : "100000"
}
}
},
"boost":3
}
];
从“过滤器”中删除“提升”并尝试呼叫后,我遇到此错误:
Query Failed [Failed to execute main query]]; nested: NullPointerException; }]","status":500}
我尝试从“过滤器”中删除“提升”,并按原样发送,但我仍然无法转换查询,我想更新此内容而不是回到旧版本的ES。
欢迎任何建议。