update
This commit is contained in:
parent
ab3c9a769a
commit
01fa68af27
@ -188,6 +188,7 @@ class KBESService:
|
||||
index = KBConfig.KB_ES_INDEX
|
||||
url = f"{KBConfig.KB_ES_URL}/{index}/_search"
|
||||
|
||||
# 与线上排查/运维 curl 查询保持一致,避免 DSL 差异导致“bash 命中正确、API 命中错误”。
|
||||
query = {
|
||||
"size": KBConfig.KB_TOP_K,
|
||||
"track_total_hits": False,
|
||||
@ -206,29 +207,15 @@ class KBESService:
|
||||
"version",
|
||||
],
|
||||
"query": {
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"multi_match": {
|
||||
"query": question,
|
||||
"fields": [
|
||||
"question^3",
|
||||
"answer^1.5",
|
||||
"title^2",
|
||||
"content",
|
||||
"tags^1.2",
|
||||
"category^1.1",
|
||||
],
|
||||
"type": "best_fields",
|
||||
"minimum_should_match": "60%",
|
||||
}
|
||||
},
|
||||
{"match_phrase": {"question": {"query": question, "boost": 5}}},
|
||||
{"match_phrase": {"answer": {"query": question, "boost": 2}}},
|
||||
{"match_phrase": {"title": {"query": question, "boost": 3}}},
|
||||
{"match_phrase": {"content": {"query": question, "boost": 2}}},
|
||||
"multi_match": {
|
||||
"query": question,
|
||||
"fields": [
|
||||
"question^3",
|
||||
"answer^1.5",
|
||||
"title^2",
|
||||
"content",
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
"type": "best_fields",
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user