summaryrefslogtreecommitdiff
path: root/rest-api-spec/test/create/75_ttl.yaml
diff options
context:
space:
mode:
authorHilko Bengen <bengen@debian.org>2014-06-07 12:02:12 +0200
committerHilko Bengen <bengen@debian.org>2014-06-07 12:02:12 +0200
commitd5ed89b946297270ec28abf44bef2371a06f1f4f (patch)
treece2d945e4dde69af90bd9905a70d8d27f4936776 /rest-api-spec/test/create/75_ttl.yaml
downloadelasticsearch-d5ed89b946297270ec28abf44bef2371a06f1f4f.tar.gz
Imported Upstream version 1.0.3upstream/1.0.3
Diffstat (limited to 'rest-api-spec/test/create/75_ttl.yaml')
-rw-r--r--rest-api-spec/test/create/75_ttl.yaml104
1 files changed, 104 insertions, 0 deletions
diff --git a/rest-api-spec/test/create/75_ttl.yaml b/rest-api-spec/test/create/75_ttl.yaml
new file mode 100644
index 0000000..05eb88e
--- /dev/null
+++ b/rest-api-spec/test/create/75_ttl.yaml
@@ -0,0 +1,104 @@
+---
+"TTL":
+
+ - skip:
+ features: gtelte
+
+ - 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:
+ create:
+ index: test_1
+ type: test
+ id: 1
+ body: { foo: bar }
+
+ - do:
+ get:
+ index: test_1
+ type: test
+ id: 1
+ fields: _ttl
+
+ - lte: { fields._ttl: 10000}
+ - gt: { fields._ttl: 0}
+
+# milliseconds
+
+ - do:
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ - do:
+ create:
+ index: test_1
+ type: test
+ id: 1
+ body: { foo: bar }
+ ttl: 100000
+ - do:
+ get:
+ index: test_1
+ type: test
+ id: 1
+ fields: _ttl
+
+ - lte: { fields._ttl: 100000}
+ - gt: { fields._ttl: 10000}
+
+# duration
+
+ - do:
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ - do:
+ create:
+ index: test_1
+ type: test
+ id: 1
+ body: { foo: bar }
+ ttl: 20s
+
+ - do:
+ get:
+ index: test_1
+ type: test
+ id: 1
+ fields: _ttl
+
+ - lte: { fields._ttl: 20000}
+ - gt: { fields._ttl: 10000}
+
+# with timestamp
+
+ - do:
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ - do:
+ catch: /AlreadyExpiredException/
+ create:
+ index: test_1
+ type: test
+ id: 1
+ body: { foo: bar }
+ ttl: 20s
+ timestamp: 2013-06-23T18:14:40
+