Index default sorting

Hey. I need to use the scroll & scan command for retrieving a large set of data. Is there a way to set the default index order in which the documents would be sorted when indexing? Thus, the index would be a list of sorted documents by default and the scan command would return the list of documents sorted by name.

Thanks.

Hi, this is not possible afaik. Documents are not stored in any sorted order in ES, but can be sorted at search time. The whole point of scan & scroll is to gain speed by not doing sorting when retrieving large amounts of data. However, it is possible to just use the scroll without scan on a search, but this will likely suffer from the known problems for deep pagination.

OK, thanks!