From 3b09f9d8e90178243f8a340a7bc324aab152c602 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 27 Sep 2023 12:26:48 -0500 Subject: [PATCH] [Backport 8.10] Added the similarity parameter to the KnnQuery type (#2300) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Josh Mock Co-authored-by: Peter Straßer --- 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 b01f87b0f8..3cbb5bf14a 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -42614,9 +42614,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", @@ -43957,7 +43969,7 @@ } } ], - "specLocation": "_types/Knn.ts#L43-L46", + "specLocation": "_types/Knn.ts#L45-L48", "variants": { "kind": "container" } @@ -46145,7 +46157,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 99ef5448c1..25845e4a36 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 */