-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Prior to this commit (and after 6.5.0), if an ingest node changes the _index in a pipeline, the original target index would be created. For daily indexes this could create an extra, empty index per day. This commit changes the TransportBulkAction to execute the ingest node pipeline before attempting to create the index. This ensures that the only index created is the original or one set by the ingest node pipeline. This was the execution order prior to 6.5.0 (#32786). The execution order was changed in 6.5 to better support default pipelines. Specifically the execution order was changed to be able to read the settings from the index meta data. This commit also includes a change in logic such that if the target index does not exist when ingest node pipeline runs, it will now pull the default pipeline (if one exists) from the settings of the best matched of the index template. Relates #32786 Relates #32758 Closes #36545
- Loading branch information
1 parent
8ec456b
commit 797d6b8
Showing
5 changed files
with
252 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,4 +91,4 @@ teardown: | |
get: | ||
index: test | ||
id: 3 | ||
- match: { found: false } | ||
|
119 changes: 119 additions & 0 deletions
119
...es/ingest-common/src/test/resources/rest-api-spec/test/ingest/230_change_target_index.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
--- | ||
teardown: | ||
- do: | ||
ingest.delete_pipeline: | ||
id: "retarget" | ||
ignore: 404 | ||
|
||
- do: | ||
indices.delete: | ||
index: foo | ||
|
||
--- | ||
"Test Change Target Index with Explicit Pipeline": | ||
|
||
- do: | ||
ingest.put_pipeline: | ||
id: "retarget" | ||
body: > | ||
{ | ||
"processors": [ | ||
{ | ||
"set" : { | ||
"field" : "_index", | ||
"value" : "foo" | ||
} | ||
} | ||
] | ||
} | ||
- match: { acknowledged: true } | ||
|
||
# no indices | ||
- do: | ||
cat.indices: {} | ||
|
||
- match: | ||
$body: | | ||
/^$/ | ||
- do: | ||
index: | ||
index: test | ||
id: 1 | ||
pipeline: "retarget" | ||
body: { | ||
a: true | ||
} | ||
|
||
- do: | ||
get: | ||
index: foo | ||
id: 1 | ||
- match: { _source.a: true } | ||
|
||
# only the foo index | ||
- do: | ||
cat.indices: | ||
h: i | ||
|
||
- match: | ||
$body: | | ||
/^foo\n$/ | ||
--- | ||
"Test Change Target Index with Default Pipeline": | ||
|
||
- do: | ||
indices.put_template: | ||
name: index_template | ||
body: | ||
index_patterns: test | ||
settings: | ||
default_pipeline: "retarget" | ||
|
||
- do: | ||
ingest.put_pipeline: | ||
id: "retarget" | ||
body: > | ||
{ | ||
"processors": [ | ||
{ | ||
"set" : { | ||
"field" : "_index", | ||
"value" : "foo" | ||
} | ||
} | ||
] | ||
} | ||
- match: { acknowledged: true } | ||
|
||
# no indices | ||
- do: | ||
cat.indices: {} | ||
|
||
- match: | ||
$body: | | ||
/^$/ | ||
- do: | ||
index: | ||
index: test | ||
id: 1 | ||
body: { | ||
a: true | ||
} | ||
|
||
- do: | ||
get: | ||
index: foo | ||
id: 1 | ||
- match: { _source.a: true } | ||
|
||
# only the foo index | ||
- do: | ||
cat.indices: | ||
h: i | ||
|
||
- match: | ||
$body: | | ||
/^foo\n$/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.