|
| 1 | +setup: |
| 2 | + - requires: |
| 3 | + reason: 'exclude_vectors option is required' |
| 4 | + test_runner_features: [ capabilities ] |
| 5 | + capabilities: |
| 6 | + - method: GET |
| 7 | + path: /_search |
| 8 | + capabilities: [ exclude_vectors_param ] |
| 9 | + - skip: |
| 10 | + features: "headers" |
| 11 | + |
| 12 | + - do: |
| 13 | + indices.create: |
| 14 | + index: test |
| 15 | + body: |
| 16 | + mappings: |
| 17 | + properties: |
| 18 | + name: |
| 19 | + type: keyword |
| 20 | + sparse_vector: |
| 21 | + type: sparse_vector |
| 22 | + vector: |
| 23 | + type: dense_vector |
| 24 | + dims: 5 |
| 25 | + similarity: l2_norm |
| 26 | + |
| 27 | + nested: |
| 28 | + type: nested |
| 29 | + properties: |
| 30 | + paragraph_id: |
| 31 | + type: keyword |
| 32 | + vector: |
| 33 | + type: dense_vector |
| 34 | + dims: 5 |
| 35 | + similarity: l2_norm |
| 36 | + sparse_vector: |
| 37 | + type: sparse_vector |
| 38 | + |
| 39 | + - do: |
| 40 | + index: |
| 41 | + index: test |
| 42 | + id: "1" |
| 43 | + body: |
| 44 | + name: cow.jpg |
| 45 | + vector: [36, 267, -311, 12, -202] |
| 46 | + |
| 47 | + - do: |
| 48 | + index: |
| 49 | + index: test |
| 50 | + id: "2" |
| 51 | + body: |
| 52 | + name: moose.jpg |
| 53 | + nested: |
| 54 | + - paragraph_id: 0 |
| 55 | + vector: [-0.5, 100.0, -13, 14.8, -156.0] |
| 56 | + - paragraph_id: 2 |
| 57 | + vector: [0, 100.0, 0, 14.8, -156.0] |
| 58 | + - paragraph_id: 3 |
| 59 | + vector: [0, 1.0, 0, 1.8, -15.0] |
| 60 | + |
| 61 | + - do: |
| 62 | + index: |
| 63 | + index: test |
| 64 | + id: "3" |
| 65 | + body: |
| 66 | + name: rabbit.jpg |
| 67 | + vector: [-0.5, 100.0, -13, 14.8, -156.0] |
| 68 | + sparse_vector: |
| 69 | + running: 3 |
| 70 | + good: 17 |
| 71 | + run: 22 |
| 72 | + |
| 73 | + - do: |
| 74 | + index: |
| 75 | + index: test |
| 76 | + id: "4" |
| 77 | + body: |
| 78 | + name: zoolander.jpg |
| 79 | + nested: |
| 80 | + - paragraph_id: 0 |
| 81 | + vector: [ -0.5, 100.0, -13, 14.8, -156.0 ] |
| 82 | + sparse_vector: |
| 83 | + running: 3 |
| 84 | + good: 17 |
| 85 | + run: 22 |
| 86 | + - paragraph_id: 1 |
| 87 | + sparse_vector: |
| 88 | + modeling: 32 |
| 89 | + model: 20 |
| 90 | + mode: 54 |
| 91 | + - paragraph_id: 2 |
| 92 | + vector: [ -9.8, 109, 32, 14.8, 23 ] |
| 93 | + |
| 94 | + |
| 95 | + - do: |
| 96 | + indices.refresh: {} |
| 97 | + |
| 98 | +--- |
| 99 | +"exclude vectors": |
| 100 | + - do: |
| 101 | + search: |
| 102 | + index: test |
| 103 | + body: |
| 104 | + _source: |
| 105 | + exclude_vectors: true |
| 106 | + sort: ["name"] |
| 107 | + |
| 108 | + - match: { hits.hits.0._id: "1"} |
| 109 | + - match: { hits.hits.0._source.name: "cow.jpg"} |
| 110 | + - not_exists: hits.hits.0._source.vector |
| 111 | + |
| 112 | + - match: { hits.hits.1._id: "2"} |
| 113 | + - match: { hits.hits.1._source.name: "moose.jpg"} |
| 114 | + - length: { hits.hits.1._source.nested: 3 } |
| 115 | + - not_exists: hits.hits.1._source.nested.0.vector |
| 116 | + - match: { hits.hits.1._source.nested.0.paragraph_id: 0 } |
| 117 | + - not_exists: hits.hits.1._source.nested.1.vector |
| 118 | + - match: { hits.hits.1._source.nested.1.paragraph_id: 2 } |
| 119 | + - not_exists: hits.hits.1._source.nested.2.vector |
| 120 | + - match: { hits.hits.1._source.nested.2.paragraph_id: 3 } |
| 121 | + |
| 122 | + - match: { hits.hits.2._id: "3" } |
| 123 | + - match: { hits.hits.2._source.name: "rabbit.jpg" } |
| 124 | + - not_exists: hits.hits.2._source.vector |
| 125 | + - not_exists: hits.hits.2._source.sparse_vector |
| 126 | + |
| 127 | + - match: { hits.hits.3._id: "4" } |
| 128 | + - match: { hits.hits.3._source.name: "zoolander.jpg" } |
| 129 | + - length: { hits.hits.3._source.nested: 3 } |
| 130 | + - not_exists: hits.hits.3._source.nested.0.vector |
| 131 | + - not_exists: hits.hits.3._source.nested.0.sparse_vector |
| 132 | + - match: { hits.hits.3._source.nested.0.paragraph_id: 0 } |
| 133 | + - not_exists: hits.hits.3._source.nested.1.sparse_vector |
| 134 | + - match: { hits.hits.3._source.nested.1.paragraph_id: 1 } |
| 135 | + - not_exists: hits.hits.3._source.nested.2.vector |
| 136 | + - match: { hits.hits.3._source.nested.2.paragraph_id: 2 } |
| 137 | + |
| 138 | +--- |
| 139 | +"include vectors": |
| 140 | + - do: |
| 141 | + search: |
| 142 | + index: test |
| 143 | + body: |
| 144 | + _source: |
| 145 | + exclude_vectors: false |
| 146 | + sort: ["name"] |
| 147 | + |
| 148 | + - match: { hits.hits.0._id: "1"} |
| 149 | + - match: { hits.hits.0._source.name: "cow.jpg"} |
| 150 | + - exists: hits.hits.0._source.vector |
| 151 | + |
| 152 | + - match: { hits.hits.1._id: "2"} |
| 153 | + - match: { hits.hits.1._source.name: "moose.jpg"} |
| 154 | + - length: { hits.hits.1._source.nested: 3 } |
| 155 | + - exists: hits.hits.1._source.nested.0.vector |
| 156 | + - match: { hits.hits.1._source.nested.0.paragraph_id: 0 } |
| 157 | + - exists: hits.hits.1._source.nested.1.vector |
| 158 | + - match: { hits.hits.1._source.nested.1.paragraph_id: 2 } |
| 159 | + - exists: hits.hits.1._source.nested.2.vector |
| 160 | + - match: { hits.hits.1._source.nested.2.paragraph_id: 3 } |
| 161 | + |
| 162 | + - match: { hits.hits.2._id: "3" } |
| 163 | + - match: { hits.hits.2._source.name: "rabbit.jpg" } |
| 164 | + - exists: hits.hits.2._source.vector |
| 165 | + - exists: hits.hits.2._source.sparse_vector |
| 166 | + |
| 167 | + - match: { hits.hits.3._id: "4" } |
| 168 | + - match: { hits.hits.3._source.name: "zoolander.jpg" } |
| 169 | + - length: { hits.hits.3._source.nested: 3 } |
| 170 | + - exists: hits.hits.3._source.nested.0.vector |
| 171 | + - exists: hits.hits.3._source.nested.0.sparse_vector |
| 172 | + - match: { hits.hits.3._source.nested.0.paragraph_id: 0 } |
| 173 | + - exists: hits.hits.3._source.nested.1.sparse_vector |
| 174 | + - match: { hits.hits.3._source.nested.1.paragraph_id: 1 } |
| 175 | + - exists: hits.hits.3._source.nested.2.vector |
| 176 | + - match: { hits.hits.3._source.nested.2.paragraph_id: 2 } |
| 177 | + |
| 178 | +--- |
| 179 | +"exclude vectors with fields": |
| 180 | + - do: |
| 181 | + search: |
| 182 | + index: test |
| 183 | + body: |
| 184 | + _source: |
| 185 | + exclude_vectors: true |
| 186 | + sort: ["name"] |
| 187 | + fields: [vector, sparse_vector, nested.*] |
| 188 | + |
| 189 | + - match: { hits.hits.0._id: "1"} |
| 190 | + - match: { hits.hits.0._source.name: "cow.jpg"} |
| 191 | + - not_exists: hits.hits.0._source.vector |
| 192 | + - exists: hits.hits.0.fields.vector |
| 193 | + |
| 194 | + - match: { hits.hits.1._id: "2"} |
| 195 | + - match: { hits.hits.1._source.name: "moose.jpg"} |
| 196 | + - length: { hits.hits.1._source.nested: 3 } |
| 197 | + - not_exists: hits.hits.1._source.nested.0.vector |
| 198 | + - match: { hits.hits.1._source.nested.0.paragraph_id: 0 } |
| 199 | + - not_exists: hits.hits.1._source.nested.1.vector |
| 200 | + - match: { hits.hits.1._source.nested.1.paragraph_id: 2 } |
| 201 | + - not_exists: hits.hits.1._source.nested.2.vector |
| 202 | + - match: { hits.hits.1._source.nested.2.paragraph_id: 3 } |
| 203 | + |
| 204 | + - match: { hits.hits.2._id: "3" } |
| 205 | + - match: { hits.hits.2._source.name: "rabbit.jpg" } |
| 206 | + - not_exists: hits.hits.2._source.vector |
| 207 | + - exists: hits.hits.2.fields.vector |
| 208 | + - not_exists: hits.hits.2._source.sparse_vector |
| 209 | + - exists: hits.hits.2.fields.sparse_vector |
| 210 | + |
| 211 | + |
| 212 | + - match: { hits.hits.3._id: "4" } |
| 213 | + - match: { hits.hits.3._source.name: "zoolander.jpg" } |
| 214 | + - length: { hits.hits.3._source.nested: 3 } |
| 215 | + - not_exists: hits.hits.3._source.nested.0.vector |
| 216 | + - exists: hits.hits.3.fields.nested.0.vector |
| 217 | + - not_exists: hits.hits.3._source.nested.0.sparse_vector |
| 218 | + - match: { hits.hits.3._source.nested.0.paragraph_id: 0 } |
| 219 | + - exists: hits.hits.3.fields.nested.0.sparse_vector |
| 220 | + - not_exists: hits.hits.3._source.nested.1.sparse_vector |
| 221 | + - match: { hits.hits.3._source.nested.1.paragraph_id: 1 } |
| 222 | + - exists: hits.hits.3.fields.nested.1.sparse_vector |
| 223 | + - not_exists: hits.hits.3._source.nested.2.vector |
| 224 | + - match: { hits.hits.3._source.nested.2.paragraph_id: 2 } |
| 225 | + - exists: hits.hits.3.fields.nested.2.vector |
0 commit comments