@@ -2116,3 +2116,143 @@ setup:
21162116 - contains : {hits.hits: {_id: "2"}}
21172117 - contains : {hits.hits: {_id: "21"}}
21182118 - contains : {hits.hits: {_id: "31"}}
2119+
2120+ ---
2121+ " Test update flat --> bbq_flat --> bbq_hnsw " :
2122+ - requires :
2123+ capabilities :
2124+ - method : POST
2125+ path : /_search
2126+ capabilities : [ optimized_scalar_quantization_bbq ]
2127+ test_runner_features : capabilities
2128+ reason : " BBQ scoring improved and changed with optimized_scalar_quantization_bbq"
2129+ - do :
2130+ indices.create :
2131+ index : vectors_64
2132+ body :
2133+ settings :
2134+ index :
2135+ number_of_shards : 1
2136+ mappings :
2137+ properties :
2138+ vector :
2139+ type : dense_vector
2140+ dims : 64
2141+ index : true
2142+ similarity : max_inner_product
2143+ index_options :
2144+ type : flat
2145+
2146+ - do :
2147+ index :
2148+ index : vectors_64
2149+ id : " 1"
2150+ body :
2151+ vector : [0.077, 0.32 , -0.205, 0.63 , 0.032, 0.201, 0.167, -0.313,
2152+ 0.176, 0.531, -0.375, 0.334, -0.046, 0.078, -0.349, 0.272,
2153+ 0.307, -0.083, 0.504, 0.255, -0.404, 0.289, -0.226, -0.132,
2154+ -0.216, 0.49 , 0.039, 0.507, -0.307, 0.107, 0.09 , -0.265,
2155+ -0.285, 0.336, -0.272, 0.369, -0.282, 0.086, -0.132, 0.475,
2156+ -0.224, 0.203, 0.439, 0.064, 0.246, -0.396, 0.297, 0.242,
2157+ -0.028, 0.321, -0.022, -0.009, -0.001 , 0.031, -0.533, 0.45,
2158+ -0.683, 1.331, 0.194, -0.157, -0.1 , -0.279, -0.098, -0.176]
2159+ - do :
2160+ indices.flush :
2161+ index : vectors_64
2162+ - do :
2163+ indices.put_mapping :
2164+ index : vectors_64
2165+ body :
2166+ properties :
2167+ embedding :
2168+ type : dense_vector
2169+ dims : 64
2170+ index_options :
2171+ type : bbq_flat
2172+
2173+ - do :
2174+ indices.get_mapping :
2175+ index : vectors_64
2176+
2177+ - match : { test_index.mappings.properties.embedding.type: dense_vector }
2178+ - match : { test_index.mappings.properties.embedding.index_options.type: bbq_flat }
2179+
2180+ - do :
2181+ index :
2182+ index : vectors_64
2183+ id : " 2"
2184+ body :
2185+ vector : [0.196, 0.514, 0.039, 0.555, -0.042, 0.242, 0.463, -0.348,
2186+ -0.08 , 0.442, -0.067, -0.05 , -0.001, 0.298, -0.377, 0.048,
2187+ 0.307, 0.159, 0.278, 0.119, -0.057, 0.333, -0.289, -0.438,
2188+ -0.014, 0.361, -0.169, 0.292, -0.229, 0.123, 0.031, -0.138,
2189+ -0.139, 0.315, -0.216, 0.322, -0.445, -0.059, 0.071, 0.429,
2190+ -0.602, -0.142, 0.11 , 0.192, 0.259, -0.241, 0.181, -0.166,
2191+ 0.082, 0.107, -0.05 , 0.155, 0.011, 0.161, -0.486, 0.569,
2192+ -0.489, 0.901, 0.208, 0.011, -0.209, -0.153, -0.27 , -0.013]
2193+ - do :
2194+ indices.flush :
2195+ index : vectors_64
2196+ - do :
2197+ indices.put_mapping :
2198+ index : vectors_64
2199+ body :
2200+ properties :
2201+ embedding :
2202+ type : dense_vector
2203+ dims : 64
2204+ index_options :
2205+ type : bbq_hnsw
2206+
2207+ - do :
2208+ indices.get_mapping :
2209+ index : vectors_64
2210+
2211+ - match : { test_index.mappings.properties.embedding.type: dense_vector }
2212+ - match : { test_index.mappings.properties.embedding.index_options.type: bbq_hnsw }
2213+
2214+ - do :
2215+ index :
2216+ index : vectors_64
2217+ id : " 3"
2218+ body :
2219+ name : rabbit.jpg
2220+ vector : [0.139, 0.178, -0.117, 0.399, 0.014, -0.139, 0.347, -0.33 ,
2221+ 0.139, 0.34 , -0.052, -0.052, -0.249, 0.327, -0.288, 0.049,
2222+ 0.464, 0.338, 0.516, 0.247, -0.104, 0.259, -0.209, -0.246,
2223+ -0.11 , 0.323, 0.091, 0.442, -0.254, 0.195, -0.109, -0.058,
2224+ -0.279, 0.402, -0.107, 0.308, -0.273, 0.019, 0.082, 0.399,
2225+ -0.658, -0.03 , 0.276, 0.041, 0.187, -0.331, 0.165, 0.017,
2226+ 0.171, -0.203, -0.198, 0.115, -0.007, 0.337, -0.444, 0.615,
2227+ -0.683, 1.331, 0.194, -0.157, -0.1 , -0.279, -0.098, -0.176]
2228+ - do :
2229+ indices.flush :
2230+ index : vectors_64
2231+
2232+ - do :
2233+ indices.forcemerge :
2234+ index : vectors_64
2235+ max_num_segments : 1
2236+
2237+ - do :
2238+ indices.refresh : { }
2239+ - do :
2240+ search :
2241+ index : vectors_64
2242+ body :
2243+ knn :
2244+ field : vector
2245+ query_vector : [ 0.128, 0.067, -0.08 , 0.395, -0.11 , -0.259, 0.473, -0.393,
2246+ 0.292, 0.571, -0.491, 0.444, -0.288, 0.198, -0.343, 0.015,
2247+ 0.232, 0.088, 0.228, 0.151, -0.136, 0.236, -0.273, -0.259,
2248+ -0.217, 0.359, -0.207, 0.352, -0.142, 0.192, -0.061, -0.17 ,
2249+ -0.343, 0.189, -0.221, 0.32 , -0.301, -0.1 , 0.005, 0.232,
2250+ -0.344, 0.136, 0.252, 0.157, -0.13 , -0.244, 0.193, -0.034,
2251+ -0.12 , -0.193, -0.102, 0.252, -0.185, -0.167, -0.575, 0.582,
2252+ -0.426, 0.983, 0.212, 0.204, 0.03 , -0.276, -0.425, -0.158 ]
2253+ k : 3
2254+ num_candidates : 3
2255+
2256+ - match : { hits.hits.0._id: "1" }
2257+ - match : { hits.hits.1._id: "3" }
2258+ - match : { hits.hits.2._id: "2" }
0 commit comments