-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
The starting example in the docs doesn't work:
The part:
res = es.search(index="test-index", body={"query": {"match_all": {}}})
print("Got %d Hits:" % res['hits']['total'])
for hit in res['hits']['hits']:
print("%(timestamp)s %(author)s: %(text)s" % hit["_source"])
fails with:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-21-41126016e65f> in <module>
17
18 res = es.search(index="test-index", body={"query": {"match_all": {}}})
---> 19 print("Got %d Hits:" % res['hits']['total'])
20 for hit in res['hits']['hits']:
21 print("%(timestamp)s %(author)s: %(text)s" % hit["_source"])
TypeError: %d format: a number is required, not dict
and needs to be replaced with:
print("Got %d Hits:" % res['hits']['total']['value'])
Metadata
Metadata
Assignees
Labels
No labels
