From 0fb6d8efddbd0482f20c1ba8b54de81945afd7f0 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 --- 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 108107e4a4..08181442bc 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -43161,9 +43161,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", @@ -44506,7 +44518,7 @@ } } ], - "specLocation": "_types/Knn.ts#L43-L46", + "specLocation": "_types/Knn.ts#L45-L48", "variants": { "kind": "container" } @@ -46697,7 +46709,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 74fdb7c48d..65a485072d 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -2339,6 +2339,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 */