@@ -15,7 +15,7 @@ expert cases, where there is a need to combine this query with other queries.
15
15
16
16
[source,console]
17
17
----
18
- PUT image-index
18
+ PUT my- image-index
19
19
{
20
20
"mappings": {
21
21
"properties": {
@@ -25,15 +25,6 @@ PUT image-index
25
25
"index": true,
26
26
"similarity": "l2_norm"
27
27
},
28
- "title-vector": {
29
- "type": "dense_vector",
30
- "dims": 5,
31
- "index": true,
32
- "similarity": "l2_norm"
33
- },
34
- "title": {
35
- "type": "text"
36
- },
37
28
"file-type": {
38
29
"type": "keyword"
39
30
}
@@ -47,23 +38,21 @@ PUT image-index
47
38
+
48
39
[source,console]
49
40
----
50
- POST image-index/_bulk?refresh=true
41
+ POST my- image-index/_bulk?refresh=true
51
42
{ "index": { "_id": "1" } }
52
- { "image-vector": [1, 5, -20], "title-vector": [12, 50, -10, 0, 1], "title": "moose family", " file-type": "jpg" }
43
+ { "image-vector": [1, 5, -20], "file-type": "jpg" }
53
44
{ "index": { "_id": "2" } }
54
- { "image-vector": [42, 8, -15], "title-vector": [25, 1, 4, -12, 2], "title": "alpine lake", " file-type": "png" }
45
+ { "image-vector": [42, 8, -15], "file-type": "png" }
55
46
{ "index": { "_id": "3" } }
56
- { "image-vector": [15, 11, 23], "title-vector": [1, 5, 25, 50, 20], "title": "full moon", "file-type": "jpg" }
57
- ...
47
+ { "image-vector": [15, 11, 23], "file-type": "jpg" }
58
48
----
59
49
//TEST[continued]
60
- //TEST[s/\.\.\.//]
61
50
62
51
. Run the search using the `knn` query, asking for the top 3 nearest vectors.
63
52
+
64
53
[source,console]
65
54
----
66
- POST image-index/_search
55
+ POST my- image-index/_search
67
56
{
68
57
"size" : 3,
69
58
"query" : {
@@ -72,8 +61,7 @@ POST image-index/_search
72
61
"query_vector": [-5, 9, -12],
73
62
"num_candidates": 10
74
63
}
75
- },
76
- "fields": [ "title", "file-type" ]
64
+ }
77
65
}
78
66
----
79
67
//TEST[continued]
@@ -168,7 +156,7 @@ that passes the post-filter.
168
156
169
157
[source,console]
170
158
----
171
- POST image-index/_search
159
+ POST my- image-index/_search
172
160
{
173
161
"size" : 10,
174
162
"query" : {
@@ -184,8 +172,7 @@ POST image-index/_search
184
172
"term" : { "file-type" : "png" }
185
173
}
186
174
}
187
- },
188
- "fields": [ "title", "file-type" ]
175
+ }
189
176
}
190
177
----
191
178
//TEST[continued]
0 commit comments