From 3e8a541473ed848d3d97b2b017da5e7155895e14 Mon Sep 17 00:00:00 2001 From: Benjamin Trent <4357155+benwtrent@users.noreply.github.com> Date: Tue, 1 Apr 2025 11:17:02 -0400 Subject: [PATCH 1/2] adding rescore_vector to dense vector mapping definition options --- output/openapi/elasticsearch-openapi.json | 15 ++++++++ .../elasticsearch-serverless-openapi.json | 15 ++++++++ output/schema/schema-serverless.json | 38 ++++++++++++++++++- output/schema/schema.json | 38 ++++++++++++++++++- output/typescript/types.ts | 5 +++ .../_types/mapping/DenseVectorProperty.ts | 14 +++++++ 6 files changed, 121 insertions(+), 4 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 8429217e9f..81fe87744b 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -68854,6 +68854,9 @@ }, "type": { "$ref": "#/components/schemas/_types.mapping:DenseVectorIndexOptionsType" + }, + "rescore_vector": { + "$ref": "#/components/schemas/_types.mapping:DenseVectorIndexOptionsRescoreVector" } }, "required": [ @@ -68871,6 +68874,18 @@ "int8_hnsw" ] }, + "_types.mapping:DenseVectorIndexOptionsRescoreVector": { + "type": "object", + "properties": { + "oversample": { + "description": "The oversampling factor to use when searching for the nearest neighbor. This is only applicable to the quantized formats: `bbq_*`, `int4_*`, and `int8_*`. \nWhen provided, `oversample * k` vectors will be gathered and then their scores will be re-computed with the original vectors.\n\nvalid values are between `1.0` and `10.0` (inclusive), or `0` exactly to disable oversampling.", + "type": "number" + } + }, + "required": [ + "oversample" + ] + }, "_types.mapping:DenseVectorSimilarity": { "type": "string", "enum": [ diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 7636d00df4..176796ae6c 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -45468,6 +45468,9 @@ }, "type": { "$ref": "#/components/schemas/_types.mapping:DenseVectorIndexOptionsType" + }, + "rescore_vector": { + "$ref": "#/components/schemas/_types.mapping:DenseVectorIndexOptionsRescoreVector" } }, "required": [ @@ -45485,6 +45488,18 @@ "int8_hnsw" ] }, + "_types.mapping:DenseVectorIndexOptionsRescoreVector": { + "type": "object", + "properties": { + "oversample": { + "description": "The oversampling factor to use when searching for the nearest neighbor. This is only applicable to the quantized formats: `bbq_*`, `int4_*`, and `int8_*`. \nWhen provided, `oversample * k` vectors will be gathered and then their scores will be re-computed with the original vectors.\n\nvalid values are between `1.0` and `10.0` (inclusive), or `0` exactly to disable oversampling.", + "type": "number" + } + }, + "required": [ + "oversample" + ] + }, "_types.mapping:DenseVectorSimilarity": { "type": "string", "enum": [ diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 0249316eda..f60a2aaf60 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -94197,7 +94197,7 @@ "name": "DenseVectorIndexOptionsType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/DenseVectorProperty.ts#L164-L197" + "specLocation": "_types/mapping/DenseVectorProperty.ts#L168-L201" }, { "kind": "enum", @@ -96795,9 +96795,43 @@ "namespace": "_types.mapping" } } + }, + { + "description": "The rescore vector options. This is only applicable to `bbq_hnsw`, `int4_hnsw`, `int8_hnsw`, `bbq_flat`, `int4_flat`, and `int8_flat` index types.", + "name": "rescore_vector", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "DenseVectorIndexOptionsRescoreVector", + "namespace": "_types.mapping" + } + } + } + ], + "specLocation": "_types/mapping/DenseVectorProperty.ts#L129-L166" + }, + { + "kind": "interface", + "name": { + "name": "DenseVectorIndexOptionsRescoreVector", + "namespace": "_types.mapping" + }, + "properties": [ + { + "description": "The oversampling factor to use when searching for the nearest neighbor. This is only applicable to the quantized formats: `bbq_*`, `int4_*`, and `int8_*`. \nWhen provided, `oversample * k` vectors will be gathered and then their scores will be re-computed with the original vectors.\n\nvalid values are between `1.0` and `10.0` (inclusive), or `0` exactly to disable oversampling.", + "name": "oversample", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "float", + "namespace": "_types" + } + } } ], - "specLocation": "_types/mapping/DenseVectorProperty.ts#L129-L162" + "specLocation": "_types/mapping/DenseVectorProperty.ts#L203-L211" }, { "inherits": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 4930646d2d..6a268e51f5 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -77938,9 +77938,43 @@ "namespace": "_types.mapping" } } + }, + { + "description": "The rescore vector options. This is only applicable to `bbq_hnsw`, `int4_hnsw`, `int8_hnsw`, `bbq_flat`, `int4_flat`, and `int8_flat` index types.", + "name": "rescore_vector", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "DenseVectorIndexOptionsRescoreVector", + "namespace": "_types.mapping" + } + } + } + ], + "specLocation": "_types/mapping/DenseVectorProperty.ts#L129-L166" + }, + { + "kind": "interface", + "name": { + "name": "DenseVectorIndexOptionsRescoreVector", + "namespace": "_types.mapping" + }, + "properties": [ + { + "description": "The oversampling factor to use when searching for the nearest neighbor. This is only applicable to the quantized formats: `bbq_*`, `int4_*`, and `int8_*`. \nWhen provided, `oversample * k` vectors will be gathered and then their scores will be re-computed with the original vectors.\n\nvalid values are between `1.0` and `10.0` (inclusive), or `0` exactly to disable oversampling.", + "name": "oversample", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "float", + "namespace": "_types" + } + } } ], - "specLocation": "_types/mapping/DenseVectorProperty.ts#L129-L162" + "specLocation": "_types/mapping/DenseVectorProperty.ts#L203-L211" }, { "kind": "enum", @@ -77974,7 +78008,7 @@ "name": "DenseVectorIndexOptionsType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/DenseVectorProperty.ts#L164-L197" + "specLocation": "_types/mapping/DenseVectorProperty.ts#L168-L201" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 39f138a4fb..eb93d7c4c4 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5493,6 +5493,11 @@ export interface MappingDenseVectorIndexOptions { ef_construction?: integer m?: integer type: MappingDenseVectorIndexOptionsType + rescore_vector?: MappingDenseVectorIndexOptionsRescoreVector +} + +export interface MappingDenseVectorIndexOptionsRescoreVector { + oversample: float } export type MappingDenseVectorIndexOptionsType = 'flat' | 'hnsw' | 'int4_flat' | 'int4_hnsw' | 'int8_flat' | 'int8_hnsw' diff --git a/specification/_types/mapping/DenseVectorProperty.ts b/specification/_types/mapping/DenseVectorProperty.ts index b861a908d7..d1e7e25268 100644 --- a/specification/_types/mapping/DenseVectorProperty.ts +++ b/specification/_types/mapping/DenseVectorProperty.ts @@ -159,6 +159,10 @@ export class DenseVectorIndexOptions { * The type of kNN algorithm to use. */ type: DenseVectorIndexOptionsType + /** + * The rescore vector options. This is only applicable to `bbq_hnsw`, `int4_hnsw`, `int8_hnsw`, `bbq_flat`, `int4_flat`, and `int8_flat` index types. + */ + rescore_vector?: DenseVectorIndexOptionsRescoreVector } export enum DenseVectorIndexOptionsType { @@ -195,3 +199,13 @@ export enum DenseVectorIndexOptionsType { */ int8_hnsw } + +export class DenseVectorIndexOptionsRescoreVector { + /** + * The oversampling factor to use when searching for the nearest neighbor. This is only applicable to the quantized formats: `bbq_*`, `int4_*`, and `int8_*`. + * When provided, `oversample * k` vectors will be gathered and then their scores will be re-computed with the original vectors. + * + * valid values are between `1.0` and `10.0` (inclusive), or `0` exactly to disable oversampling. + */ + oversample: float +} From 31232fc22df1c821a7250254e958d36713b85296 Mon Sep 17 00:00:00 2001 From: Benjamin Trent <4357155+benwtrent@users.noreply.github.com> Date: Wed, 2 Apr 2025 16:12:49 -0400 Subject: [PATCH 2/2] contrib --- output/openapi/elasticsearch-openapi.json | 2 +- output/openapi/elasticsearch-serverless-openapi.json | 2 +- output/schema/schema-serverless.json | 10 +++------- output/schema/schema.json | 10 +++------- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index c7ab101358..4073f4688c 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -68880,7 +68880,7 @@ "type": "object", "properties": { "oversample": { - "description": "The oversampling factor to use when searching for the nearest neighbor. This is only applicable to the quantized formats: `bbq_*`, `int4_*`, and `int8_*`. \nWhen provided, `oversample * k` vectors will be gathered and then their scores will be re-computed with the original vectors.\n\nvalid values are between `1.0` and `10.0` (inclusive), or `0` exactly to disable oversampling.", + "description": "The oversampling factor to use when searching for the nearest neighbor. This is only applicable to the quantized formats: `bbq_*`, `int4_*`, and `int8_*`.\nWhen provided, `oversample * k` vectors will be gathered and then their scores will be re-computed with the original vectors.\n\nvalid values are between `1.0` and `10.0` (inclusive), or `0` exactly to disable oversampling.", "type": "number" } }, diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 7f46ea8fcb..4db168f68c 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -45494,7 +45494,7 @@ "type": "object", "properties": { "oversample": { - "description": "The oversampling factor to use when searching for the nearest neighbor. This is only applicable to the quantized formats: `bbq_*`, `int4_*`, and `int8_*`. \nWhen provided, `oversample * k` vectors will be gathered and then their scores will be re-computed with the original vectors.\n\nvalid values are between `1.0` and `10.0` (inclusive), or `0` exactly to disable oversampling.", + "description": "The oversampling factor to use when searching for the nearest neighbor. This is only applicable to the quantized formats: `bbq_*`, `int4_*`, and `int8_*`.\nWhen provided, `oversample * k` vectors will be gathered and then their scores will be re-computed with the original vectors.\n\nvalid values are between `1.0` and `10.0` (inclusive), or `0` exactly to disable oversampling.", "type": "number" } }, diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 69ecea5a78..4e88419416 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -94205,11 +94205,7 @@ "name": "DenseVectorIndexOptionsType", "namespace": "_types.mapping" }, -<<<<<<< HEAD - "specLocation": "_types/mapping/DenseVectorProperty.ts#L168-L201" -======= - "specLocation": "_types/mapping/DenseVectorProperty.ts#L164-L209" ->>>>>>> main + "specLocation": "_types/mapping/DenseVectorProperty.ts#L168-L213" }, { "kind": "enum", @@ -96831,7 +96827,7 @@ }, "properties": [ { - "description": "The oversampling factor to use when searching for the nearest neighbor. This is only applicable to the quantized formats: `bbq_*`, `int4_*`, and `int8_*`. \nWhen provided, `oversample * k` vectors will be gathered and then their scores will be re-computed with the original vectors.\n\nvalid values are between `1.0` and `10.0` (inclusive), or `0` exactly to disable oversampling.", + "description": "The oversampling factor to use when searching for the nearest neighbor. This is only applicable to the quantized formats: `bbq_*`, `int4_*`, and `int8_*`.\nWhen provided, `oversample * k` vectors will be gathered and then their scores will be re-computed with the original vectors.\n\nvalid values are between `1.0` and `10.0` (inclusive), or `0` exactly to disable oversampling.", "name": "oversample", "required": true, "type": { @@ -96843,7 +96839,7 @@ } } ], - "specLocation": "_types/mapping/DenseVectorProperty.ts#L203-L211" + "specLocation": "_types/mapping/DenseVectorProperty.ts#L215-L223" }, { "inherits": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 2fb6ba3faf..3b28ee95d0 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -77962,7 +77962,7 @@ }, "properties": [ { - "description": "The oversampling factor to use when searching for the nearest neighbor. This is only applicable to the quantized formats: `bbq_*`, `int4_*`, and `int8_*`. \nWhen provided, `oversample * k` vectors will be gathered and then their scores will be re-computed with the original vectors.\n\nvalid values are between `1.0` and `10.0` (inclusive), or `0` exactly to disable oversampling.", + "description": "The oversampling factor to use when searching for the nearest neighbor. This is only applicable to the quantized formats: `bbq_*`, `int4_*`, and `int8_*`.\nWhen provided, `oversample * k` vectors will be gathered and then their scores will be re-computed with the original vectors.\n\nvalid values are between `1.0` and `10.0` (inclusive), or `0` exactly to disable oversampling.", "name": "oversample", "required": true, "type": { @@ -77974,7 +77974,7 @@ } } ], - "specLocation": "_types/mapping/DenseVectorProperty.ts#L203-L211" + "specLocation": "_types/mapping/DenseVectorProperty.ts#L215-L223" }, { "kind": "enum", @@ -78016,11 +78016,7 @@ "name": "DenseVectorIndexOptionsType", "namespace": "_types.mapping" }, -<<<<<<< HEAD - "specLocation": "_types/mapping/DenseVectorProperty.ts#L168-L201" -======= - "specLocation": "_types/mapping/DenseVectorProperty.ts#L164-L209" ->>>>>>> main + "specLocation": "_types/mapping/DenseVectorProperty.ts#L168-L213" }, { "kind": "interface",