-
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
Changes from all commits
69f0b1e
e9336c7
4cf54fe
ba52c35
fa88421
db35082
4f304e9
8db4e4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
--- | ||
"Create a typeless index while there is a typed template": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
- 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 | ||
|
||
--- | ||
"Implicitly 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: | ||
catch: /the final mapping would have more than 1 type/ | ||
index: | ||
index: test-1 | ||
type: my_type | ||
body: { bar: 42 } | ||
|
||
--- | ||
"Implicitly create a typeless index while there is a typed template": | ||
|
||
- skip: | ||
version: " - 6.99.99" | ||
reason: needs typeless index operations to work on typed indices | ||
|
||
- do: | ||
indices.put_template: | ||
include_type_name: true | ||
name: test_template | ||
body: | ||
index_patterns: test-* | ||
mappings: | ||
my_type: | ||
properties: | ||
foo: | ||
type: keyword | ||
|
||
- do: | ||
index: | ||
index: test-1 | ||
type: my_type | ||
body: { bar: 42 } | ||
|
||
- do: | ||
indices.get_mapping: | ||
include_type_name: true | ||
index: test-1 | ||
|
||
- is_true: test-1.mappings.my_type # the template is honored | ||
- is_false: test-1.mappings._doc | ||
- is_true: test-1.mappings.my_type.properties.foo | ||
- is_true: test-1.mappings.my_type.properties.bar |
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.
Small typo (typless) but it's so hard to get a green build, I can just fix this when we do another pass over this documentation.
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.
I will open a follow-up PR.