parent
90307fd7dd
commit
7d080a9a9c
@ -0,0 +1,20 @@
|
||||
from Config.Config import ES_CONFIG
|
||||
from elasticsearch import Elasticsearch
|
||||
import warnings
|
||||
|
||||
# 初始化ES连接
|
||||
es = Elasticsearch(
|
||||
hosts=ES_CONFIG["hosts"],
|
||||
basic_auth=ES_CONFIG["basic_auth"],
|
||||
verify_certs=ES_CONFIG["verify_certs"],
|
||||
ssl_show_warn=ES_CONFIG["ssl_show_warn"]
|
||||
)
|
||||
|
||||
|
||||
# 在T3_LinkEs.py中添加测试
|
||||
res = es.indices.analyze(
|
||||
index="knowledge_base",
|
||||
body={"text": "云南省初中在校生情况", "analyzer": "ik_smart"}
|
||||
)
|
||||
print(res)
|
||||
# 预期输出:['云南省', '初中', '在校生', '情况']
|
Binary file not shown.
Loading…
Reference in new issue