MINOR - fix(elasticsearch): add None value filter (#18711)

* fix(elasticsearch.py) - add None value filter

Sometimes elasticsearch returns lists with None values in it.
To fix this issue we need to filter them out first, befor returning most relevant to the endpoint.

* fix tests

---------

Co-authored-by: Mayur Singal <39544459+ulixius9@users.noreply.github.com>
Co-authored-by: ulixius9 <mayursingal9@gmail.com>
This commit is contained in:
Aleksey Stefonyak 2025-08-06 20:22:01 +02:00 committed by GitHub
parent 956a13f3f0
commit 65928c149a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -88,6 +88,9 @@ def get_entity_from_es_result(
:param entity_list: ES query result
:return: single entity
"""
if entity_list is None:
return None
entity_list = [e for e in entity_list if e is not None]
if entity_list and len(entity_list):
if fetch_multiple_entities:
return entity_list