def execute_search(search_obj):
"""
Executes a search against ES after checking the connection
Args:
search_obj (Search): elasticsearch_dsl Search object
Returns:
elasticsearch_dsl.result.Response: ES response
"""
# make sure there is a live connection
if search_obj._index is None: # pylint: disable=protected-access
# If you're seeing this it means you're creating Search() without using
# create_search_obj which sets important fields like the index and doc_type.
raise ImproperlyConfigured("search object is missing an index")
get_conn()
return search_obj.execute()
评论列表
文章目录