From 8e295cf860ca19c3983674526c61d5d7b42c8791 Mon Sep 17 00:00:00 2001 From: Keith Massey Date: Thu, 12 Oct 2023 14:16:18 -0500 Subject: [PATCH] code review feedback --- .../java/org/elasticsearch/action/index/IndexRequest.java | 6 ++++++ .../main/java/org/elasticsearch/ingest/IngestService.java | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java b/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java index 4ab6ab6dd6c7a..3de9526ef8fac 100644 --- a/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java +++ b/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java @@ -878,6 +878,12 @@ public void addPipeline(String pipeline) { } } + /** + * This returns the list of pipelines executed on the document for this request. If listExecutedPipelines is false, the response will be + * null, even if pipelines were executed. If listExecutedPipelines is true but no pipelines were executed, the list will be empty. + * @return + */ + @Nullable public List getExecutedPipelines() { if (listExecutedPipelines == false) { return null; diff --git a/server/src/main/java/org/elasticsearch/ingest/IngestService.java b/server/src/main/java/org/elasticsearch/ingest/IngestService.java index 03dff53c790be..4c280519b0336 100644 --- a/server/src/main/java/org/elasticsearch/ingest/IngestService.java +++ b/server/src/main/java/org/elasticsearch/ingest/IngestService.java @@ -818,13 +818,12 @@ private void executePipelines( // reset the reroute flag, at the start of a new pipeline execution this document hasn't been rerouted yet ingestDocument.resetReroute(); - indexRequest.addPipeline(pipelineId); try { if (pipeline == null) { throw new IllegalArgumentException("pipeline with id [" + pipelineId + "] does not exist"); } - + indexRequest.addPipeline(pipelineId); final String originalIndex = indexRequest.indices()[0]; executePipeline(ingestDocument, pipeline, (keep, e) -> { assert keep != null;