OpenSearch/rest-api-spec/test/update/75_ttl.yaml

94 lines
1.7 KiB
YAML
Raw Normal View History

2013-06-28 13:44:13 -04:00
---
"TTL":
2013-06-28 13:44:13 -04:00
- do:
indices.create:
index: test_1
body:
mappings:
test:
_ttl:
enabled: 1
store: yes
default: 10s
- do:
cluster.health:
wait_for_status: yellow
# blank ttl
- do:
update:
index: test_1
type: test
id: 1
body:
doc: { foo: baz }
upsert: { foo: bar }
- do:
get:
index: test_1
type: test
id: 1
fields: _ttl
2013-06-28 13:44:13 -04:00
- lt: { fields._ttl: 10000}
- gt: { fields._ttl: 0}
# milliseconds
- do:
update:
index: test_1
type: test
id: 1
body:
doc: { foo: baz }
upsert: { foo: bar }
ttl: 100000
2013-06-28 13:44:13 -04:00
- do:
get:
index: test_1
type: test
id: 1
fields: _ttl
2013-06-28 13:44:13 -04:00
- lt: { fields._ttl: 100000}
- gt: { fields._ttl: 10000}
# duration
- do:
update:
index: test_1
type: test
id: 1
body:
doc: { foo: baz }
upsert: { foo: bar }
ttl: 20s
- do:
get:
index: test_1
type: test
id: 1
fields: _ttl
2013-06-28 13:44:13 -04:00
- lt: { fields._ttl: 20000}
- gt: { fields._ttl: 10000}
# with timestamp
- do:
catch: /AlreadyExpiredException/
index:
index: test_1
type: test
id: 1
body: { foo: bar }
ttl: 20s
timestamp: 2013-06-23T18:14:40