OpenSearch/rest-api-spec/test/delete/50_refresh.yaml

78 lines
1.7 KiB
YAML
Raw Normal View History

2013-06-28 11:17:23 -04:00
---
"Refresh":
2013-06-28 11:17:23 -04:00
- do:
indices.create:
index: test_1
body:
settings:
refresh_interval: -1
number_of_shards: 5
number_of_replicas: 0
2013-06-28 11:17:23 -04:00
- do:
cluster.health:
wait_for_status: green
2013-06-28 11:17:23 -04:00
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
refresh: 1
# If you wonder why this document get 3 as an id instead of 2, it is because the
# current routing algorithm would route 1 and 2 to the same shard while we need
# them to be different for this test to pass
2013-06-28 11:17:23 -04:00
- do:
index:
index: test_1
type: test
id: 3
2013-06-28 11:17:23 -04:00
body: { foo: bar }
refresh: 1
- do:
search:
index: test_1
type: test
body:
query: { terms: { _id: [1,3] }}
2013-06-28 11:17:23 -04:00
- match: { hits.total: 2 }
- do:
delete:
index: test_1
type: test
id: 1
- do:
search:
index: test_1
type: test
body:
query: { terms: { _id: [1,3] }}
2013-06-28 11:17:23 -04:00
- match: { hits.total: 2 }
- do:
delete:
index: test_1
type: test
id: 3
2013-06-28 11:17:23 -04:00
refresh: 1
# If a replica shard where doc 1 is located gets initialized at this point, doc 1
# won't be found by the following search as the shard gets automatically refreshed
# right before getting started. This is why this test only works with 0 replicas.
2013-06-28 11:17:23 -04:00
- do:
search:
index: test_1
type: test
body:
query: { terms: { _id: [1,3] }}
2013-06-28 11:17:23 -04:00
- match: { hits.total: 1 }