Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indices stats options #6390

Closed
wants to merge 10 commits into from
4 changes: 0 additions & 4 deletions rest-api-spec/test/indices.stats/10_basic.yaml

This file was deleted.

92 changes: 92 additions & 0 deletions rest-api-spec/test/indices.stats/10_index.yaml
@@ -0,0 +1,92 @@
---
setup:
- do:
indices.create:
index: test1
body:
settings:
number_of_shards: 5
number_of_replicas: 1

- do:
indices.create:
index: test2
body:
settings:
number_of_shards: 4
number_of_replicas: 1
- do:
index:
index: test1
type: bar
id: 1
body: { "foo": "bar" }

- do:
index:
index: test2
type: baz
id: 1
body: { "foo": "baz" }

---
"Index - blank":
- do:
indices.stats: {}

- match: { _shards.total: 18 }
- is_true: _all
- is_true: indices.test1
- is_true: indices.test2

---
"Index - all":
- do:
indices.stats: { index: _all }

- match: { _shards.total: 18 }
- is_true: _all
- is_true: indices.test1
- is_true: indices.test2


---
"Index - star":
- do:
indices.stats: { index: '*' }

- match: { _shards.total: 18 }
- is_true: _all
- is_true: indices.test1
- is_true: indices.test2

---
"Index - one index":
- do:
indices.stats: { index: 'test1' }

- match: { _shards.total: 10 }
- is_true: _all
- is_true: indices.test1
- is_false: indices.test2

---
"Index - multi-index":
- do:
indices.stats: { index: [test1, test2] }

- match: { _shards.total: 18 }
- is_true: _all
- is_true: indices.test1
- is_true: indices.test2

---
"Index - pattern":
- do:
indices.stats: { index: '*2' }

- match: { _shards.total: 8 }
- is_true: _all
- is_false: indices.test1
- is_true: indices.test2

110 changes: 110 additions & 0 deletions rest-api-spec/test/indices.stats/11_metric.yaml
@@ -0,0 +1,110 @@
---
setup:

- do:
index:
index: test1
type: bar
id: 1
body: { "foo": "bar" }

- do:
index:
index: test2
type: baz
id: 1
body: { "foo": "baz" }

---
"Metric - blank":
- do:
indices.stats: {}

- is_true: _all.total.docs
- is_true: _all.total.store
- is_true: _all.total.indexing
- is_true: _all.total.get
- is_true: _all.total.search
- is_true: _all.total.merges
- is_true: _all.total.refresh
- is_true: _all.total.flush
- is_true: _all.total.warmer
- is_true: _all.total.filter_cache
- is_true: _all.total.id_cache
- is_true: _all.total.fielddata
- is_true: _all.total.percolate
- is_true: _all.total.completion
- is_true: _all.total.segments
- is_true: _all.total.translog
- is_true: _all.total.suggest

---
"Metric - _all":
- do:
indices.stats: { metric: _all }

- is_true: _all.total.docs
- is_true: _all.total.store
- is_true: _all.total.indexing
- is_true: _all.total.get
- is_true: _all.total.search
- is_true: _all.total.merges
- is_true: _all.total.refresh
- is_true: _all.total.flush
- is_true: _all.total.warmer
- is_true: _all.total.filter_cache
- is_true: _all.total.id_cache
- is_true: _all.total.fielddata
- is_true: _all.total.percolate
- is_true: _all.total.completion
- is_true: _all.total.segments
- is_true: _all.total.translog
- is_true: _all.total.suggest

---
"Metric - one":
- do:
indices.stats: { metric: docs }

- is_true: _all.total.docs
- is_false: _all.total.store
- is_false: _all.total.indexing
- is_false: _all.total.get
- is_false: _all.total.search
- is_false: _all.total.merges
- is_false: _all.total.refresh
- is_false: _all.total.flush
- is_false: _all.total.warmer
- is_false: _all.total.filter_cache
- is_false: _all.total.id_cache
- is_false: _all.total.fielddata
- is_false: _all.total.percolate
- is_false: _all.total.completion
- is_false: _all.total.segments
- is_false: _all.total.translog
- is_false: _all.total.suggest

---
"Metric - multi":
- do:
indices.stats: { metric: [ store, get, merge ] }

- is_false: _all.total.docs
- is_true: _all.total.store
- is_false: _all.total.indexing
- is_true: _all.total.get
- is_false: _all.total.search
- is_true: _all.total.merges
- is_false: _all.total.refresh
- is_false: _all.total.flush
- is_false: _all.total.warmer
- is_false: _all.total.filter_cache
- is_false: _all.total.id_cache
- is_false: _all.total.fielddata
- is_false: _all.total.percolate
- is_false: _all.total.completion
- is_false: _all.total.segments
- is_false: _all.total.translog
- is_false: _all.total.suggest


69 changes: 69 additions & 0 deletions rest-api-spec/test/indices.stats/12_level.yaml
@@ -0,0 +1,69 @@
---
setup:

- do:
index:
index: test1
type: bar
id: 1
body: { "foo": "bar" }

- do:
index:
index: test2
type: baz
id: 1
body: { "foo": "baz" }

---
"Level - blank":
- do:
indices.stats: {}

- is_true: _all.total.docs
- is_true: _all.total.docs
- is_true: indices.test1.total.docs
- is_true: indices.test1.total.docs
- is_false: indices.test1.shards
- is_true: indices.test2.total.docs
- is_true: indices.test2.total.docs
- is_false: indices.test2.shards

---
"Level - indices":
- do:
indices.stats: { level: indices }

- is_true: _all.total.docs
- is_true: _all.total.docs
- is_true: indices.test1.total.docs
- is_true: indices.test1.total.docs
- is_false: indices.test1.shards
- is_true: indices.test2.total.docs
- is_true: indices.test2.total.docs
- is_false: indices.test2.shards

---
"Level - cluster":
- do:
indices.stats: { level: cluster }

- is_true: _all.total.docs
- is_true: _all.total.docs
- is_false: indices


---
"Level - shards":
- do:
indices.stats: { level: shards }

- is_true: _all.total.docs
- is_true: _all.total.docs
- is_true: indices.test1.total.docs
- is_true: indices.test1.total.docs
- is_true: indices.test1.shards.0.0.docs
- is_true: indices.test2.total.docs
- is_true: indices.test2.total.docs
- is_true: indices.test2.shards.0.0.docs