From a745dc7fe3e529f776681c4c58a9abfa13e200c3 Mon Sep 17 00:00:00 2001 From: Jim Ferenczi Date: Sun, 16 Dec 2018 00:38:32 +0700 Subject: [PATCH] Fix rollup search statistics 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. --- .../xpack/core/indexing/AsyncTwoPhaseIndexer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexing/AsyncTwoPhaseIndexer.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexing/AsyncTwoPhaseIndexer.java index 4384144d235f3..899226ad48519 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexing/AsyncTwoPhaseIndexer.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexing/AsyncTwoPhaseIndexer.java @@ -356,8 +356,12 @@ private void onBulkResponse(BulkResponse response, JobPosition position) { ActionListener listener = ActionListener.wrap(this::onSearchResponse, this::finishWithSearchFailure); // TODO probably something more intelligent than every-50 is needed if (stats.getNumPages() > 0 && stats.getNumPages() % 50 == 0) { - doSaveState(IndexerState.INDEXING, position, () -> doNextSearch(buildSearchRequest(), listener)); + doSaveState(IndexerState.INDEXING, position, () -> { + stats.markStartSearch(); + doNextSearch(buildSearchRequest(), listener); + }); } else { + stats.markStartSearch(); doNextSearch(buildSearchRequest(), listener); } } catch (Exception e) {