From 5cdcd992257654b0aac79e03bd8429cb187478bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Stra=C3=9Fer?= Date: Wed, 27 Sep 2023 19:25:07 +0200 Subject: [PATCH] Added the similarity parameter to the KnnQuery type (#2261) Co-authored-by: Josh Mock (cherry picked from commit 0fb6d8efddbd0482f20c1ba8b54de81945afd7f0) --- output/schema/schema.json | 18 +++++++++++++++--- output/typescript/types.ts | 1 + specification/_types/Knn.ts | 4 +++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index 9566514cec..5a68455ed4 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -37507,9 +37507,21 @@ ], "kind": "union_of" } + }, + { + "description": "The minimum similarity for a vector to be considered a match", + "name": "similarity", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "float", + "namespace": "_types" + } + } } ], - "specLocation": "_types/Knn.ts#L26-L41" + "specLocation": "_types/Knn.ts#L26-L43" }, { "kind": "interface", @@ -38834,7 +38846,7 @@ } } ], - "specLocation": "_types/Knn.ts#L43-L46", + "specLocation": "_types/Knn.ts#L45-L48", "variants": { "kind": "container" } @@ -40982,7 +40994,7 @@ } } ], - "specLocation": "_types/Knn.ts#L48-L51" + "specLocation": "_types/Knn.ts#L50-L53" }, { "kind": "enum", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 98c55e7b21..394577c707 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -2303,6 +2303,7 @@ export interface KnnQuery { num_candidates: long boost?: float filter?: QueryDslQueryContainer | QueryDslQueryContainer[] + similarity?: float } export interface LatLonGeoLocation { diff --git a/specification/_types/Knn.ts b/specification/_types/Knn.ts index 2a3b4a9422..3ac82a11ed 100644 --- a/specification/_types/Knn.ts +++ b/specification/_types/Knn.ts @@ -18,7 +18,7 @@ */ import { Field } from '@_types/common' -import { long, double, float } from '@_types/Numeric' +import { long, float } from '@_types/Numeric' import { QueryContainer } from './query_dsl/abstractions' export type QueryVector = float[] @@ -38,6 +38,8 @@ export interface KnnQuery { boost?: float /** Filters for the kNN search query */ filter?: QueryContainer | QueryContainer[] + /** The minimum similarity for a vector to be considered a match */ + similarity?: float } /** @variants container */