OpenSearch/rest-api-spec/test/indices.get_field_mapping/50_field_wildcards.yaml

140 lines
4.3 KiB
YAML
Raw Normal View History

---
setup:
- do:
indices.create:
index: test_index
body:
mappings:
test_type:
properties:
t1:
type: string
t2:
type: string
obj:
properties:
t1:
type: string
i_t1:
type: string
i_t3:
type: string
- do:
indices.create:
index: test_index_2
body:
mappings:
test_type_2:
properties:
t1:
type: string
t2:
type: string
obj:
properties:
t1:
type: string
i_t1:
type: string
i_t3:
type: string
- do:
cluster.health:
wait_for_status: yellow
---
"Get field mapping with * for fields":
- do:
indices.get_field_mapping:
field: "*"
- match: {test_index.mappings.test_type.t1.full_name: t1 }
- match: {test_index.mappings.test_type.t2.full_name: t2 }
- match: {test_index.mappings.test_type.obj\.t1.full_name: obj.t1 }
- match: {test_index.mappings.test_type.obj\.i_t1.full_name: obj.i_t1 }
- match: {test_index.mappings.test_type.obj\.i_t3.full_name: obj.i_t3 }
---
"Get field mapping with t* for fields":
- do:
indices.get_field_mapping:
index: test_index
field: "t*"
- match: {test_index.mappings.test_type.t1.full_name: t1 }
- match: {test_index.mappings.test_type.t2.full_name: t2 }
- length: {test_index.mappings.test_type: 2}
---
"Get field mapping with *t1 for fields":
- do:
indices.get_field_mapping:
index: test_index
field: "*t1"
- match: {test_index.mappings.test_type.t1.full_name: t1 }
- match: {test_index.mappings.test_type.obj\.t1.full_name: obj.t1 }
- match: {test_index.mappings.test_type.obj\.i_t1.full_name: obj.i_t1 }
- length: {test_index.mappings.test_type: 3}
---
"Get field mapping with wildcarded relative names":
- do:
indices.get_field_mapping:
index: test_index
field: "i_*"
- match: {test_index.mappings.test_type.i_t1.full_name: obj.i_t1 }
- match: {test_index.mappings.test_type.i_t3.full_name: obj.i_t3 }
- length: {test_index.mappings.test_type: 2}
---
"Get field mapping should work using '_all' for indices and types":
- do:
indices.get_field_mapping:
index: _all
type: _all
field: "i_*"
- match: {test_index.mappings.test_type.i_t1.full_name: obj.i_t1 }
- match: {test_index.mappings.test_type.i_t3.full_name: obj.i_t3 }
- length: {test_index.mappings.test_type: 2}
- match: {test_index_2.mappings.test_type_2.i_t1.full_name: obj.i_t1 }
- match: {test_index_2.mappings.test_type_2.i_t3.full_name: obj.i_t3 }
- length: {test_index_2.mappings.test_type_2: 2}
---
"Get field mapping should work using '*' for indices and types":
- do:
indices.get_field_mapping:
index: '*'
type: '*'
field: "i_*"
- match: {test_index.mappings.test_type.i_t1.full_name: obj.i_t1 }
- match: {test_index.mappings.test_type.i_t3.full_name: obj.i_t3 }
- length: {test_index.mappings.test_type: 2}
- match: {test_index_2.mappings.test_type_2.i_t1.full_name: obj.i_t1 }
- match: {test_index_2.mappings.test_type_2.i_t3.full_name: obj.i_t3 }
- length: {test_index_2.mappings.test_type_2: 2}
---
"Get field mapping should work using comma_separated values for indices and types":
- do:
indices.get_field_mapping:
index: 'test_index,test_index_2'
type: 'test_type,test_type_2'
field: "i_*"
- match: {test_index.mappings.test_type.i_t1.full_name: obj.i_t1 }
- match: {test_index.mappings.test_type.i_t3.full_name: obj.i_t3 }
- length: {test_index.mappings.test_type: 2}
- match: {test_index_2.mappings.test_type_2.i_t1.full_name: obj.i_t1 }
- match: {test_index_2.mappings.test_type_2.i_t3.full_name: obj.i_t3 }
- length: {test_index_2.mappings.test_type_2: 2}