-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Give precedence to index creation when mixing typed templates with typeless index creation and vice-versa. #37871
Merged
jpountz
merged 8 commits into
elastic:master
from
jpountz:mix_typed_typeless_template_index_creation
Jan 30, 2019
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
69f0b1e
Give precedence to index creation when mixing typed templates with ty…
jpountz e9336c7
Fix bug.
jpountz 4cf54fe
Improve readability.
jpountz ba52c35
Merge branch 'master' into mix_typed_typeless_template_index_creation
jpountz fa88421
Merge branch 'master' into mix_typed_typeless_template_index_creation
jpountz db35082
Merge branch 'master' into mix_typed_typeless_template_index_creation
jpountz 4f304e9
More comprehensive tests and doc.
jpountz 8db4e4d
Merge branch 'master' into mix_typed_typeless_template_index_creation
jpountz 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
77 changes: 77 additions & 0 deletions
77
...api-spec/src/main/resources/rest-api-spec/test/indices.create/20_mix_typeless_typeful.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,77 @@ | ||
--- | ||
"Create a typeless index while there is a typed template": | ||
|
||
- skip: | ||
version: " - 6.99.99" | ||
reason: needs change to be backported to 6.7 | ||
|
||
- do: | ||
indices.put_template: | ||
include_type_name: true | ||
name: test_template | ||
body: | ||
index_patterns: test-* | ||
mappings: | ||
my_type: | ||
properties: | ||
foo: | ||
type: keyword | ||
|
||
- do: | ||
indices.create: | ||
include_type_name: false | ||
index: test-1 | ||
body: | ||
mappings: | ||
properties: | ||
bar: | ||
type: "long" | ||
|
||
- do: | ||
indices.get_mapping: | ||
include_type_name: true | ||
index: test-1 | ||
|
||
- is_true: test-1.mappings._doc # the index creation call won | ||
- is_false: test-1.mappings.my_type | ||
- is_true: test-1.mappings._doc.properties.foo | ||
- is_true: test-1.mappings._doc.properties.bar | ||
|
||
--- | ||
"Create a typed index while there is a typeless template": | ||
|
||
- skip: | ||
version: " - 6.99.99" | ||
reason: needs change to be backported to 6.7 | ||
|
||
- do: | ||
indices.put_template: | ||
include_type_name: false | ||
name: test_template | ||
body: | ||
index_patterns: test-* | ||
mappings: | ||
properties: | ||
foo: | ||
type: keyword | ||
|
||
- do: | ||
indices.create: | ||
include_type_name: true | ||
index: test-1 | ||
body: | ||
mappings: | ||
my_type: | ||
properties: | ||
bar: | ||
type: "long" | ||
|
||
- do: | ||
indices.get_mapping: | ||
include_type_name: true | ||
index: test-1 | ||
|
||
- is_true: test-1.mappings.my_type # the index creation call won | ||
- is_false: test-1.mappings._doc | ||
- is_true: test-1.mappings.my_type.properties.foo | ||
- is_true: test-1.mappings.my_type.properties.bar |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the change is a bit subtle, I wonder if it'd be worth adding some unit tests in
IndexCreationTaskTests
? In particular, reading the code I had to think a bit about what would happen if no mappings were provided in the create index requests, or if the template or create request had more than one type.