Alex
Alex

Reputation: 1375

Difference beetween search and Search elasticsearch

What difference between search and Search?

>>> Search
<class 'elasticsearch_dsl.search.Search'>
>>> search
<module 'elasticsearch_dsl.search' from '/usr/local/lib/python2.7/dist-packages/elasticsearch_dsl/search.pyc'>

From Search() i got elasticsearch_dsl.search.Search object. And from Elsasticsearch.search() i got dict with elastic data. How can I got all(not first 5 objects) elasticdata from Search()? Can i make search object from Search() to got dict?

Upvotes: 0

Views: 184

Answers (1)

Honza Kr&#225;l
Honza Kr&#225;l

Reputation: 3022

If you want to get all the data from elasticsearch in python use the scan helper by calling the scan() method on a Search object.

To get a dict instead of the wrapped object just call to_dict() on either the response directly or on every hit, if you want the metadata as well (things like _id, _index etc) call to_dict(True).

Upvotes: 1

Related Questions