-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollover.yml
68 lines (63 loc) · 1.49 KB
/
rollover.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
requires:
serverless: true
stack: true
---
teardown:
- do:
indices.delete: { index: test-logs-1, ignore: 404 }
- do:
indices.delete: { index: test-logs-000002, ignore: 404 }
---
"Rollover index via API":
# create index with alias
- do:
indices.create:
index: test-logs-1
body:
aliases:
test_logs_index: {}
test_logs_search: {}
# index document
- do:
index:
index: test-logs-1
id: "1"
body: { "foo": "hello world" }
# make this doc visible in index stats
refresh: true
- do:
get:
index: test_logs_search
id: "1"
- match: { _index: test-logs-1 }
- match: { _id: "1" }
- match: { _source: { foo: "hello world" } }
# perform alias rollover
- do:
indices.rollover:
alias: "test_logs_search"
- match: { old_index: test-logs-1 }
- match: { new_index: test-logs-000002 }
- match: { rolled_over: true }
- match: { dry_run: false }
# ensure new index is created
- do:
indices.exists:
index: test-logs-000002
- is_true: ''
# index into new index
- do:
index:
index: test-logs-000002
id: "2"
body: { "foo": "hello world" }
- do:
indices.refresh: {}
# check alias points to the new index
- do:
search:
rest_total_hits_as_int: true
index: test_logs_search
- match: { hits.total: 1 }
- match: { hits.hits.0._index: "test-logs-000002"}