2121 type : keyword
2222 vector :
2323 type : dense_vector
24- dims : 5
24+ dims : 3
2525 similarity : l2_norm
2626
2727 nested :
3131 type : keyword
3232 vector :
3333 type : dense_vector
34- dims : 5
34+ dims : 3
3535 similarity : l2_norm
3636
3737 - do :
4040 id : " 1"
4141 body :
4242 name : cow.jpg
43- vector : [36, 267, -311, 12, -202 ]
43+ vector : [1, 2, 3 ]
4444
4545 - do :
4646 index :
@@ -50,19 +50,19 @@ setup:
5050 name : moose.jpg
5151 nested :
5252 - paragraph_id : 0
53- vector : [-0.5, 100.0, -13, 14.8, -156.0 ]
53+ vector : [1, 2, 3 ]
5454 - paragraph_id : 2
55- vector : [0, 100.0, 0, 14.8, -156.0 ]
55+ vector : [4, 5, 6 ]
5656 - paragraph_id : 3
57- vector : [0, 1.0, 0, 1. 8, -15.0 ]
57+ vector : [7, 8, 9 ]
5858
5959 - do :
6060 index :
6161 index : test
6262 id : " 3"
6363 body :
6464 name : rabbit.jpg
65- vector : [-0.5, 100.0, -13, 14.8, -156.0 ]
65+ vector : [10, 11, 12 ]
6666
6767 - do :
6868 index :
@@ -72,11 +72,10 @@ setup:
7272 name : zoolander.jpg
7373 nested :
7474 - paragraph_id : 0
75- vector : [ -0.5, 100.0, - 13, 14.8, -156.0 ]
75+ vector : [ 13, 14, 15 ]
7676 - paragraph_id : 1
7777 - paragraph_id : 2
78- vector : [ -9.8, 109, 32, 14.8, 23 ]
79-
78+ vector : [ 16, 17, 18 ]
8079
8180 - do :
8281 indices.refresh : {}
@@ -148,4 +147,134 @@ setup:
148147 - match : { hits.hits.3._source.name: "zoolander.jpg" }
149148 - length : { hits.hits.3._source.nested: 3 }
150149 - exists : hits.hits.3._source.nested.0.vector
150+ - length : { hits.hits.3._source.nested.0.vector: 3 }
151151 - match : { hits.hits.3._source.nested.0.paragraph_id: 0 }
152+
153+ ---
154+ " Bulk partial update with synthetic vectors " :
155+ - do :
156+ headers :
157+ # Force JSON content type so that we use a parser that interprets the embeddings as doubles
158+ Content-Type : application/json
159+ bulk :
160+ index : test
161+ _source : true
162+ body :
163+ - ' {"update": {"_id": "4"}}'
164+ - >
165+ {
166+ "doc": {
167+ "name": "zoolander2.jpg",
168+ "vector": [1, 2, 4]
169+ }
170+ }
171+
172+ - match : { items.0.update.get._source.vector: [1, 2, 4] }
173+ - exists : items.0.update.get._source.nested
174+ - length : { items.0.update.get._source.nested: 3}
175+ - exists : items.0.update.get._source.nested.0.vector
176+ - match : { items.0.update.get._source.nested.0.paragraph_id: 0 }
177+ - length : { items.0.update.get._source.nested.0.vector: 3 }
178+ - not_exists : items.0.update.get._source.nested.1.vector
179+ - match : { items.0.update.get._source.nested.1.paragraph_id: 1 }
180+ - exists : items.0.update.get._source.nested.2.vector
181+ - length : { items.0.update.get._source.nested.2.vector: 3 }
182+ - match : { items.0.update.get._source.nested.2.paragraph_id: 2 }
183+ - set : { items.0.update.get._source.nested: original_nested }
184+
185+ - do :
186+ headers :
187+ # Force JSON content type so that we use a parser that interprets the embeddings as doubles
188+ Content-Type : application/json
189+ get :
190+ _source_exclude_vectors : false
191+ index : test
192+ id : " 4"
193+
194+ - match : { _source.vector: [1.0, 2.0, 4.0] }
195+ - match : { _source.name: zoolander2.jpg }
196+ - match : { _source.nested: $original_nested }
197+
198+ - do :
199+ indices.refresh : {}
200+
201+ - do :
202+ headers :
203+ # Force JSON content type so that we use a parser that interprets the embeddings as doubles
204+ Content-Type : application/json
205+ search :
206+ index : test
207+ body :
208+ _source :
209+ " exclude_vectors " : false
210+ query :
211+ term :
212+ _id : 4
213+
214+ - match : { hits.total.value: 1 }
215+ - match : { hits.total.relation: eq }
216+ - match : { hits.hits.0._source.name: zoolander2.jpg }
217+ - match : { hits.hits.0._source.nested: $original_nested }
218+
219+ ---
220+ " Partial update with synthetic vectors " :
221+ - do :
222+ headers :
223+ # Force JSON content type so that we use a parser that interprets the embeddings as doubles
224+ Content-Type : application/json
225+ update :
226+ index : test
227+ id : " 4"
228+ body :
229+ _source : true
230+ doc : {
231+ " name " : " zoolander3.jpg" ,
232+ " vector " : [6, 8, 9]
233+ }
234+
235+ - match : { get._source.vector: [6, 8, 9] }
236+ - exists : get._source.nested
237+ - length : { get._source.nested: 3}
238+ - exists : get._source.nested.0.vector
239+ - match : { get._source.nested.0.paragraph_id: 0 }
240+ - length : { get._source.nested.0.vector: 3 }
241+ - not_exists : get._source.nested.1.vector
242+ - match : { get._source.nested.1.paragraph_id: 1 }
243+ - exists : get._source.nested.2.vector
244+ - length : { get._source.nested.2.vector: 3 }
245+ - match : { get._source.nested.2.paragraph_id: 2 }
246+ - set : { get._source.nested: original_nested }
247+
248+ - do :
249+ headers :
250+ # Force JSON content type so that we use a parser that interprets the embeddings as doubles
251+ Content-Type : application/json
252+ get :
253+ _source_exclude_vectors : false
254+ index : test
255+ id : " 4"
256+
257+ - match : { _source.vector: [6.0, 8.0, 9.0] }
258+ - match : { _source.name: zoolander3.jpg }
259+ - match : { _source.nested: $original_nested }
260+
261+ - do :
262+ indices.refresh : {}
263+
264+ - do :
265+ headers :
266+ # Force JSON content type so that we use a parser that interprets the embeddings as doubles
267+ Content-Type : application/json
268+ search :
269+ index : test
270+ body :
271+ _source :
272+ " exclude_vectors " : false
273+ query :
274+ term :
275+ _id : 4
276+
277+ - match : { hits.total.value: 1 }
278+ - match : { hits.total.relation: eq }
279+ - match : { hits.hits.0._source.name: zoolander3.jpg }
280+ - match : { hits.hits.0._source.nested: $original_nested }
0 commit comments