@@ -37,14 +37,14 @@ def __init__(self, es_host: str = None):
3737 # Add timeout configuration for sync ES client
3838 self .es = Elasticsearch (
3939 self .es_host ,
40- timeout = settings .es_timeout , # Use timeout from settings
40+ request_timeout = settings .es_timeout , # Use timeout from settings
4141 max_retries = settings .es_max_retries , # Use max retries from settings
4242 retry_on_timeout = True , # Retry on timeout errors
4343 )
4444 # Add timeout configuration for async ES client using settings
4545 self .async_es = AsyncElasticsearch (
4646 self .es_host ,
47- timeout = settings .es_timeout , # Use timeout from settings
47+ request_timeout = settings .es_timeout , # Use timeout from settings
4848 max_retries = settings .es_max_retries , # Use max retries from settings
4949 retry_on_timeout = True , # Retry on timeout errors
5050 )
@@ -266,7 +266,7 @@ def __init__(self, ctx: Dict[str, Any]):
266266 # Add timeout configuration for ES client using settings
267267 self .client = AsyncElasticsearch (
268268 ctx .get ("es_host" , "http://127.0.0.1:9200" ),
269- timeout = ctx .get ("es_timeout" , settings .es_timeout ), # Use timeout from context or settings
269+ request_timeout = ctx .get ("es_timeout" , settings .es_timeout ), # Use timeout from context or settings
270270 max_retries = ctx .get ("es_max_retries" , settings .es_max_retries ), # Use max retries from context or settings
271271 retry_on_timeout = True , # Retry on timeout errors
272272 )
@@ -291,7 +291,7 @@ async def extract(self, text):
291291 logger .warning ("index %s not exists" , self .index_name )
292292 return []
293293
294- resp = await self .client .indices .analyze (index = self .index_name , body = {"text" : text }, analyzer = " ik_smart" )
294+ resp = await self .client .indices .analyze (index = self .index_name , body = {"text" : text , " analyzer" : " ik_smart"} )
295295 tokens = {}
296296 for item in resp .body ["tokens" ]:
297297 token = item ["token" ]
@@ -307,7 +307,7 @@ async def extract(self, text):
307307
308308es = Elasticsearch (
309309 settings .es_host ,
310- timeout = settings .es_timeout , # Use timeout from settings
310+ request_timeout = settings .es_timeout , # Use timeout from settings
311311 max_retries = settings .es_max_retries , # Use max retries from settings
312312 retry_on_timeout = True , # Retry on timeout errors
313313)
0 commit comments