[TEST] test also aggregations and fix indendation

This commit is contained in:
javanna 2016-12-02 01:34:11 +01:00 committed by Luca Cavanna
parent f9eaee3c9c
commit 7d4b1d94b9
2 changed files with 117 additions and 73 deletions

View File

@ -2,17 +2,17 @@
"Index data and search on the mixed cluster":
- do:
indices.create:
index: test_index
body:
settings:
index:
number_of_replicas: 0
indices.create:
index: test_index
body:
settings:
index:
number_of_replicas: 0
- do:
bulk:
refresh: true
body:
bulk:
refresh: true
body:
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "local_cluster", "filter_field": 0}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
@ -25,66 +25,99 @@
- '{"f1": "local_cluster", "filter_field": 0}'
- do:
search:
index: test_index,my_remote_cluster|test_index
search:
index: test_index,my_remote_cluster|test_index
body:
aggs:
cluster:
terms:
field: f1.keyword
- match: { hits.total: 10 }
- match: { hits.total: 11 }
- length: { aggregations.cluster.buckets: 2 }
- match: { aggregations.cluster.buckets.0.key: "remote_cluster" }
- match: { aggregations.cluster.buckets.0.doc_count: 6 }
- match: { aggregations.cluster.buckets.1.key: "local_cluster" }
- match: { aggregations.cluster.buckets.1.doc_count: 5 }
- do:
search:
index: test_index,my_remote_cluster|test_index
body:
query:
term:
f1: remote_cluster
search:
index: test_index,my_remote_cluster|test_index
body:
query:
term:
f1: remote_cluster
aggs:
cluster:
terms:
field: f1.keyword
- match: { hits.total: 5}
- match: { hits.total: 6}
- match: { hits.hits.0._index: "my_remote_cluster|test_index"}
- length: { aggregations.cluster.buckets: 1 }
- match: { aggregations.cluster.buckets.0.key: "remote_cluster" }
- match: { aggregations.cluster.buckets.0.doc_count: 6 }
- do:
search:
index: my_remote_cluster|test_index
search:
index: my_remote_cluster|test_index
body:
aggs:
cluster:
terms:
field: f1.keyword
- match: { hits.total: 5}
- match: { hits.total: 6}
- match: { hits.hits.0._index: "my_remote_cluster|test_index"}
- length: { aggregations.cluster.buckets: 1 }
- match: { aggregations.cluster.buckets.0.key: "remote_cluster" }
- match: { aggregations.cluster.buckets.0.doc_count: 6 }
- do:
search:
index: test_index
search:
index: test_index
body:
aggs:
cluster:
terms:
field: f1.keyword
- match: { hits.total: 5}
- match: { hits.hits.0._index: "test_index"}
- length: { aggregations.cluster.buckets: 1 }
- match: { aggregations.cluster.buckets.0.key: "local_cluster" }
- match: { aggregations.cluster.buckets.0.doc_count: 5 }
---
"Add transient remote cluster based on the preset cluster":
- do:
cluster.get_settings:
include_defaults: true
cluster.get_settings:
include_defaults: true
- set: { defaults.action.search.remote.my_remote_cluster: remote_ip }
- do:
cluster.put_settings:
body:
transient:
action.search.remote.test_remote_cluster: $remote_ip
flat_settings: true
cluster.put_settings:
flat_settings: true
body:
transient:
action.search.remote.test_remote_cluster: $remote_ip
- match: {transient: {action.search.remote.test_remote_cluster: $remote_ip}}
- do:
search:
index: test_remote_cluster|test_index
search:
index: test_remote_cluster|test_index
- match: { hits.total: 5 }
- match: { hits.total: 6 }
- match: { hits.hits.0._index: "test_remote_cluster|test_index" }
---
"Search an filtered alias on the remote cluster":
- do:
search:
index: my_remote_cluster|aliased_test_index
search:
index: my_remote_cluster|aliased_test_index
- match: { hits.total: 2 }
- match: { hits.hits.0._source.filter_field: 1 }

View File

@ -1,46 +1,57 @@
---
"Index data and search on the old cluster":
- do:
- do:
indices.create:
index: test_index
body:
settings:
index:
number_of_replicas: 0
aliases:
aliased_test_index: # we use this alias in the multi cluster test to very filtered aliases work
filter:
term:
filter_field : 1
index: test_index
body:
settings:
index:
number_of_replicas: 0
aliases:
aliased_test_index: # we use this alias in the multi cluster test to very filtered aliases work
filter:
term:
filter_field : 1
- do:
bulk:
refresh: true
body:
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "remote_cluster", "filter_field": 0}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "remote_cluster", "filter_field": 1}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "remote_cluster", "filter_field": 0}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "remote_cluster", "filter_field": 1}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "remote_cluster", "filter_field": 0}'
- do:
bulk:
refresh: true
body:
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "remote_cluster", "filter_field": 0}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "remote_cluster", "filter_field": 1}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "remote_cluster", "filter_field": 0}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "remote_cluster", "filter_field": 1}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "remote_cluster", "filter_field": 0}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "remote_cluster", "filter_field": 0}'
- do:
search:
index: test_index
- match: { hits.total: 5 }
- do:
- do:
search:
index: aliased_test_index
index: test_index
body:
aggs:
cluster:
terms:
field: f1.keyword
- match: { hits.total: 2 }
- match: { hits.hits.0._source.filter_field: 1 }
- match: { hits.hits.0._index: "test_index" }
- match: { hits.total: 6 }
- length: { aggregations.cluster.buckets: 1 }
- match: { aggregations.cluster.buckets.0.key: "remote_cluster" }
- match: { aggregations.cluster.buckets.0.doc_count: 6 }
- do:
search:
index: aliased_test_index
- match: { hits.total: 2 }
- match: { hits.hits.0._source.filter_field: 1 }
- match: { hits.hits.0._index: "test_index" }