mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-06 13:08:29 +00:00
In order to prevent rare timing issue, where the creation of an index happens in the cluster state too late and thus results in empty mappings.
149 lines
4.8 KiB
YAML
149 lines
4.8 KiB
YAML
---
|
|
setup:
|
|
- do:
|
|
indices.create:
|
|
index: test_index
|
|
body:
|
|
mappings:
|
|
test_type:
|
|
properties:
|
|
t1:
|
|
type: string
|
|
t2:
|
|
type: string
|
|
obj:
|
|
path: just_name
|
|
properties:
|
|
t1:
|
|
type: string
|
|
i_t1:
|
|
type: string
|
|
index_name: t1
|
|
i_t3:
|
|
type: string
|
|
index_name: t3
|
|
|
|
- do:
|
|
indices.create:
|
|
index: test_index_2
|
|
body:
|
|
mappings:
|
|
test_type_2:
|
|
properties:
|
|
t1:
|
|
type: string
|
|
t2:
|
|
type: string
|
|
obj:
|
|
path: just_name
|
|
properties:
|
|
t1:
|
|
type: string
|
|
i_t1:
|
|
type: string
|
|
index_name: t1
|
|
i_t3:
|
|
type: string
|
|
index_name: t3
|
|
|
|
- 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*"
|
|
|
|
# i_t1 matches the pattern using it's index name, but t1 already means a full name
|
|
# of a field and thus takes precedence.
|
|
- 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.t3.full_name: obj.i_t3 }
|
|
- length: {test_index.mappings.test_type: 3}
|
|
|
|
---
|
|
"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}
|
|
|