Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bulk upsert ignores the default_pipeline and final_pipeline when the auto-created index matches the index template #12891

Merged
merged 8 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix test failure
Signed-off-by: Gao Binlong <gbinlong@amazon.com>
  • Loading branch information
gaobinlong committed Jul 16, 2024
commit 5f9e3047e6ab1d96d432c57461616a1a3ea16701
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ public void testToString() throws IOException {
request.toString(),
equalTo(
"update {[test][1], doc_as_upsert[false], "
+ "doc[index {[null][null], source[{\"body\":\"bar\"}]}], scripted_upsert[false], detect_noop[true]}"
+ "doc[index {[test][null], source[{\"body\":\"bar\"}]}], scripted_upsert[false], detect_noop[true]}"
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1607,12 +1607,11 @@ public void testResolveRequiredOrDefaultPipelineDefaultPipeline() {
assertThat(indexRequest.getPipeline(), equalTo("default-pipeline"));

// index name matches with ITMD for bulk upsert
IndexRequest upsertRequest = new IndexRequest().source(emptyMap());
UpdateRequest updateRequest = new UpdateRequest("idx", "id1").upsert(upsertRequest).script(mockScript("1"));
UpdateRequest updateRequest = new UpdateRequest("idx", "id1").upsert(emptyMap()).script(mockScript("1"));
result = IngestService.resolvePipelines(updateRequest, TransportBulkAction.getIndexWriteRequest(updateRequest), metadata);
assertThat(result, is(true));
assertThat(upsertRequest.isPipelineResolved(), is(true));
assertThat(upsertRequest.getPipeline(), equalTo("default-pipeline"));
assertThat(updateRequest.upsertRequest().isPipelineResolved(), is(true));
assertThat(updateRequest.upsertRequest().getPipeline(), equalTo("default-pipeline"));
}

public void testResolveFinalPipeline() {
Expand Down Expand Up @@ -1652,12 +1651,11 @@ public void testResolveFinalPipeline() {
assertThat(indexRequest.getFinalPipeline(), equalTo("final-pipeline"));

// index name matches with ITMD for bulk upsert:
IndexRequest upsertRequest = new IndexRequest().source(emptyMap());
UpdateRequest updateRequest = new UpdateRequest("idx", "id1").upsert(upsertRequest).script(mockScript("1"));
UpdateRequest updateRequest = new UpdateRequest("idx", "id1").upsert(emptyMap()).script(mockScript("1"));
result = IngestService.resolvePipelines(updateRequest, TransportBulkAction.getIndexWriteRequest(updateRequest), metadata);
assertThat(result, is(true));
assertThat(upsertRequest.isPipelineResolved(), is(true));
assertThat(upsertRequest.getFinalPipeline(), equalTo("final-pipeline"));
assertThat(updateRequest.upsertRequest().isPipelineResolved(), is(true));
assertThat(updateRequest.upsertRequest().getFinalPipeline(), equalTo("final-pipeline"));
}

public void testResolveRequestOrDefaultPipelineAndFinalPipeline() {
Expand Down
Loading