-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update knn query spec Signed-off-by: Alex Keeler <[email protected]> * Update changelog, add periods to descriptions Signed-off-by: Alex Keeler <[email protected]> * Add version restriction, lint fix to knn test Signed-off-by: Alex Keeler <[email protected]> * Add version constraint for knn filter Signed-off-by: Alex Keeler <[email protected]> --------- Signed-off-by: Alex Keeler <[email protected]>
- Loading branch information
1 parent
e553ab1
commit 14d819b
Showing
6 changed files
with
183 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
$schema: ../../../../json_schemas/test_story.schema.yaml | ||
|
||
description: Test search endpoint with knn query. | ||
version: '>= 1.2' | ||
prologues: | ||
- path: /movies | ||
method: PUT | ||
request: | ||
payload: | ||
settings: | ||
index: | ||
knn: true | ||
mappings: | ||
properties: | ||
director: | ||
type: text | ||
title: | ||
type: text | ||
year: | ||
type: integer | ||
embedding: | ||
type: knn_vector | ||
dimension: 5 | ||
method: | ||
name: hnsw | ||
space_type: l2 | ||
engine: faiss | ||
- path: /movies/_doc | ||
method: POST | ||
parameters: | ||
refresh: true | ||
request: | ||
payload: | ||
director: Bennett Miller | ||
title: Moneyball | ||
year: 2011 | ||
embedding: [1.4, 2.3, 3.5, 4.1, 9.2] | ||
status: [201] | ||
epilogues: | ||
- path: /movies | ||
method: DELETE | ||
status: [200, 404] | ||
chapters: | ||
- synopsis: Search using the k parameter. | ||
path: /{index}/_search | ||
parameters: | ||
index: movies | ||
method: POST | ||
request: | ||
payload: | ||
query: | ||
knn: | ||
embedding: | ||
vector: [1.4, 2.3, 3.5, 4.1, 9.2] | ||
k: 1 | ||
response: | ||
status: 200 | ||
payload: | ||
timed_out: false | ||
hits: | ||
total: | ||
value: 1 | ||
relation: eq | ||
hits: | ||
- _index: movies | ||
_score: 1 | ||
_source: | ||
director: Bennett Miller | ||
title: Moneyball | ||
year: 2011 | ||
embedding: [1.4, 2.3, 3.5, 4.1, 9.2] | ||
|
||
- synopsis: Search using the min_score parameter. | ||
version: '>= 2.14' | ||
path: /{index}/_search | ||
parameters: | ||
index: movies | ||
method: POST | ||
request: | ||
payload: | ||
query: | ||
knn: | ||
embedding: | ||
vector: [1.4, 2.3, 3.5, 4.1, 9.2] | ||
min_score: 0.9 | ||
response: | ||
status: 200 | ||
payload: | ||
timed_out: false | ||
hits: | ||
total: | ||
value: 1 | ||
relation: eq | ||
hits: | ||
- _index: movies | ||
_score: 1 | ||
_source: | ||
director: Bennett Miller | ||
title: Moneyball | ||
year: 2011 | ||
embedding: [1.4, 2.3, 3.5, 4.1, 9.2] | ||
|
||
- synopsis: Search using the max_distance parameter. | ||
version: '>= 2.14' | ||
path: /{index}/_search | ||
parameters: | ||
index: movies | ||
method: POST | ||
request: | ||
payload: | ||
query: | ||
knn: | ||
embedding: | ||
vector: [1.4,2.3, 3.5, 4.1, 9.2] | ||
max_distance: 0.1 | ||
response: | ||
status: 200 | ||
payload: | ||
timed_out: false | ||
hits: | ||
total: | ||
value: 1 | ||
relation: eq | ||
hits: | ||
- _index: movies | ||
_score: 1 | ||
_source: | ||
director: Bennett Miller | ||
title: Moneyball | ||
year: 2011 | ||
embedding: [1.4, 2.3, 3.5, 4.1, 9.2] | ||
|
||
- synopsis: Search using a filter. | ||
version: '>= 2.9' | ||
path: /{index}/_search | ||
parameters: | ||
index: movies | ||
method: POST | ||
request: | ||
payload: | ||
query: | ||
knn: | ||
embedding: | ||
vector: [1.4, 2.3, 3.5, 4.1, 9.2] | ||
k: 1 | ||
filter: | ||
term: | ||
year: 2012 | ||
response: | ||
status: 200 | ||
payload: | ||
timed_out: false | ||
hits: | ||
total: | ||
value: 0 | ||
relation: eq | ||
hits: [] |