Suppose there is a document with the following fields:

id title text date 

I need to return the list id. at the moment doing this:

 es = Elasticsearch([host, ], http_auth=(user, passwd), port=9200 ) s = Search(using=es, index='docs', doc_type='doc') s.source(['id', ]) es_ids = [h.meta.id for h in s.scan()] 

But it seems to me that this is not it. It turns out all the documents come to me (or do I not understand correctly?) And there are currently more than 100k there and will soon be hundreds of times more. Tell me how to return only one field. list, maybe there is such a thing? Maybe you need to use some kind of Q from elasticsearch_dsl ? I would be happy to help.

    1 answer 1

    Actually did everything right but you need to add a parameter

     s = s.params(size=8000) 

    As far as I understand this is the size of the answer. It turns out fast enough. And with an increase in the number of shards, this parameter will be multiplied by the number of shards.