Skip to content

Commit bc055fb

Browse files
authored
Synthetic source: tests for disabling subobjects (#87261) (#87295)
This adds some paranoid tests for synthetic source with disabling subobjects, as added by #86166. It turns out that synthetic source does exactly what you'd expect with disabling subobjects - it creates fields with dots in their names. This adds tests for that.
1 parent 525cc3c commit bc055fb

File tree

1 file changed

+160
-0
lines changed

1 file changed

+160
-0
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/index/91_metrics_no_subobjects.yml

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@
4646
- match: {fields.metrics\.time\.min.long.searchable: true}
4747
- match: {fields.metrics\.time\.min.long.aggregatable: true}
4848

49+
- do:
50+
get:
51+
index: test-1
52+
id: 1
53+
- match: {_index: "test-1"}
54+
- match: {_id: "1"}
55+
- match: {_version: 1}
56+
- match: {found: true}
57+
- match:
58+
_source:
59+
metrics.host.name: localhost
60+
metrics.host.id: 1
61+
metrics.time: 10
62+
metrics.time.max: 100
63+
metrics.time.min: 1
64+
4965
---
5066
"Root without subobjects":
5167
- skip:
@@ -88,3 +104,147 @@
88104
- match: {fields.time\.max.long.aggregatable: true}
89105
- match: {fields.time\.min.long.searchable: true}
90106
- match: {fields.time\.min.long.aggregatable: true}
107+
108+
- do:
109+
get:
110+
index: test-1
111+
id: 1
112+
- match: {_index: "test-1"}
113+
- match: {_id: "1"}
114+
- match: {_version: 1}
115+
- match: {found: true}
116+
- match:
117+
_source:
118+
host.name: localhost
119+
host.id: 1
120+
time: 10
121+
time.max: 100
122+
time.min: 1
123+
124+
---
125+
"Metrics object indexing with synthetic source":
126+
- skip:
127+
features: allowed_warnings_regex
128+
version: " - 8.2.99"
129+
reason: added in 8.3.0
130+
131+
- do:
132+
indices.put_template:
133+
name: test
134+
body:
135+
index_patterns: test-*
136+
mappings:
137+
_source:
138+
synthetic: true
139+
dynamic_templates:
140+
- no_subobjects:
141+
match: metrics
142+
mapping:
143+
type: object
144+
subobjects: false
145+
properties:
146+
host.name:
147+
type: keyword
148+
149+
- do:
150+
allowed_warnings_regex:
151+
- "index \\[test-1\\] matches multiple legacy templates \\[global, test\\], composable templates will only match a single template"
152+
index:
153+
index: test-1
154+
id: 1
155+
refresh: true
156+
body:
157+
{ metrics.host.name: localhost, metrics.host.id: 1, metrics.time: 10, metrics.time.max: 100, metrics.time.min: 1 }
158+
159+
- do:
160+
field_caps:
161+
index: test-1
162+
fields: metrics*
163+
- match: {fields.metrics\.host\.id.long.searchable: true}
164+
- match: {fields.metrics\.host\.id.long.aggregatable: true}
165+
- match: {fields.metrics\.host\.name.keyword.searchable: true}
166+
- match: {fields.metrics\.host\.name.keyword.aggregatable: true}
167+
- match: {fields.metrics\.time.long.searchable: true}
168+
- match: {fields.metrics\.time.long.aggregatable: true}
169+
- match: {fields.metrics\.time\.max.long.searchable: true}
170+
- match: {fields.metrics\.time\.max.long.aggregatable: true}
171+
- match: {fields.metrics\.time\.min.long.searchable: true}
172+
- match: {fields.metrics\.time\.min.long.aggregatable: true}
173+
174+
- do:
175+
get:
176+
index: test-1
177+
id: 1
178+
- match: {_index: "test-1"}
179+
- match: {_id: "1"}
180+
- match: {_version: 1}
181+
- match: {found: true}
182+
- match:
183+
_source:
184+
metrics:
185+
host.name: localhost
186+
host.id: 1
187+
time: 10
188+
time.max: 100
189+
time.min: 1
190+
191+
---
192+
"Root without subobjects with synthetic source":
193+
- skip:
194+
features: allowed_warnings_regex
195+
version: " - 8.2.99"
196+
reason: added in 8.3.0
197+
198+
- do:
199+
indices.put_template:
200+
name: test
201+
body:
202+
index_patterns: test-*
203+
mappings:
204+
_source:
205+
synthetic: true
206+
subobjects: false
207+
properties:
208+
host.name:
209+
type: keyword
210+
211+
- do:
212+
allowed_warnings_regex:
213+
- "index \\[test-1\\] matches multiple legacy templates \\[global, test\\], composable templates will only match a single template"
214+
index:
215+
index: test-1
216+
id: 1
217+
refresh: true
218+
body:
219+
{ host.name: localhost, host.id: 1, time: 10, time.max: 100, time.min: 1 }
220+
221+
- do:
222+
field_caps:
223+
index: test-1
224+
fields: [host*, time*]
225+
- match: {fields.host\.name.keyword.searchable: true}
226+
- match: {fields.host\.name.keyword.aggregatable: true}
227+
- match: {fields.host\.id.long.searchable: true}
228+
- match: {fields.host\.id.long.aggregatable: true}
229+
- match: {fields.time.long.searchable: true}
230+
- match: {fields.time.long.aggregatable: true}
231+
- match: {fields.time\.max.long.searchable: true}
232+
- match: {fields.time\.max.long.aggregatable: true}
233+
- match: {fields.time\.min.long.searchable: true}
234+
- match: {fields.time\.min.long.aggregatable: true}
235+
236+
- do:
237+
get:
238+
index: test-1
239+
id: 1
240+
- match: {_index: "test-1"}
241+
- match: {_id: "1"}
242+
- match: {_version: 1}
243+
- match: {found: true}
244+
- match:
245+
_source:
246+
host.name: localhost
247+
host.id: 1
248+
time: 10
249+
time.max: 100
250+
time.min: 1

0 commit comments

Comments
 (0)