|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
import logging
|
|
|
|
|
import os
|
|
|
|
|
from logging.handlers import RotatingFileHandler
|
|
|
|
|
|
|
|
|
|
import jieba
|
|
|
|
|
from elasticsearch import Elasticsearch
|
|
|
|
|
|
|
|
|
@ -26,7 +25,6 @@ class EsSearchUtil:
|
|
|
|
|
self.es_config = es_config
|
|
|
|
|
|
|
|
|
|
# 初始化连接池
|
|
|
|
|
from Elasticsearch.Utils.ElasticsearchConnectionPool import ElasticsearchConnectionPool
|
|
|
|
|
self.es_pool = ElasticsearchConnectionPool(
|
|
|
|
|
hosts=es_config['hosts'],
|
|
|
|
|
basic_auth=es_config['basic_auth'],
|
|
|
|
@ -41,6 +39,9 @@ class EsSearchUtil:
|
|
|
|
|
basic_auth=es_config['basic_auth'],
|
|
|
|
|
verify_certs=es_config.get('verify_certs', False)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# 确保es_conn属性存在以兼容旧代码
|
|
|
|
|
self.es_conn = self.es
|
|
|
|
|
|
|
|
|
|
def __init__(self, es_config):
|
|
|
|
|
from gensim.models import KeyedVectors
|
|
|
|
|