Skip to content

Commit d41eb6f

Browse files
jimczipolyfractal
authored andcommitted
Fix rollup search statistics (#36674)
This change fixes the rollup statistics regarding search times. Search times are computed from the first query and never updated. This commit adds the missing calls to the subsequent search.
1 parent 819bda5 commit d41eb6f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexing/AsyncTwoPhaseIndexer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,12 @@ private void onBulkResponse(BulkResponse response, JobPosition position) {
356356
ActionListener<SearchResponse> listener = ActionListener.wrap(this::onSearchResponse, this::finishWithSearchFailure);
357357
// TODO probably something more intelligent than every-50 is needed
358358
if (stats.getNumPages() > 0 && stats.getNumPages() % 50 == 0) {
359-
doSaveState(IndexerState.INDEXING, position, () -> doNextSearch(buildSearchRequest(), listener));
359+
doSaveState(IndexerState.INDEXING, position, () -> {
360+
stats.markStartSearch();
361+
doNextSearch(buildSearchRequest(), listener);
362+
});
360363
} else {
364+
stats.markStartSearch();
361365
doNextSearch(buildSearchRequest(), listener);
362366
}
363367
} catch (Exception e) {

0 commit comments

Comments
 (0)