forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Give precedence to index creation when mixing typed templates with ty…
…peless index creation and vice-versa. This is a backport of elastic#37871 and elastic#38032.
- Loading branch information
Showing
6 changed files
with
306 additions
and
3 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
129 changes: 129 additions & 0 deletions
129
...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,129 @@ | ||
--- | ||
"Create a typeless index while there is a typed template": | ||
|
||
- skip: | ||
version: " - 6.6.99" | ||
reason: Merging typeless/typed mappings/templates was added in 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.6.99" | ||
reason: Merging typeless/typed mappings/templates was added in 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.6.99" | ||
reason: include_type_name only supported as of 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.6.99" | ||
reason: include_type_name only supported as of 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: | ||
catch: /the final mapping would have more than 1 type/ | ||
index: | ||
index: test-1 | ||
type: _doc | ||
body: { bar: 42 } | ||
|
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
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