mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-05 20:48:22 +00:00
a3abcdc93a
The get field mapping API now includes a mappings element after the index in its JSON Added more consistent endpoint /{index}/_mapping/{type}/field/{fields} and added endpoint /_mapping/{type}/field/{fields} which are also used in tests Added rest spec tests for wildcards and _all Relates #4071 NOTE: This is not yet complete for 1.0. We need to return an empty JSON document instead of a 404 if the field of an existing index and type is not found. However this is not possible with the current data structure being returned. Needs to be finished for 1.0.
77 lines
1.7 KiB
YAML
77 lines
1.7 KiB
YAML
---
|
|
setup:
|
|
- do:
|
|
indices.create:
|
|
index: test_index
|
|
body:
|
|
mappings:
|
|
test_type:
|
|
properties:
|
|
text:
|
|
type: string
|
|
|
|
---
|
|
"Get field mapping with no index and type":
|
|
|
|
- do:
|
|
indices.get_field_mapping:
|
|
field: text
|
|
|
|
- match: {test_index.mappings.test_type.text.mapping.text.type: string}
|
|
|
|
---
|
|
"Get field mapping by index only":
|
|
- do:
|
|
indices.get_field_mapping:
|
|
index: test_index
|
|
field: text
|
|
|
|
- match: {test_index.mappings.test_type.text.mapping.text.type: string}
|
|
|
|
---
|
|
"Get field mapping by type & field":
|
|
|
|
- do:
|
|
indices.get_field_mapping:
|
|
index: test_index
|
|
type: test_type
|
|
field: text
|
|
|
|
- match: {test_index.mappings.test_type.text.mapping.text.type: string}
|
|
|
|
---
|
|
"Get field mapping by type & field, with another field that doesn't exist":
|
|
|
|
- do:
|
|
indices.get_field_mapping:
|
|
index: test_index
|
|
type: test_type
|
|
field: [ text , text1 ]
|
|
|
|
- match: {test_index.mappings.test_type.text.mapping.text.type: string}
|
|
- 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
|
|
field: text
|
|
include_defaults: true
|
|
|
|
- match: {test_index.mappings.test_type.text.mapping.text.type: string}
|
|
- match: {test_index.mappings.test_type.text.mapping.text.analyzer: default}
|
|
|
|
---
|
|
"Get field mapping should work without index specifying type and field":
|
|
|
|
- do:
|
|
indices.get_field_mapping:
|
|
type: test_type
|
|
field: text
|
|
|
|
- match: {test_index.mappings.test_type.text.mapping.text.type: string}
|
|
|