Add tests for cross cluster `_field_caps` API (elastic/x-pack-elasticsearch#1294)
This commit adds REST tests to ensure `_field_caps` works with cross cluster search and security. Relates to elastic/elasticsearch#24463 Original commit: elastic/x-pack-elasticsearch@2af0a8c179
This commit is contained in:
parent
ea31227a89
commit
eddc7a2147
|
@ -0,0 +1,106 @@
|
|||
---
|
||||
setup:
|
||||
- skip:
|
||||
features: headers
|
||||
|
||||
- do:
|
||||
cluster.health:
|
||||
wait_for_status: yellow
|
||||
- do:
|
||||
xpack.security.put_user:
|
||||
username: "joe"
|
||||
body: >
|
||||
{
|
||||
"password": "s3krit",
|
||||
"roles" : [ "x_cluster_role" ]
|
||||
}
|
||||
- do:
|
||||
xpack.security.put_role:
|
||||
name: "x_cluster_role"
|
||||
body: >
|
||||
{
|
||||
"cluster": ["all"],
|
||||
"indices": [
|
||||
{
|
||||
"names": ["field_caps_index_2", "my_remote_cluster:field_caps_index_1", "my_remote_cluster:field_caps_index_3"],
|
||||
"privileges": ["read"]
|
||||
}
|
||||
]
|
||||
}
|
||||
---
|
||||
teardown:
|
||||
- do:
|
||||
xpack.security.delete_user:
|
||||
username: "joe"
|
||||
ignore: 404
|
||||
- do:
|
||||
xpack.security.delete_role:
|
||||
name: "x_cluster_role"
|
||||
ignore: 404
|
||||
---
|
||||
"Get simple field caps from remote cluster":
|
||||
- skip:
|
||||
version: " - 5.4.99"
|
||||
reason: this uses a new API that has been added in 5.5.0
|
||||
|
||||
- do:
|
||||
indices.create:
|
||||
index: field_caps_index_2
|
||||
body:
|
||||
mappings:
|
||||
t:
|
||||
properties:
|
||||
text:
|
||||
type: text
|
||||
keyword:
|
||||
type: keyword
|
||||
number:
|
||||
type: double
|
||||
geo:
|
||||
type: geo_point
|
||||
object:
|
||||
type: object
|
||||
properties:
|
||||
nested1 :
|
||||
type : text
|
||||
index: true
|
||||
nested2:
|
||||
type: float
|
||||
doc_values: true
|
||||
|
||||
- do:
|
||||
headers: { Authorization: "Basic am9lOnMza3JpdA==" }
|
||||
field_caps:
|
||||
index: 'field_caps_index_2,my_remote_cluster:field_caps_index_1,my_remote_cluster:field_caps_index_3'
|
||||
fields: [text, keyword, number, geo]
|
||||
|
||||
- match: {fields.text.text.searchable: true}
|
||||
- match: {fields.text.text.aggregatable: false}
|
||||
- is_false: fields.text.text.indices
|
||||
- is_false: fields.text.text.non_searchable_indices
|
||||
- is_false: fields.text.text.non_aggregatable_indices
|
||||
- match: {fields.keyword.keyword.searchable: true}
|
||||
- match: {fields.keyword.keyword.aggregatable: true}
|
||||
- is_false: fields.text.keyword.indices
|
||||
- is_false: fields.text.keyword.non_searchable_indices
|
||||
- is_false: fields.text.keyword.non_aggregatable_indices
|
||||
- match: {fields.number.double.searchable: true}
|
||||
- match: {fields.number.double.aggregatable: true}
|
||||
- match: {fields.number.double.indices: ["field_caps_index_2", "my_remote_cluster:field_caps_index_1"]}
|
||||
- is_false: fields.number.double.non_searchable_indices
|
||||
- is_false: fields.number.double.non_aggregatable_indices
|
||||
- match: {fields.number.long.searchable: true}
|
||||
- match: {fields.number.long.aggregatable: true}
|
||||
- match: {fields.number.long.indices: ["my_remote_cluster:field_caps_index_3"]}
|
||||
- is_false: fields.number.long.non_searchable_indices
|
||||
- is_false: fields.number.long.non_aggregatable_indices
|
||||
- match: {fields.geo.geo_point.searchable: true}
|
||||
- match: {fields.geo.geo_point.aggregatable: true}
|
||||
- match: {fields.geo.geo_point.indices: ["field_caps_index_2", "my_remote_cluster:field_caps_index_1"]}
|
||||
- is_false: fields.geo.geo_point.non_searchable_indices
|
||||
- is_false: fields.geo.geo_point.non_aggregatable_indices
|
||||
- match: {fields.geo.keyword.searchable: true}
|
||||
- match: {fields.geo.keyword.aggregatable: true}
|
||||
- match: {fields.geo.keyword.indices: ["my_remote_cluster:field_caps_index_3"]}
|
||||
- is_false: fields.geo.keyword.non_searchable_indices
|
||||
- is_false: fields.geo.keyword.on_aggregatable_indices
|
|
@ -22,13 +22,61 @@ setup:
|
|||
"cluster": ["monitor"],
|
||||
"indices": [
|
||||
{
|
||||
"names": ["test_index", "aliased_test_index"],
|
||||
"names": ["test_index", "aliased_test_index", "field_caps_index_1", "field_caps_index_3"],
|
||||
"privileges": ["read", "read_cross_cluster"]
|
||||
}
|
||||
]
|
||||
}
|
||||
---
|
||||
"Index data and search on the remote cluster":
|
||||
- do:
|
||||
indices.create:
|
||||
index: field_caps_index_1
|
||||
body:
|
||||
mappings:
|
||||
t:
|
||||
properties:
|
||||
text:
|
||||
type: text
|
||||
keyword:
|
||||
type: keyword
|
||||
number:
|
||||
type: double
|
||||
geo:
|
||||
type: geo_point
|
||||
object:
|
||||
type: object
|
||||
properties:
|
||||
nested1 :
|
||||
type : text
|
||||
index: false
|
||||
nested2:
|
||||
type: float
|
||||
doc_values: false
|
||||
- do:
|
||||
indices.create:
|
||||
index: field_caps_index_3
|
||||
body:
|
||||
mappings:
|
||||
t:
|
||||
properties:
|
||||
text:
|
||||
type: text
|
||||
keyword:
|
||||
type: keyword
|
||||
number:
|
||||
type: long
|
||||
geo:
|
||||
type: keyword
|
||||
object:
|
||||
type: object
|
||||
properties:
|
||||
nested1 :
|
||||
type : long
|
||||
index: false
|
||||
nested2:
|
||||
type: keyword
|
||||
doc_values: false
|
||||
|
||||
- do:
|
||||
indices.create:
|
||||
|
|
Loading…
Reference in New Issue