Skip to content

Commit

Permalink
Allow read of data from elastic in later versions (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
nagi49000 authored Aug 13, 2024
1 parent 8ba59c3 commit 052bf37
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions python/elastic_search_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,9 @@ def scan(
)
items = []
for item in response:
item[ID] = item[_SOURCE][INDEX][ID]
item[_SOURCE].pop(INDEX, None)
if _SOURCE in item and INDEX in item[_SOURCE]:
item[ID] = item[_SOURCE][INDEX][ID]
item[_SOURCE].pop(INDEX, None)
items.append(item)

return mgp.Record(items=items)
Expand Down Expand Up @@ -608,8 +609,9 @@ def search(
)
hits = []
for hit in response[HITS][HITS]:
hit[ID] = hit[_SOURCE][INDEX][ID]
hit[_SOURCE].pop(INDEX, None)
if _SOURCE in hit and INDEX in hit[_SOURCE]:
hit[ID] = hit[_SOURCE][INDEX][ID]
hit[_SOURCE].pop(INDEX, None)
hits.append(hit)

result = {}
Expand Down

0 comments on commit 052bf37

Please sign in to comment.