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
Closed
Indices stats options #6390
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
bd5ad7d
Stats: Indices stats ignoring "groups" and "types"
clintongormley f24ac7e
Stats: Make "groups" and "types" accept wildcards
clintongormley fe34d3b
Completion stats with field wildcards were not returning the real fie…
clintongormley 85b38d3
Added indices.stats YAML tests for:
clintongormley 89d36f6
Replaced for loop with Regex.simpleMatch with a variant which accepts…
clintongormley 5f92e2e
Added tests for all/one/multiple metrics with fields, groups, types
clintongormley 46521e5
Remove randomization of shard numbers in the indices.stats index tests
clintongormley 15d4301
With randomization, primaries may not reflect changes, so check total…
clintongormley d7b2e2c
Added Java tests
clintongormley 4f7c6a1
Tidied up tests as per @javanna's comments
clintongormley File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
setup: | ||
|
||
- 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: 20 } | ||
- is_true: _all | ||
- is_true: indices.test1 | ||
- is_true: indices.test2 | ||
|
||
--- | ||
"Index - all": | ||
- do: | ||
indices.stats: { index: _all } | ||
|
||
- match: { _shards.total: 20 } | ||
- is_true: _all | ||
- is_true: indices.test1 | ||
- is_true: indices.test2 | ||
|
||
|
||
--- | ||
"Index - star": | ||
- do: | ||
indices.stats: { index: '*' } | ||
|
||
- match: { _shards.total: 20 } | ||
- 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: 20 } | ||
- is_true: _all | ||
- is_true: indices.test1 | ||
- is_true: indices.test2 | ||
|
||
--- | ||
"Index - pattern": | ||
- do: | ||
indices.stats: { index: '*2' } | ||
|
||
- match: { _shards.total: 10 } | ||
- is_true: _all | ||
- is_false: indices.test1 | ||
- is_true: indices.test2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.primaries.docs | ||
- is_true: _all.primaries.store | ||
- is_true: _all.primaries.indexing | ||
- is_true: _all.primaries.get | ||
- is_true: _all.primaries.search | ||
- is_true: _all.primaries.merges | ||
- is_true: _all.primaries.refresh | ||
- is_true: _all.primaries.flush | ||
- is_true: _all.primaries.warmer | ||
- is_true: _all.primaries.filter_cache | ||
- is_true: _all.primaries.id_cache | ||
- is_true: _all.primaries.fielddata | ||
- is_true: _all.primaries.percolate | ||
- is_true: _all.primaries.completion | ||
- is_true: _all.primaries.segments | ||
- is_true: _all.primaries.translog | ||
- is_true: _all.primaries.suggest | ||
|
||
--- | ||
"Metric - _all": | ||
- do: | ||
indices.stats: { metric: _all } | ||
|
||
- is_true: _all.primaries.docs | ||
- is_true: _all.primaries.store | ||
- is_true: _all.primaries.indexing | ||
- is_true: _all.primaries.get | ||
- is_true: _all.primaries.search | ||
- is_true: _all.primaries.merges | ||
- is_true: _all.primaries.refresh | ||
- is_true: _all.primaries.flush | ||
- is_true: _all.primaries.warmer | ||
- is_true: _all.primaries.filter_cache | ||
- is_true: _all.primaries.id_cache | ||
- is_true: _all.primaries.fielddata | ||
- is_true: _all.primaries.percolate | ||
- is_true: _all.primaries.completion | ||
- is_true: _all.primaries.segments | ||
- is_true: _all.primaries.translog | ||
- is_true: _all.primaries.suggest | ||
|
||
--- | ||
"Metric - one": | ||
- do: | ||
indices.stats: { metric: docs } | ||
|
||
- is_true: _all.primaries.docs | ||
- is_false: _all.primaries.store | ||
- is_false: _all.primaries.indexing | ||
- is_false: _all.primaries.get | ||
- is_false: _all.primaries.search | ||
- is_false: _all.primaries.merges | ||
- is_false: _all.primaries.refresh | ||
- is_false: _all.primaries.flush | ||
- is_false: _all.primaries.warmer | ||
- is_false: _all.primaries.filter_cache | ||
- is_false: _all.primaries.id_cache | ||
- is_false: _all.primaries.fielddata | ||
- is_false: _all.primaries.percolate | ||
- is_false: _all.primaries.completion | ||
- is_false: _all.primaries.segments | ||
- is_false: _all.primaries.translog | ||
- is_false: _all.primaries.suggest | ||
|
||
--- | ||
"Metric - multi": | ||
- do: | ||
indices.stats: { metric: [ store, get, merge ] } | ||
|
||
- is_false: _all.primaries.docs | ||
- is_true: _all.primaries.store | ||
- is_false: _all.primaries.indexing | ||
- is_true: _all.primaries.get | ||
- is_false: _all.primaries.search | ||
- is_true: _all.primaries.merges | ||
- is_false: _all.primaries.refresh | ||
- is_false: _all.primaries.flush | ||
- is_false: _all.primaries.warmer | ||
- is_false: _all.primaries.filter_cache | ||
- is_false: _all.primaries.id_cache | ||
- is_false: _all.primaries.fielddata | ||
- is_false: _all.primaries.percolate | ||
- is_false: _all.primaries.completion | ||
- is_false: _all.primaries.segments | ||
- is_false: _all.primaries.translog | ||
- is_false: _all.primaries.suggest | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.primaries.docs | ||
- is_true: _all.total.docs | ||
- is_true: indices.test1.primaries.docs | ||
- is_true: indices.test1.total.docs | ||
- is_false: indices.test1.shards | ||
- is_true: indices.test2.primaries.docs | ||
- is_true: indices.test2.total.docs | ||
- is_false: indices.test2.shards | ||
|
||
--- | ||
"Level - indices": | ||
- do: | ||
indices.stats: { level: indices } | ||
|
||
- is_true: _all.primaries.docs | ||
- is_true: _all.total.docs | ||
- is_true: indices.test1.primaries.docs | ||
- is_true: indices.test1.total.docs | ||
- is_false: indices.test1.shards | ||
- is_true: indices.test2.primaries.docs | ||
- is_true: indices.test2.total.docs | ||
- is_false: indices.test2.shards | ||
|
||
--- | ||
"Level - cluster": | ||
- do: | ||
indices.stats: { level: cluster } | ||
|
||
- is_true: _all.primaries.docs | ||
- is_true: _all.total.docs | ||
- is_false: indices | ||
|
||
|
||
--- | ||
"Level - shards": | ||
- do: | ||
indices.stats: { level: shards } | ||
|
||
- is_true: _all.primaries.docs | ||
- is_true: _all.total.docs | ||
- is_true: indices.test1.primaries.docs | ||
- is_true: indices.test1.total.docs | ||
- is_true: indices.test1.shards.0.0.docs | ||
- is_true: indices.test2.primaries.docs | ||
- is_true: indices.test2.total.docs | ||
- is_true: indices.test2.shards.0.0.docs | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we assume we have 20 shards in the index?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we can. I'm checking the total number of defined shards, not active shards. The test creates two indices with default settings == 20 shards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we randomize these in java land. If we don't do it now, the day is not far away..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do randomize it....just run the tests and you'll see failures
mvn clean test -Dtests.class=*.ElasticsearchRestTests
or just run theElasticsearchRestTests
test form your IDE ;)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know - I've pushed a change to make the tests more determinative in this case :)