|
@@ -101,9 +101,15 @@ setup:
|
|
|
|
|
|
- match: {hits.hits.2._id: "3"}
|
|
|
- close_to: {hits.hits.2._score: {value: 3.4641016, error: 0.01}}
|
|
|
-
|
|
|
---
|
|
|
"Dot Product is not supported":
|
|
|
+ - skip:
|
|
|
+ features: [capabilities]
|
|
|
+ capabilities:
|
|
|
+ - method: POST
|
|
|
+ path: /_search
|
|
|
+ capabilities: [ byte_float_bit_dot_product ]
|
|
|
+ reason: Capability required to run test
|
|
|
- do:
|
|
|
catch: bad_request
|
|
|
headers:
|
|
@@ -131,7 +137,6 @@ setup:
|
|
|
source: "dotProduct(params.query_vector, 'vector')"
|
|
|
params:
|
|
|
query_vector: "006ff30e84"
|
|
|
-
|
|
|
---
|
|
|
"Cosine Similarity is not supported":
|
|
|
- do:
|
|
@@ -388,3 +393,119 @@ setup:
|
|
|
|
|
|
- match: {hits.hits.2._id: "3"}
|
|
|
- match: {hits.hits.2._score: 11.0}
|
|
|
+---
|
|
|
+"Dot product with float":
|
|
|
+ - requires:
|
|
|
+ capabilities:
|
|
|
+ - method: POST
|
|
|
+ path: /_search
|
|
|
+ capabilities: [ byte_float_bit_dot_product ]
|
|
|
+ test_runner_features: [capabilities, close_to]
|
|
|
+ reason: Capability required to run test
|
|
|
+ - do:
|
|
|
+ headers:
|
|
|
+ Content-Type: application/json
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ query:
|
|
|
+ script_score:
|
|
|
+ query: { match_all: { } }
|
|
|
+ script:
|
|
|
+ source: "dotProduct(params.query_vector, 'vector')"
|
|
|
+ params:
|
|
|
+ query_vector: [0.23, 1.45, 3.67, 4.89, -0.56, 2.34, 3.21, 1.78, -2.45, 0.98, -0.12, 3.45, 4.56, 2.78, 1.23, 0.67, 3.89, 4.12, -2.34, 1.56, 0.78, 3.21, 4.12, 2.45, -1.67, 0.34, -3.45, 4.56, -2.78, 1.23, -0.67, 3.89, -4.34, 2.12, -1.56, 0.78, -3.21, 4.45, 2.12, 1.67]
|
|
|
+
|
|
|
+ - match: { hits.total: 3 }
|
|
|
+
|
|
|
+ - match: {hits.hits.0._id: "2"}
|
|
|
+ - close_to: {hits.hits.0._score: {value: 35.999, error: 0.01}}
|
|
|
+
|
|
|
+ - match: {hits.hits.1._id: "3"}
|
|
|
+ - close_to: {hits.hits.1._score:{value: 27.23, error: 0.01}}
|
|
|
+
|
|
|
+ - match: {hits.hits.2._id: "1"}
|
|
|
+ - close_to: {hits.hits.2._score: {value: 16.57, error: 0.01}}
|
|
|
+
|
|
|
+ - do:
|
|
|
+ headers:
|
|
|
+ Content-Type: application/json
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ query:
|
|
|
+ script_score:
|
|
|
+ query: { match_all: { } }
|
|
|
+ script:
|
|
|
+ source: "dotProduct(params.query_vector, 'indexed_vector')"
|
|
|
+ params:
|
|
|
+ query_vector: [0.23, 1.45, 3.67, 4.89, -0.56, 2.34, 3.21, 1.78, -2.45, 0.98, -0.12, 3.45, 4.56, 2.78, 1.23, 0.67, 3.89, 4.12, -2.34, 1.56, 0.78, 3.21, 4.12, 2.45, -1.67, 0.34, -3.45, 4.56, -2.78, 1.23, -0.67, 3.89, -4.34, 2.12, -1.56, 0.78, -3.21, 4.45, 2.12, 1.67]
|
|
|
+
|
|
|
+ - match: { hits.total: 3 }
|
|
|
+
|
|
|
+ - match: {hits.hits.0._id: "2"}
|
|
|
+ - close_to: {hits.hits.0._score: {value: 35.999, error: 0.01}}
|
|
|
+
|
|
|
+ - match: {hits.hits.1._id: "3"}
|
|
|
+ - close_to: {hits.hits.1._score:{value: 27.23, error: 0.01}}
|
|
|
+
|
|
|
+ - match: {hits.hits.2._id: "1"}
|
|
|
+ - close_to: {hits.hits.2._score: {value: 16.57, error: 0.01}}
|
|
|
+---
|
|
|
+"Dot product with byte":
|
|
|
+ - requires:
|
|
|
+ capabilities:
|
|
|
+ - method: POST
|
|
|
+ path: /_search
|
|
|
+ capabilities: [ byte_float_bit_dot_product ]
|
|
|
+ test_runner_features: capabilities
|
|
|
+ reason: Capability required to run test
|
|
|
+ - do:
|
|
|
+ headers:
|
|
|
+ Content-Type: application/json
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ query:
|
|
|
+ script_score:
|
|
|
+ query: { match_all: { } }
|
|
|
+ script:
|
|
|
+ source: "dotProduct(params.query_vector, 'vector')"
|
|
|
+ params:
|
|
|
+ query_vector: [12, -34, 56, -78, 90, 12, 34, -56, 78, -90, 23, -45, 67, -89, 12, 34, 56, 78, 90, -12, 34, -56, 78, -90, 23, -45, 67, -89, 12, -34, 56, -78, 90, -12, 34, -56, 78, 90, 23, -45]
|
|
|
+
|
|
|
+ - match: { hits.total: 3 }
|
|
|
+
|
|
|
+ - match: {hits.hits.0._id: "1"}
|
|
|
+ - match: {hits.hits.0._score: 248}
|
|
|
+
|
|
|
+ - match: {hits.hits.1._id: "2"}
|
|
|
+ - match: {hits.hits.1._score: 136}
|
|
|
+
|
|
|
+ - match: {hits.hits.2._id: "3"}
|
|
|
+ - match: {hits.hits.2._score: 20}
|
|
|
+
|
|
|
+ - do:
|
|
|
+ headers:
|
|
|
+ Content-Type: application/json
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ query:
|
|
|
+ script_score:
|
|
|
+ query: { match_all: { } }
|
|
|
+ script:
|
|
|
+ source: "dotProduct(params.query_vector, 'indexed_vector')"
|
|
|
+ params:
|
|
|
+ query_vector: [12, -34, 56, -78, 90, 12, 34, -56, 78, -90, 23, -45, 67, -89, 12, 34, 56, 78, 90, -12, 34, -56, 78, -90, 23, -45, 67, -89, 12, -34, 56, -78, 90, -12, 34, -56, 78, 90, 23, -45]
|
|
|
+
|
|
|
+ - match: { hits.total: 3 }
|
|
|
+
|
|
|
+ - match: {hits.hits.0._id: "1"}
|
|
|
+ - match: {hits.hits.0._score: 248}
|
|
|
+
|
|
|
+ - match: {hits.hits.1._id: "2"}
|
|
|
+ - match: {hits.hits.1._score: 136}
|
|
|
+
|
|
|
+ - match: {hits.hits.2._id: "3"}
|
|
|
+ - match: {hits.hits.2._score: 20}
|