Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change behaviour of indices segments api to allow no indices
Using '_cat/segments' or the indices segments api without matching any index now returns empty result instead of throwing IndexMissingException. Closes #9219
- Loading branch information
Christoph Büscher
committed
Feb 12, 2015
1 parent
de41981
commit 41befaf
Showing
5 changed files
with
142 additions
and
7 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,5 +1,75 @@ | ||
--- | ||
"segments test": | ||
"no segments test": | ||
- do: | ||
indices.segments: | ||
allow_no_indices: true | ||
|
||
- match: { _shards.total: 0} | ||
- match: { indices: {}} | ||
|
||
- do: | ||
catch: missing | ||
indices.segments: | ||
allow_no_indices: false | ||
|
||
--- | ||
"basic segments test": | ||
|
||
- do: | ||
indices.create: | ||
index: index1 | ||
body: | ||
settings: | ||
number_of_shards: "1" | ||
number_of_replicas: "0" | ||
- do: | ||
index: | ||
index: index1 | ||
type: type | ||
body: { foo: bar } | ||
refresh: true | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: green | ||
|
||
- do: | ||
indices.segments: | ||
index: index1 | ||
|
||
- match: { _shards.total: 1} | ||
- match: { indices.index1.shards.0.0.routing.primary: true} | ||
- match: { indices.index1.shards.0.0.segments._0.num_docs: 1} | ||
|
||
--- | ||
"closed segments test": | ||
|
||
- do: | ||
indices.create: | ||
index: index1 | ||
body: | ||
settings: | ||
number_of_shards: "1" | ||
number_of_replicas: "0" | ||
- do: | ||
index: | ||
index: index1 | ||
type: type | ||
body: { foo: bar } | ||
refresh: true | ||
|
||
- do: | ||
indices.close: | ||
index: index1 | ||
|
||
- do: | ||
catch: forbidden | ||
indices.segments: | ||
index: index1 | ||
|
||
- do: | ||
indices.segments: | ||
index: index1 | ||
ignore_unavailable: true | ||
|
||
- match: { _shards.total: 0} |
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
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
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