@@ -248,7 +248,7 @@ def getDoc(self, index: str, docID: str) -> dict:
248248 """
249249 sLog .debug (f"Retrieving document { docID } in index { index } " )
250250 try :
251- return S_OK (self .client .get (index , docID )["_source" ])
251+ return S_OK (self .client .get (index = index , id = docID )["_source" ])
252252 except NotFoundError :
253253 sLog .warn ("Could not find the document in index" , index )
254254 return S_OK ({})
@@ -265,7 +265,7 @@ def getDocs(self, indexFunc, docIDs: list[str]) -> list[dict]:
265265 sLog .debug (f"Retrieving documents { docIDs } " )
266266 docs = [{"_index" : indexFunc (docID ), "_id" : docID } for docID in docIDs ]
267267 try :
268- response = self .client .mget ({"docs" : docs })
268+ response = self .client .mget (body = {"docs" : docs })
269269 except RequestError as re :
270270 return S_ERROR (re )
271271 else :
@@ -283,12 +283,12 @@ def updateDoc(self, index: str, docID: str, body) -> dict:
283283 """
284284 sLog .debug (f"Updating document { docID } in index { index } " )
285285 try :
286- self .client .update (index , docID , body )
286+ self .client .update (index = index , id = docID , body = body )
287287 except ConflictError :
288288 # updates are rather "heavy" operations from ES point of view, needing seqNo to be updated.
289289 # Not ideal, but we just wait and retry.
290290 time .sleep (1 )
291- self .client .update (index , docID , body , params = {"retry_on_conflict" : 3 })
291+ self .client .update (index = index , id = docID , body = body , params = {"retry_on_conflict" : 3 })
292292 except RequestError as re :
293293 return S_ERROR (re )
294294 return S_OK ()
@@ -302,7 +302,7 @@ def deleteDoc(self, index: str, docID: str):
302302 """
303303 sLog .debug (f"Deleting document { docID } in index { index } " )
304304 try :
305- return S_OK (self .client .delete (index , docID ))
305+ return S_OK (self .client .delete (index = index , id = docID ))
306306 except RequestError as re :
307307 return S_ERROR (re )
308308 except NotFoundError :
@@ -317,7 +317,7 @@ def existsDoc(self, index: str, docID: str) -> bool:
317317 :param docID: document ID
318318 """
319319 sLog .debug (f"Checking if document { docID } in index { index } exists" )
320- return self .client .exists (index , docID )
320+ return self .client .exists (index = index , id = docID )
321321
322322 @ifConnected
323323 def _Search (self , indexname ):
@@ -348,7 +348,7 @@ def getIndexes(self, indexName=None):
348348 indexName = self .__indexPrefix
349349 sLog .debug (f"Getting indices alias of { indexName } " )
350350 # we only return indexes which belong to a specific prefix for example 'lhcb-production' or 'dirac-production etc.
351- return list (self .client .indices .get_alias (f"{ indexName } *" ))
351+ return list (self .client .indices .get_alias (index = f"{ indexName } *" ))
352352
353353 @ifConnected
354354 def getDocTypes (self , indexName ):
@@ -361,7 +361,7 @@ def getDocTypes(self, indexName):
361361 result = []
362362 try :
363363 sLog .debug ("Getting mappings for " , indexName )
364- result = self .client .indices .get_mapping (indexName )
364+ result = self .client .indices .get_mapping (index = indexName )
365365 except Exception as e : # pylint: disable=broad-except
366366 sLog .exception ()
367367 return S_ERROR (e )
@@ -392,7 +392,7 @@ def existingIndex(self, indexName):
392392 """
393393 sLog .debug (f"Checking existance of index { indexName } " )
394394 try :
395- return S_OK (self .client .indices .exists (indexName ))
395+ return S_OK (self .client .indices .exists (index = indexName ))
396396 except TransportError as e :
397397 sLog .exception ()
398398 return S_ERROR (e )
@@ -434,7 +434,7 @@ def deleteIndex(self, indexName):
434434 """
435435 sLog .info ("Deleting index" , indexName )
436436 try :
437- retVal = self .client .indices .delete (indexName )
437+ retVal = self .client .indices .delete (index = indexName )
438438 except NotFoundError :
439439 sLog .warn ("Index does not exist" , indexName )
440440 return S_OK ("Nothing to delete" )
0 commit comments