I am doing an elastic client search operation from an elastic datalake which is configured correctly, I double checked the configuration (esDatalake) and I am getting a response from the esDatalake for the first query in my program, so esDatalake works. However when I run another query with a different search_index and search_query later in the code, my code just stops, No Exceptions caught, No errors found, no empty response data found. Why does this happen?
try:
print("before datalake search")
widget_data = esDatalake.search(index=search_index, body=widget_query)
print("After datalake search")
if any(error_string in widget_data for error_string in ["error", "Error", "ERROR", "TransportError"]):
self.logger("Error")
raise Exception(f"Elasticsearch error:")
print(f"widget data is {widget_data}")
if widget_data: widget_data = widget_data["hits"]["hits"]
if not widget_data or widget_data == None:
raise Exception(f"Empty widget data for {widget_id}")
self.logger.info(f"Data fetched from datalake for {widget_id}")
except Exception as e:
self.logger.error(f"Could not fetch widget data from {search_index} due to {str(e)}")
continue # move on to next widget
here "before datalake search" is getting printed but not "After datalake search"
double checked search_index and widget_query, tried the same in kibana dev tools and got result as an empty response message where ["hits"]["hits"] is an empty list []. but with this python code, we are not even getting an empty response message saying ["hits"]["hits"] is an empty list []. why?