-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
098d7dc
commit da9f55c
Showing
5 changed files
with
255 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 |
---|---|---|
|
@@ -97,4 +97,4 @@ teardown: | |
index: test | ||
type: test | ||
id: 3 | ||
- match: { found: false } | ||
|
123 changes: 123 additions & 0 deletions
123
...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,123 @@ | ||
--- | ||
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 | ||
type: _doc | ||
id: 1 | ||
pipeline: "retarget" | ||
body: { | ||
a: true | ||
} | ||
|
||
- do: | ||
get: | ||
index: foo | ||
type: _doc | ||
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 | ||
type: _doc | ||
id: 1 | ||
body: { | ||
a: true | ||
} | ||
|
||
- do: | ||
get: | ||
index: foo | ||
type: _doc | ||
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.