Skip to content

Commit

Permalink
fixed counting of result sets larger than 10000
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed May 1, 2019
1 parent cb48329 commit 8cb0cea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/erudika/para/search/ElasticSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ private Long getCountInternal(String appid, String type) {
Long count = 0L;
try {
SearchRequest search = new SearchRequest(getIndexName(appid)).
source(SearchSourceBuilder.searchSource().size(0).query(query));
source(SearchSourceBuilder.searchSource().size(0).query(query).trackTotalHits(true));
count = getRESTClient().search(search, RequestOptions.DEFAULT).getHits().getTotalHits().value;
} catch (Exception e) {
Throwable cause = e.getCause();
Expand All @@ -628,7 +628,7 @@ private Long getCountInternal(String appid, String type, Map<String, ?> terms) {
}
try {
SearchRequest search = new SearchRequest(getIndexName(appid)).
source(SearchSourceBuilder.searchSource().size(0).query(query));
source(SearchSourceBuilder.searchSource().size(0).query(query).trackTotalHits(true));
count = getRESTClient().search(search, RequestOptions.DEFAULT).getHits().getTotalHits().value;
} catch (Exception e) {
Throwable cause = e.getCause();
Expand Down

0 comments on commit 8cb0cea

Please sign in to comment.