diff --git a/workers/sample_generator.py b/workers/sample_generator.py
index 82dd4e90691d64e5a761e3050f8e90bde084ff4c..88f774191f49b0b5cdcdc7bb9e99417c6dc85143 100644
--- a/workers/sample_generator.py
+++ b/workers/sample_generator.py
@@ -40,7 +40,7 @@ def callback(channel, method, properties, body):
     the_query['query'] = dict()
     the_query['query']['term'] = {'uuid.keyword': uuid}
 
-    res = source_es.search(cfg['reindexer']['source_index'], '_doc', the_query)
+    res = source_es.search(index=cfg['reindexer']['source_index'], doc_type='_doc', body=the_query)
 
     docs_to_index = [ doc['_source'] for doc in res['hits']['hits'] ]
 
@@ -61,7 +61,7 @@ def callback(channel, method, properties, body):
 
     logging.info("Deleting already existing samples for dataset with slug = %s" % docs_to_index[0]['slug'])
     try:
-        res = destin_es.delete_by_query(cfg['reindexer']['destination_index'], doc_type='_doc', body=the_query, conflicts='proceed', refresh=True, wait_for_completion=False)
+        res = destin_es.delete_by_query(index=cfg['reindexer']['destination_index'], doc_type='_doc', body=the_query, conflicts='proceed', refresh=True, wait_for_completion=False)
         logging.debug(res)
         task_id = res['task']
         # wait until ES is done