Christoph Büscher 41befaf6b5 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
2015-02-12 14:42:15 +01:00

76 lines
1.3 KiB
YAML

---
"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}