Sorting an empty result should not fail. #1908
Labels
status: feedback-provided
Feedback has been provided
status: waiting-for-triage
An issue we've not yet triaged
I have this method
ebookReviewRepository.findByEbookIdOrderByCommentDateDesc(ebookId, PageRequest.of(page, size));
I noticed that when the index is empty, I get the error
Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]
. This error is due to the fact that elastic search tries to sort and empty result.They added
"ignore_unmapped": true
to ignore it:elastic/elasticsearch#1558
But it how could i use the ignore_unmapped option in Spring Data elastic search ? There are no traces in the documentation.
I added a check in my services workaround, but for large data, making count each time is not a solution.
// We have to check first if we have data, in order to avoid issues about sorting when empty
How could I handle it correctly ? Thanks ?
The text was updated successfully, but these errors were encountered: