3
如何將下面的ES查詢轉換爲Java API?我使用的彈性搜索2.3.3如何將這個彈性搜索功能得分查詢轉換爲java API
GET /schema_name/_search
{
"from": 0,
"size": 200,
"query": {
"function_score": {
"query": {
"match_all": {}
},
"boost": "5",
"functions": [{
"filter": {
"term": {
"alert_code": "event_rule_1"
}
},
"weight": 50
},
{
"filter": {
"term": {
"alert_code": "event_rule_2"
}
},
"weight": 30
},
{
"filter": {
"term": {
"alert_code": "event_rule_3"
}
},
"weight": 10
},
{
"filter": {
"term": {
"alert_code": "event_rule_4"
}
},
"weight": 10
},
{
"filter": {
"term": {
"alert_code": "event_rule_5"
}
},
"weight": 50
},
{
"filter": {
"term": {
"alert_code": "event_rule_6"
}
},
"weight": 50
}
],
"max_boost": 50,
"score_mode": "max",
"boost_mode": "replace",
"min_score": 0
}
}
}
我已經嘗試過寫這ES查詢中使用的Java API使用下面 Elasticsearch FunctionScore query using Java API
鏈接,但下面的鏈接似乎是一個較舊的ES版和我無法在彈性搜索2.3.3中找到這些靜態函數。