You can use the size and from parameters in your query to paginate the results. For example, to get the first 1000 documents, you can use the following query:
public function test() {
return Http::get('localhost:9200/test/_search?size=1000&from=0')['hits']['hits'];
}
To get the next 1000 documents, you can use the following query:
public function test() {
return Http::get('localhost:9200/test/_search?size=1000&from=1000')['hits']['hits'];
}
You can keep incrementing the from parameter by 1000 until you have retrieved all the documents.