-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support include_type_name in the field mapping and index template API…
…s. (#37210) * Add include_type_name to the get field mappings API. * Make sure the API specification lists include_type_name as a boolean. * Add include_type_name to the get index templates API. * Add include_type_name to the put index templates API.
- Loading branch information
1 parent
9de62f1
commit a433c40
Showing
26 changed files
with
811 additions
and
136 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
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
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
53 changes: 18 additions & 35 deletions
53
rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/10_basic.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 |
---|---|---|
@@ -1,76 +1,59 @@ | ||
--- | ||
setup: | ||
- skip: | ||
version: " - 6.99.99" | ||
reason: include_type_name is not supported before 7.0.0 | ||
- do: | ||
indices.create: | ||
include_type_name: false | ||
index: test_index | ||
body: | ||
mappings: | ||
test_type: | ||
properties: | ||
text: | ||
type: text | ||
properties: | ||
text: | ||
type: text | ||
|
||
--- | ||
"Get field mapping with no index and type": | ||
"Get field mapping with no index": | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
include_type_name: false | ||
fields: text | ||
|
||
- match: {test_index.mappings.test_type.text.mapping.text.type: text} | ||
- match: {test_index.mappings.text.mapping.text.type: text} | ||
|
||
--- | ||
"Get field mapping by index only": | ||
- do: | ||
indices.get_field_mapping: | ||
include_type_name: false | ||
index: test_index | ||
fields: text | ||
|
||
- match: {test_index.mappings.test_type.text.mapping.text.type: text} | ||
- match: {test_index.mappings.text.mapping.text.type: text} | ||
|
||
--- | ||
"Get field mapping by type & field": | ||
"Get field mapping by field, with another field that doesn't exist": | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
include_type_name: false | ||
index: test_index | ||
type: test_type | ||
fields: text | ||
|
||
- match: {test_index.mappings.test_type.text.mapping.text.type: text} | ||
|
||
--- | ||
"Get field mapping by type & field, with another field that doesn't exist": | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
index: test_index | ||
type: test_type | ||
fields: [ text , text1 ] | ||
|
||
- match: {test_index.mappings.test_type.text.mapping.text.type: text} | ||
- match: {test_index.mappings.text.mapping.text.type: text} | ||
- is_false: test_index.mappings.test_type.text1 | ||
|
||
--- | ||
"Get field mapping with include_defaults": | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
include_type_name: false | ||
index: test_index | ||
type: test_type | ||
fields: text | ||
include_defaults: true | ||
|
||
- match: {test_index.mappings.test_type.text.mapping.text.type: text} | ||
- match: {test_index.mappings.test_type.text.mapping.text.analyzer: default} | ||
|
||
--- | ||
"Get field mapping should work without index specifying type and fields": | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
type: test_type | ||
fields: text | ||
|
||
- match: {test_index.mappings.test_type.text.mapping.text.type: text} | ||
|
||
- match: {test_index.mappings.text.mapping.text.type: text} | ||
- match: {test_index.mappings.text.mapping.text.analyzer: default} |
76 changes: 76 additions & 0 deletions
76
...c/src/main/resources/rest-api-spec/test/indices.get_field_mapping/11_basic_with_types.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,76 @@ | ||
--- | ||
setup: | ||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
mappings: | ||
test_type: | ||
properties: | ||
text: | ||
type: text | ||
|
||
--- | ||
"Get field mapping with no index and type": | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
fields: text | ||
|
||
- match: {test_index.mappings.test_type.text.mapping.text.type: text} | ||
|
||
--- | ||
"Get field mapping by index only": | ||
- do: | ||
indices.get_field_mapping: | ||
index: test_index | ||
fields: text | ||
|
||
- match: {test_index.mappings.test_type.text.mapping.text.type: text} | ||
|
||
--- | ||
"Get field mapping by type & field": | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
index: test_index | ||
type: test_type | ||
fields: text | ||
|
||
- match: {test_index.mappings.test_type.text.mapping.text.type: text} | ||
|
||
--- | ||
"Get field mapping by type & field, with another field that doesn't exist": | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
index: test_index | ||
type: test_type | ||
fields: [ text , text1 ] | ||
|
||
- match: {test_index.mappings.test_type.text.mapping.text.type: text} | ||
- is_false: test_index.mappings.test_type.text1 | ||
|
||
--- | ||
"Get field mapping with include_defaults": | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
index: test_index | ||
type: test_type | ||
fields: text | ||
include_defaults: true | ||
|
||
- match: {test_index.mappings.test_type.text.mapping.text.type: text} | ||
- match: {test_index.mappings.test_type.text.mapping.text.analyzer: default} | ||
|
||
--- | ||
"Get field mapping should work without index specifying type and fields": | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
type: test_type | ||
fields: text | ||
|
||
- match: {test_index.mappings.test_type.text.mapping.text.type: text} | ||
|
21 changes: 11 additions & 10 deletions
21
...spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/20_missing_field.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 |
---|---|---|
@@ -1,21 +1,22 @@ | ||
--- | ||
"Return empty object if field doesn't exist, but type and index do": | ||
|
||
- skip: | ||
version: " - 6.99.99" | ||
reason: types are required in requests before 7.0.0 | ||
- do: | ||
indices.create: | ||
include_type_name: false | ||
index: test_index | ||
body: | ||
mappings: | ||
test_type: | ||
properties: | ||
text: | ||
type: text | ||
analyzer: whitespace | ||
mappings: | ||
properties: | ||
text: | ||
type: text | ||
analyzer: whitespace | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
index: test_index | ||
type: test_type | ||
fields: not_existent | ||
- match: { '': {}} | ||
|
||
- match: { 'test_index.mappings': {}} |
21 changes: 21 additions & 0 deletions
21
...in/resources/rest-api-spec/test/indices.get_field_mapping/21_missing_field_with_types.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,21 @@ | ||
--- | ||
"Return empty object if field doesn't exist, but type and index do": | ||
|
||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
mappings: | ||
test_type: | ||
properties: | ||
text: | ||
type: text | ||
analyzer: whitespace | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
index: test_index | ||
type: test_type | ||
fields: not_existent | ||
|
||
- match: { '': {}} |
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 |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
catch: missing | ||
indices.get_field_mapping: | ||
index: test_index | ||
type: type | ||
fields: field | ||
|
||
|
Oops, something went wrong.