Is it always necessary to use the size attribute in Elasticsearch DSL query?
What if there are many documents and I do not know the exact no of documents that I would need?
I am trying to get the last poll data from Elasticsearch. In the last poll (time < now-5m), I get large no of docs, sometimes > 10,000. So how do I get the data without having to specify the size?
It depends on what you want to do but the answer is no.
It will tell you how many docs you have and will return the first 10 by default.
You can use:
the size and from parameters to display by default up to 10000 records to your users. If you want to change this limit, you can change index.max_result_window setting but be aware of the consequences (ie memory).
So if I go for the first approach, using size and from parameter, let's say I have to display the results in a table. Then each time the user changes the page number or clicks on next page button, a search query with the corresponding size and from values should be sent to Elasticsearch?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.