Can someone point me to how to extract the results _source
from the generator when using the scan API in the elasticsearch dsl python client?
for example, i'm using (from this example, elasticsearch-dsl scan)
for hit in s.scan():
print(hit)
I get the following
<Hit(beacon/INDEX/_Mwt9mABoXXeYV0uwSC-): {'client_number': '3570', 'cl...}>
How do I extract the dictionary from the hit generator?
scan()
gives backnull
scores, you can however extract the score fromexplanation
(given you have set theextra
forexplain
) and use it to sort the results as well. Cheers – Winther