Updated code to load all pages from Elasticsearch