Skip to content

Commit

Permalink
[8.3] Don't ignore pipeline for upserts in bulk api (#87719) (#88054)
Browse files Browse the repository at this point in the history
* Don't ignore pipeline for upserts in bulk api (#87719)

Don't ignore pipelines defined in bulk item for updates with upsert in bulk api.

Closes #87131

* update skip version section
  • Loading branch information
martijnvg committed Jun 27, 2022
1 parent 81e948a commit 4b9fe46
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/changelog/87719.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 87719
summary: Don't ignore pipeline for upserts in bulk api
area: Ingest
type: bug
issues:
- 87131
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,40 @@ teardown:

- is_false: _source.field1
- match: {_source.field2: value2}

---
"Update with pipeline":
- skip:
version: " - 7.17.4"
reason: "fixed in 7.17.5"

- do:
ingest.put_pipeline:
id: "lowercase-pipeline"
body: >
{
"processors": [
{
"lowercase" : {
"field" : "my_field"
}
}
]
}
- match: { acknowledged: true }

- do:
bulk:
refresh: true
body:
- '{"update":{"_id":"1","_index":"test_index","pipeline":"lowercase-pipeline"}}'
- '{"upsert":{"my_field":"UPPER"},"script":{"source":"ctx._source.my_field = ctx._source.my_field.toLowercase()"}}'

- match: { errors: false }
- match: { items.0.update.result: created }

- do:
get:
index: test_index
id: 1
- match: { _source: { my_field: "upper" } }
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public void parse(
}
IndexRequest upsertRequest = updateRequest.upsertRequest();
if (upsertRequest != null) {
upsertRequest.setPipeline(defaultPipeline);
upsertRequest.setPipeline(pipeline);
}

updateRequestConsumer.accept(updateRequest);
Expand Down

0 comments on commit 4b9fe46

Please sign in to comment.