5

I have a simple repository

@Repository
public interface SurgeryIndexRepository extends ElasticsearchRepository<SurgeryIndexEntity, UUID> {}

When I call the search method like this surgeryIndexRepository.search(query, pageable) I get a Page response with totalPages = 1, numberOfElements=40, totalElements=7200. Something is wrong with the totalPages, I should have 180.

My Pageable is Page request [number: 0, size 40, sort: date: DESC]

I'm using Maven: org.springframework.data:spring-data-elasticsearch:3.0.6.RELEASE

Maelig
  • 2,046
  • 4
  • 24
  • 49
  • 1
    Looks like other people also have the [same issue](https://github.com/spring-projects/spring-data-elasticsearch/pull/170#issuecomment-330412336) – Val Jul 25 '18 at 07:12
  • Yep and just found this https://stackoverflow.com/questions/49896753/elasticsearch-return-totalpages-not-correct leading to this https://jira.spring.io/browse/DATAES-402 I'm gonna try it now ;) – Maelig Jul 25 '18 at 07:17
  • Good find, let us know how it goes! – Val Jul 25 '18 at 07:21
  • just posted an anwser – Maelig Jul 25 '18 at 07:31

1 Answers1

3

This problem has been resolved in 3.0.7 : https://jira.spring.io/browse/DATAES-402, we were using 3.0.6, so just upgraded to current release version 3.0.8.RELEASE and it solved the problem.

Another reference to this problem : elasticsearch: return TotalPages not correct

Maelig
  • 2,046
  • 4
  • 24
  • 49