Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ setup:
mappings:
properties:
vector:
type: rank_vectors
dims: 5
type: rank_vectors
dims: 5
byte_vector:
type: rank_vectors
dims: 5
element_type: byte
type: rank_vectors
dims: 5
element_type: byte
bit_vector:
type: rank_vectors
dims: 40
Expand All @@ -39,8 +39,8 @@ setup:
id: "3"
body:
vector: [[0.5, 111.3, -13.0, 14.8, -156.0]]
byte_vector: [[2, 18, -5, 0, -124]]
bit_vector: [[2, 18, -5, 0, -124]]
byte_vector: ["0212fb0084"]
bit_vector: ["0212fb0084"]

- do:
indices.refresh: {}
Expand Down Expand Up @@ -115,7 +115,7 @@ setup:
- match: {hits.hits.1._id: "3"}
- close_to: {hits.hits.1._score: {value: 2, error: 0.01}}

# doing max-sim dot product with a vector where the stored bit vectors are used as masks
# doing max-sim dot product with a vector where the stored bit vectors are used as masks
- do:
headers:
Content-Type: application/json
Expand Down Expand Up @@ -179,6 +179,28 @@ setup:
- match: {hits.hits.1._id: "1"}
- close_to: {hits.hits.1._score: {value: 0.65, 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: "maxSimInvHamming(params.query_vector, 'byte_vector')"
params:
query_vector: ["0102010101"]

- match: {hits.total: 2}

- match: {hits.hits.0._id: "3"}
- close_to: {hits.hits.0._score: {value: 0.675, error: 0.01}}

- match: {hits.hits.1._id: "1"}
- close_to: {hits.hits.1._score: {value: 0.65, error: 0.01}}

- do:
headers:
Content-Type: application/json
Expand All @@ -200,3 +222,25 @@ setup:

- match: {hits.hits.1._id: "1"}
- close_to: {hits.hits.1._score: {value: 0.65, 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: "maxSimInvHamming(params.query_vector, 'bit_vector')"
params:
query_vector: ["0102010101"]

- match: {hits.total: 2}

- match: {hits.hits.0._id: "3"}
- close_to: {hits.hits.0._score: {value: 0.675, error: 0.01}}

- match: {hits.hits.1._id: "1"}
- close_to: {hits.hits.1._score: {value: 0.65, error: 0.01}}