-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add require_data_stream feature
#101872
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
Merged
Add require_data_stream feature
#101872
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
c64b681
Adding require_data_stream feature
eyalkoren 966eccd
Update docs/changelog/101872.yaml
eyalkoren ee8e37c
Merge remote-tracking branch 'upstream/main' into require_data_stream…
eyalkoren 3411ad2
Complete merge
eyalkoren 85c199d
Checkstyle fixes
eyalkoren 51fbb6f
Merge remote-tracking branch 'origin/main' into require_data_stream_o…
dakrone 9697285
Make ReducedRequestInfo a record
dakrone 3cc9369
Clarify log message
dakrone a785294
Fix and test IndexRequest serialization
dakrone 5a24d31
Fix UpdateRequest serialization
dakrone 3713fbc
Merge remote-tracking branch 'origin/main' into require_data_stream_o…
dakrone 3b59c03
Merge remote-tracking branch 'origin/main' into require_data_stream_o…
dakrone 0746f0d
Update description of require_data_stream flag
dakrone 3c9b665
Fill in javadoc for setRequireDataStream
dakrone 602fec5
Remove unnecessary todo
dakrone e81f1a3
Fill in javadoc for CreateIndexRequest
dakrone a116534
Fill in more javadoc
dakrone bb1e64c
Update skip version in yaml test
dakrone 75e453e
Typo
dakrone cd79092
Merge remote-tracking branch 'origin/main' into require_data_stream_o…
dakrone d70c399
Merge remote-tracking branch 'origin/main' into require_data_stream_o…
dakrone e2f0275
Drastically change the way this is implemented
dakrone 2f3c014
Merge remote-tracking branch 'origin/main' into require_data_stream_o…
dakrone 8c99dcf
Update REST docstrings for the flag
dakrone 646ea73
Remove support for `require_data_stream` on the update API
dakrone efc9286
Spotless ಠ_ಠ
dakrone ebb366a
Merge remote-tracking branch 'origin/main' into require_data_stream_o…
dakrone 5a5700b
Add additional tests for bulk requests
dakrone ed9335c
Merge remote-tracking branch 'origin/main' into require_data_stream_o…
dakrone a0593dc
Update changelog not to have a "WIP" in it
dakrone d73bd2d
Merge remote-tracking branch 'origin/main' into require_data_stream_o…
dakrone 62698b9
Remove docs from create index API (the flag is not implemented there)
dakrone 511be7f
Merge remote-tracking branch 'origin/main' into require_data_stream_o…
dakrone 58f6400
Merge branch 'main' into require_data_stream_option
elasticmachine 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| pr: 101872 | ||
| summary: "Add `require_data_stream` parameter to indexing requests to enforce indexing operations target a data stream" | ||
| area: Data streams | ||
| type: feature | ||
| issues: | ||
| - 97032 |
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
138 changes: 138 additions & 0 deletions
138
...ams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/190_require_data_stream.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,138 @@ | ||
| --- | ||
| "Testing require_data_stream in index creation": | ||
| - skip: | ||
| version: " - 8.12.99" | ||
| reason: "require_data_stream was introduced in 8.13.0" | ||
| features: allowed_warnings | ||
|
|
||
| - do: | ||
| allowed_warnings: | ||
| - "index template [ds-template] has index patterns [ds-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [ds-template] will take precedence during new index creation" | ||
| indices.put_index_template: | ||
| name: ds-template | ||
| body: | ||
| index_patterns: ds-* | ||
| template: | ||
| settings: | ||
| number_of_shards: 1 | ||
| number_of_replicas: 0 | ||
| mappings: | ||
| properties: | ||
| field: | ||
| type: keyword | ||
| data_stream: {} | ||
| allow_auto_create: true | ||
|
|
||
| - do: | ||
| index: | ||
| index: ds-test | ||
| require_data_stream: true | ||
| body: | ||
| '@timestamp': '2022-12-12' | ||
| foo: bar | ||
|
|
||
| - do: | ||
| catch: /no matching index template with data stream template was found for it/ | ||
| index: | ||
| index: index-test | ||
| require_data_stream: true | ||
| body: | ||
| '@timestamp': '2022-12-12' | ||
| foo: bar | ||
|
|
||
| - do: | ||
| index: | ||
| index: other-index | ||
| require_data_stream: false | ||
| body: | ||
| '@timestamp': '2022-12-12' | ||
| foo: bar | ||
|
|
||
| - do: | ||
| catch: /is not a data stream/ | ||
| index: | ||
| index: other-index | ||
| require_data_stream: true | ||
| body: | ||
| '@timestamp': '2022-12-12' | ||
| foo: bar | ||
|
|
||
| --- | ||
| "Testing require_data_stream in bulk requests": | ||
| - skip: | ||
| version: " - 8.12.99" | ||
| reason: "require_data_stream was introduced in 8.13.0" | ||
| features: allowed_warnings | ||
|
|
||
| - do: | ||
| allowed_warnings: | ||
| - "index template [ds-template] has index patterns [ds-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [ds-template] will take precedence during new index creation" | ||
| indices.put_index_template: | ||
| name: ds-template | ||
| body: | ||
| index_patterns: ds-* | ||
| template: | ||
| settings: | ||
| number_of_shards: 1 | ||
| number_of_replicas: 0 | ||
| mappings: | ||
| properties: | ||
| field: | ||
| type: keyword | ||
| data_stream: {} | ||
| allow_auto_create: true | ||
|
|
||
| - do: | ||
| bulk: | ||
| refresh: true | ||
| require_data_stream: true | ||
| body: | ||
| - index: | ||
| _index: new_index_not_created | ||
| - f: 1 | ||
| - index: | ||
| _index: new_index_created | ||
| require_data_stream: false | ||
| - f: 2 | ||
| - index: | ||
| _index: ds-other | ||
| op_type: create | ||
| - "@timestamp": "2024-01-01" | ||
| - match: { errors: true } | ||
| - match: { items.0.index.status: 404 } | ||
| - match: { items.0.index.error.type: index_not_found_exception } | ||
| - match: { items.0.index.error.reason: "no such index [new_index_not_created] and the index creation request requires a data stream, but no matching index template with data stream template was found for it" } | ||
| - match: { items.1.index.result: created } | ||
| - match: { items.2.create.result: created } | ||
|
|
||
| - do: | ||
| allowed_warnings: | ||
| - "index template [other-template] has index patterns [ds-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [other-template] will take precedence during new index creation" | ||
| indices.put_index_template: | ||
| name: other-template | ||
| body: | ||
| index_patterns: other-* | ||
| template: | ||
| settings: | ||
| number_of_shards: 1 | ||
| number_of_replicas: 0 | ||
| mappings: | ||
| properties: | ||
| field: | ||
| type: keyword | ||
| allow_auto_create: true | ||
|
|
||
| - do: | ||
| bulk: | ||
| refresh: true | ||
| require_data_stream: false | ||
| body: | ||
| - index: | ||
| _index: other-myindex | ||
| require_data_stream: true | ||
| op_type: create | ||
| - "@timestamp": "2024-01-01" | ||
| - match: { errors: true } | ||
| - match: { items.0.create.status: 404 } | ||
| - match: { items.0.create.error.type: index_not_found_exception } | ||
| - match: { items.0.create.error.reason: "no such index [other-myindex] and the index creation request requires a data stream, but no matching index template with data stream template was found for it" } |
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
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
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.