Skip to content

Commit 59b2d57

Browse files
committed
Add REST test with nested field in time-series index
1 parent 7c614fd commit 59b2d57

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
"Create TSDB index with field of nested type":
3+
- do:
4+
indices.create:
5+
index: test
6+
body:
7+
settings:
8+
index:
9+
mode: time_series
10+
number_of_replicas: 1
11+
number_of_shards: 1
12+
routing_path: [department]
13+
time_series:
14+
start_time: 2021-04-28T00:00:00Z
15+
end_time: 2021-04-29T00:00:00Z
16+
mappings:
17+
properties:
18+
"@timestamp":
19+
type: date
20+
department:
21+
type: keyword
22+
time_series_dimension: true
23+
staff:
24+
type: integer
25+
courses:
26+
type: nested
27+
properties:
28+
name:
29+
type: keyword
30+
credits:
31+
type: integer
32+
33+
- do:
34+
index:
35+
index: test
36+
body: { "@timestamp": "2021-04-28T01:00:00Z", "department": "compsci", "staff": 12, "courses": [ { "name": "Object Oriented Programming", "credits": 3 }, { "name": "Theory of Computation", "credits": 4, } ] }
37+
38+
- do:
39+
index:
40+
index: test
41+
body: { "@timestamp": "2021-04-28T02:00:00Z", "department": "math", "staff": 20, "courses": [ { "name": "Precalculus", "credits": 1 }, { "name": "Linear Algebra", "credits": 3 } ] }
42+
43+
- do:
44+
indices.refresh:
45+
index: [ test ]
46+
47+
- do:
48+
search:
49+
index: test
50+
body:
51+
size: 0
52+
query:
53+
bool:
54+
must:
55+
- term:
56+
courses.name: Precalculus
57+
- term:
58+
courses.credits: 3
59+
60+
- match:
61+
hits.total.value: 0

0 commit comments

Comments
 (0)