-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Restrict Indexing To Child Streams When Streams Is Enabled #132011
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
Merged
lukewhiting
merged 18 commits into
elastic:main
from
lukewhiting:es-11941-streams-logs-bulk-transport-changes
Aug 13, 2025
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c0f1a12
Update BulkRequestModifier to allow wrapping multiple times while pre…
lukewhiting f8fa32b
Modify BulkResponse to have an equals method and update ingest test's…
lukewhiting 34082ef
Add new StreamType enum along with logic to check if that stream type…
lukewhiting 2457383
Modify IngestService to prevent documents being re-routed into child …
lukewhiting a2eab2a
Modify TransportAbstractBulkAction to prevent indexing into child str…
lukewhiting 1a861cd
Additional tests for new indexing restrictions
lukewhiting 5faf7fb
Merge branch 'main' into es-11941-streams-logs-bulk-transport-changes
lukewhiting 1c4225b
Apply suggestion from @szybia
lukewhiting fbfd61b
Apply suggestions from code review
lukewhiting 78cf0ef
Additional PR changes and cleanup
lukewhiting 5e1d615
Additional PR changes to improve performance and readability further
lukewhiting 387b4e3
Update docs/changelog/132011.yaml
lukewhiting d54b7b9
Added additional documentation on bulk modifier wrap methods
lukewhiting e5581aa
Merge remote-tracking branch 'origin/es-11941-streams-logs-bulk-trans…
lukewhiting a7e6f7a
Merge branch 'main' into es-11941-streams-logs-bulk-transport-changes
lukewhiting 3569947
PR Changes
lukewhiting 34e944e
Use of failure store is now wrapped in cluster feature check
lukewhiting 3e82b35
Merge branch 'main' of github.com:elastic/elasticsearch into es-11941…
lukewhiting File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| pr: 132011 | ||
| summary: Restrict Indexing To Child Streams When Streams Is Enabled | ||
| area: Data streams | ||
| type: enhancement | ||
| issues: [] |
This file contains hidden or 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 hidden or 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
156 changes: 156 additions & 0 deletions
156
.../src/yamlRestTest/resources/rest-api-spec/test/streams/logs/20_substream_restrictions.yml
This file contains hidden or 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,156 @@ | ||
| --- | ||
| "Check User Can't Write To Substream Directly": | ||
| - do: | ||
| streams.logs_enable: { } | ||
szybia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| streams.status: { } | ||
| - is_true: logs.enabled | ||
|
|
||
| - do: | ||
| bulk: | ||
| body: | | ||
| { "index": { "_index": "logs.foo" } } | ||
| { "foo": "bar" } | ||
| - match: { errors: true } | ||
| - match: { items.0.index.status: 400 } | ||
| - match: { items.0.index.error.type: "illegal_argument_exception" } | ||
| - match: { items.0.index.error.reason: "Direct writes to child streams are prohibited. Index directly into the [logs] stream instead" } | ||
|
|
||
| --- | ||
| "Check User Can't Write To Substream Directly With Single Doc": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| streams.status: { } | ||
| - is_true: logs.enabled | ||
|
|
||
| - do: | ||
| catch: bad_request | ||
| index: | ||
| index: logs.foo | ||
| id: "1" | ||
| body: | ||
| foo: bar | ||
| - match: { error.type: "illegal_argument_exception" } | ||
| - match: { error.reason: "Direct writes to child streams are prohibited. Index directly into the [logs] stream instead" } | ||
|
|
||
| --- | ||
| "Check Bulk Index With Reroute Processor To Substream Is Rejected": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| streams.status: { } | ||
| - is_true: logs.enabled | ||
|
|
||
| - do: | ||
| ingest.put_pipeline: | ||
| id: "reroute-to-logs-foo" | ||
| body: | ||
| processors: | ||
| - reroute: | ||
| destination: "logs.foo" | ||
| - do: | ||
| indices.create: | ||
| index: "bad-index" | ||
| body: | ||
| settings: | ||
| index.default_pipeline: "reroute-to-logs-foo" | ||
| - do: | ||
| bulk: | ||
| body: | | ||
| { "index": { "_index": "bad-index" } } | ||
| { "foo": "bar" } | ||
| - match: { errors: true } | ||
| - match: { items.0.index.status: 400 } | ||
| - match: { items.0.index.error.type: "illegal_argument_exception" } | ||
| - match: { items.0.index.error.reason: "Pipeline [reroute-to-logs-foo] can't change the target index (from [bad-index] to [logs] child stream [logs.foo]) History: [bad-index]" } | ||
|
|
||
| --- | ||
| "Check Bulk Index With Script Processor To Substream Is Rejected": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| streams.status: { } | ||
| - is_true: logs.enabled | ||
|
|
||
| - do: | ||
| ingest.put_pipeline: | ||
| id: "script-to-logs-foo" | ||
| body: | ||
| processors: | ||
| - script: | ||
| source: "ctx._index = 'logs.foo'" | ||
| - do: | ||
| indices.create: | ||
| index: "bad-index-script" | ||
| body: | ||
| settings: | ||
| index.default_pipeline: "script-to-logs-foo" | ||
| - do: | ||
| bulk: | ||
| body: | | ||
| { "index": { "_index": "bad-index-script" } } | ||
| { "foo": "bar" } | ||
| - match: { errors: true } | ||
| - match: { items.0.index.status: 400 } | ||
| - match: { items.0.index.error.type: "illegal_argument_exception" } | ||
| - match: { items.0.index.error.reason: "Pipeline [script-to-logs-foo] can't change the target index (from [bad-index-script] to [logs] child stream [logs.foo]) History: [bad-index-script]" } | ||
|
|
||
| --- | ||
| "Check Delete By Query Directly On Substream After Reroute Succeeds": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| streams.status: { } | ||
| - is_true: logs.enabled | ||
|
|
||
| - do: | ||
| ingest.put_pipeline: | ||
| id: "reroute-to-logs-foo-success" | ||
| body: | ||
| processors: | ||
| - reroute: | ||
| destination: "logs.foo" | ||
| - do: | ||
| indices.create: | ||
| index: "logs" | ||
| body: | ||
| settings: | ||
| index.default_pipeline: "reroute-to-logs-foo-success" | ||
| - do: | ||
| bulk: | ||
| refresh: true | ||
| body: | | ||
| { "index": { "_index": "logs" } } | ||
| { "foo": "bar", "baz": "qux" } | ||
| - match: { errors: false } | ||
| - match: { items.0.index.status: 201 } | ||
|
|
||
| - do: | ||
| delete_by_query: | ||
| index: logs.foo | ||
| refresh: true | ||
| body: | ||
| query: | ||
| match: | ||
| foo: "bar" | ||
| - match: { deleted: 1 } | ||
| - match: { total: 1 } | ||
|
|
||
| - do: | ||
| search: | ||
| index: logs.foo | ||
| body: | ||
| query: | ||
| match_all: {} | ||
| - match: { hits.total.value: 0 } | ||
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.