Skip to content

Commit c91fe93

Browse files
committed
Added another YAML test
1 parent 1d7e258 commit c91fe93

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/70_semantic_text_exists_query.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,109 @@ setup:
202202

203203
- match: { hits.total.value: 1 }
204204
- match: { hits.hits.0._id: "doc2" }
205+
206+
---
207+
"Exists query with indexed documents with copy_to":
208+
- do:
209+
indices.create:
210+
index: test-sparse-index-with-copy-to
211+
body:
212+
mappings:
213+
properties:
214+
inference_field:
215+
type: semantic_text
216+
inference_id: sparse-inference-id
217+
source_field:
218+
type: text
219+
copy_to: inference_field
220+
text_field:
221+
type: text
222+
223+
- do:
224+
index:
225+
index: test-sparse-index-with-copy-to
226+
id: doc1
227+
body:
228+
text_field: "foo"
229+
refresh: true
230+
231+
- do:
232+
search:
233+
index: test-sparse-index-with-copy-to
234+
body:
235+
query:
236+
exists:
237+
field: "inference_field"
238+
239+
- match: { hits.total.value: 0 }
240+
241+
- do:
242+
index:
243+
index: test-sparse-index-with-copy-to
244+
id: doc2
245+
body:
246+
source_field: "bar"
247+
refresh: true
248+
249+
- do:
250+
search:
251+
index: test-sparse-index-with-copy-to
252+
body:
253+
query:
254+
exists:
255+
field: "inference_field"
256+
257+
- match: { hits.total.value: 1 }
258+
- match: { hits.hits.0._id: "doc2" }
259+
260+
- do:
261+
indices.create:
262+
index: test-dense-index-with-copy-to
263+
body:
264+
mappings:
265+
properties:
266+
inference_field:
267+
type: semantic_text
268+
inference_id: dense-inference-id
269+
source_field:
270+
type: text
271+
copy_to: inference_field
272+
text_field:
273+
type: text
274+
275+
- do:
276+
index:
277+
index: test-dense-index-with-copy-to
278+
id: doc1
279+
body:
280+
text_field: "foo"
281+
refresh: true
282+
283+
- do:
284+
search:
285+
index: test-dense-index-with-copy-to
286+
body:
287+
query:
288+
exists:
289+
field: "inference_field"
290+
291+
- match: { hits.total.value: 0 }
292+
293+
- do:
294+
index:
295+
index: test-dense-index-with-copy-to
296+
id: doc2
297+
body:
298+
source_field: "bar"
299+
refresh: true
300+
301+
- do:
302+
search:
303+
index: test-dense-index-with-copy-to
304+
body:
305+
query:
306+
exists:
307+
field: "inference_field"
308+
309+
- match: { hits.total.value: 1 }
310+
- match: { hits.hits.0._id: "doc2" }

0 commit comments

Comments
 (0)