Skip to content
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

Support include_type_name in the field mapping and index template APIs (backport to 6.x) #37319

Merged
merged 3 commits into from
Jan 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
}
},
"params": {
"include_type_name": {
"type" : "boolean",
"description" : "Whether a type should be returned in the body of the mappings."
},
"include_defaults": {
"type" : "boolean",
"description" : "Whether the default mapping values should be returned as well"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
}
},
"params": {
"include_type_name": {
"type" : "boolean",
"description" : "Whether a type should be returned in the body of the mappings."
},
"flat_settings": {
"type": "boolean",
"description": "Return settings in flat format (default: false)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
}
},
"params": {
"include_type_name": {
"type" : "boolean",
"description" : "Whether a type should be returned in the body of the mappings."
},
"order": {
"type" : "number",
"description" : "The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Create index with mappings":
- skip:
version: " - 6.6.99"
reason: include_type_name was introduced in 6.7
reason: include_type_name was introduced in 6.7.0
- do:
indices.create:
include_type_name: false
Expand All @@ -22,7 +22,7 @@
"Create index with settings":
- skip:
version: " - 6.6.99"
reason: include_type_name was introduced in 6.7
reason: include_type_name was introduced in 6.7.0
- do:
indices.create:
include_type_name: false
Expand All @@ -41,7 +41,7 @@
"Create index":
- skip:
version: " - 6.6.99"
reason: include_type_name was introduced in 6.7
reason: include_type_name was introduced in 6.7.0
- do:
indices.create:
include_type_name: false
Expand All @@ -54,7 +54,7 @@
"Create index with wait_for_active_shards set to all":
- skip:
version: " - 6.6.99"
reason: include_type_name was introduced in 6.7
reason: include_type_name was introduced in 6.7.0
- do:
indices.create:
include_type_name: false
Expand All @@ -71,7 +71,7 @@
"Create index with aliases":
- skip:
version: " - 6.6.99"
reason: include_type_name was introduced in 6.7
reason: include_type_name was introduced in 6.7.0
- do:
indices.create:
include_type_name: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,76 +1,59 @@
---
setup:
- skip:
version: " - 6.6.99"
reason: include_type_name was introduced in 6.7.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}
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}

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': {}}
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: { '': {}}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
catch: missing
indices.get_field_mapping:
index: test_index
type: type
fields: field


Loading