I have a question about pyes (Python API of the ElasticSearch).
Is it possible to make the search method to return the keys of the found documents?
The code I use:
import pyes
conn = pyes.ES('localhost:9200')
q = pyes.StringQuery("november rain", default_operator="AND")
result = conn.search(query=q, indices=[index])
for r in result:
print r
Result: found documents, without the key (_id field) that I saved the document with.
The question is how to return the _id keys?
Thanks!
All results in a
ResultSetare justElasticSearchModelobjects. So you can access the_idattribute via the_metaDotDict like this_metaalso contains some other useful information:See the documentation on models and result sets for more details.