Skip to content

Commit

Permalink
Update knn search and query template autocomplete (elastic#207187)
Browse files Browse the repository at this point in the history
(cherry picked from commit 1dc2aca)
  • Loading branch information
carlosdelest committed Jan 20, 2025
1 parent 2d9d9c6 commit c9eda11
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,35 @@ export const query = (specService: SpecDefinitionsService) => {
_scope: '',
query: {},
},
knn: {
__template: {
field: '',
k: 10,
num_candidates: 100,
query_vector_builder: {
text_embedding: {
model_id: '',
model_text: '',
},
},
},
field: '{field}',
filter: { __scope_link: 'GLOBAL.filter' },
k: 10,
num_candidates: 100,
query_vector: [],
query_vector_builder: {
text_embedding: {
model_id: '',
model_text: '',
},
},
rescore_vector: {
oversample: 1.5,
},
similarity: { __one_of: ['l2_norm', 'cosine', 'dot_product', 'max_inner_product'] },
boost: 1.0,
},
match_all: {
boost: 1,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ export const search = (specService: SpecDefinitionsService) => {
knn: {
__template: {
field: '',
query_vector_builder: {
text_embedding: {
model_id: '',
model_text: '',
},
},
k: 10,
num_candidates: 100,
},
Expand All @@ -236,9 +242,17 @@ export const search = (specService: SpecDefinitionsService) => {
k: 10,
num_candidates: 100,
query_vector: [],
query_vector_builder: {},
similarity: { __one_of: ['l2_norm', 'cosine', 'dot_product'] },
query_vector_builder: {
text_embedding: {
model_id: '',
model_text: '',
},
},
similarity: { __one_of: ['l2_norm', 'cosine', 'dot_product', 'max_inner_product'] },
boost: 1.0,
rescore_vector: {
oversample: 1.5,
},
},
[
{
Expand All @@ -248,8 +262,11 @@ export const search = (specService: SpecDefinitionsService) => {
num_candidates: 100,
query_vector: [],
query_vector_builder: {},
similarity: { __one_of: ['l2_norm', 'cosine', 'dot_product'] },
similarity: { __one_of: ['l2_norm', 'cosine', 'dot_product', 'max_inner_product'] },
boost: 1.0,
rescore_vector: {
oversample: 1.5,
},
},
],
],
Expand Down

0 comments on commit c9eda11

Please sign in to comment.