From 454ec3e2188a89d03ab7f46b9efe2a76139b3085 Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Tue, 11 Mar 2025 06:04:11 +0100 Subject: [PATCH] Add search_inference_id property (#3901) * feat: add search_inference_id property * fix: run make * Add descriptions for parameters * Mark inference_id as optional * Add inference_id server default --------- Co-authored-by: Quentin Pradet (cherry picked from commit e4cedeed985b83c9bea600012d0201ae2ab38b2d) --- output/openapi/elasticsearch-openapi.json | 6 ++-- .../elasticsearch-serverless-openapi.json | 6 ++-- output/schema/schema-serverless.json | 34 +++++++++++++------ output/schema/schema.json | 34 +++++++++++++------ output/typescript/types.ts | 3 +- specification/_types/mapping/core.ts | 14 +++++++- 6 files changed, 71 insertions(+), 26 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 95fb60ed85..500fab96ad 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -65007,11 +65007,13 @@ }, "inference_id": { "$ref": "#/components/schemas/_types:Id" + }, + "search_inference_id": { + "$ref": "#/components/schemas/_types:Id" } }, "required": [ - "type", - "inference_id" + "type" ] }, "_types.mapping:SparseVectorProperty": { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index d2aba95a03..e039c347d3 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -42698,11 +42698,13 @@ }, "inference_id": { "$ref": "#/components/schemas/_types:Id" + }, + "search_inference_id": { + "$ref": "#/components/schemas/_types:Id" } }, "required": [ - "type", - "inference_id" + "type" ] }, "_types.mapping:SparseVectorProperty": { diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index a2dfdf494a..88d296e573 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -88632,7 +88632,7 @@ "name": "IndexOptions", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/core.ts#L262-L267" + "specLocation": "_types/mapping/core.ts#L274-L279" }, { "kind": "enum", @@ -89646,7 +89646,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L306-L337" + "specLocation": "_types/mapping/core.ts#L318-L349" }, { "kind": "enum", @@ -89703,7 +89703,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L269-L272" + "specLocation": "_types/mapping/core.ts#L281-L284" }, { "kind": "enum", @@ -90064,7 +90064,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L235-L260" + "specLocation": "_types/mapping/core.ts#L247-L272" }, { "inherits": { @@ -90293,7 +90293,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L216-L227" + "specLocation": "_types/mapping/core.ts#L228-L239" }, { "inherits": { @@ -90506,7 +90506,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L274-L291" + "specLocation": "_types/mapping/core.ts#L286-L303" }, { "kind": "interface", @@ -90573,7 +90573,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L293-L295" + "specLocation": "_types/mapping/core.ts#L305-L307" }, { "inherits": { @@ -90614,7 +90614,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L297-L304" + "specLocation": "_types/mapping/core.ts#L309-L316" }, { "inherits": { @@ -91406,8 +91406,22 @@ } }, { + "description": "Inference endpoint that will be used to generate embeddings for the field.\nThis parameter cannot be updated. Use the Create inference API to create the endpoint.\nIf `search_inference_id` is specified, the inference endpoint will only be used at index time.", "name": "inference_id", - "required": true, + "required": false, + "serverDefault": ".elser-2-elasticsearch", + "type": { + "kind": "instance_of", + "type": { + "name": "Id", + "namespace": "_types" + } + } + }, + { + "description": "Inference endpoint that will be used to generate embeddings at query time.\nYou can update this parameter by using the Update mapping API. Use the Create inference API to create the endpoint.\nIf not specified, the inference endpoint defined by inference_id will be used at both index and query time.", + "name": "search_inference_id", + "required": false, "type": { "kind": "instance_of", "type": { @@ -91417,7 +91431,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L210-L214" + "specLocation": "_types/mapping/core.ts#L210-L226" }, { "inherits": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 9274cc67ff..e76c29a0ce 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -76705,7 +76705,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L306-L337" + "specLocation": "_types/mapping/core.ts#L318-L349" }, { "kind": "interface", @@ -77878,7 +77878,7 @@ "name": "IndexOptions", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/core.ts#L262-L267" + "specLocation": "_types/mapping/core.ts#L274-L279" }, { "kind": "interface", @@ -78460,7 +78460,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L235-L260" + "specLocation": "_types/mapping/core.ts#L247-L272" }, { "kind": "enum", @@ -79907,7 +79907,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L216-L227" + "specLocation": "_types/mapping/core.ts#L228-L239" }, { "kind": "interface", @@ -79947,8 +79947,22 @@ } }, { + "description": "Inference endpoint that will be used to generate embeddings for the field.\nThis parameter cannot be updated. Use the Create inference API to create the endpoint.\nIf `search_inference_id` is specified, the inference endpoint will only be used at index time.", "name": "inference_id", - "required": true, + "required": false, + "serverDefault": ".elser-2-elasticsearch", + "type": { + "kind": "instance_of", + "type": { + "name": "Id", + "namespace": "_types" + } + } + }, + { + "description": "Inference endpoint that will be used to generate embeddings at query time.\nYou can update this parameter by using the Update mapping API. Use the Create inference API to create the endpoint.\nIf not specified, the inference endpoint defined by inference_id will be used at both index and query time.", + "name": "search_inference_id", + "required": false, "type": { "kind": "instance_of", "type": { @@ -79958,7 +79972,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L210-L214" + "specLocation": "_types/mapping/core.ts#L210-L226" }, { "kind": "interface", @@ -80389,7 +80403,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L269-L272" + "specLocation": "_types/mapping/core.ts#L281-L284" }, { "kind": "interface", @@ -80602,7 +80616,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L274-L291" + "specLocation": "_types/mapping/core.ts#L286-L303" }, { "kind": "enum", @@ -81009,7 +81023,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L293-L295" + "specLocation": "_types/mapping/core.ts#L305-L307" }, { "kind": "interface", @@ -81050,7 +81064,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L297-L304" + "specLocation": "_types/mapping/core.ts#L309-L316" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 06715c0555..7031cb0f0c 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5811,7 +5811,8 @@ export interface MappingSearchAsYouTypeProperty extends MappingCorePropertyBase export interface MappingSemanticTextProperty { type: 'semantic_text' meta?: Record - inference_id: Id + inference_id?: Id + search_inference_id?: Id } export interface MappingShapeProperty extends MappingDocValuesPropertyBase { diff --git a/specification/_types/mapping/core.ts b/specification/_types/mapping/core.ts index c1233a18d9..52db74be88 100644 --- a/specification/_types/mapping/core.ts +++ b/specification/_types/mapping/core.ts @@ -210,7 +210,19 @@ export class SparseVectorProperty extends PropertyBase { export class SemanticTextProperty { type: 'semantic_text' meta?: Dictionary - inference_id: Id + /** + * Inference endpoint that will be used to generate embeddings for the field. + * This parameter cannot be updated. Use the Create inference API to create the endpoint. + * If `search_inference_id` is specified, the inference endpoint will only be used at index time. + * @server_default .elser-2-elasticsearch + */ + inference_id?: Id + /** + * Inference endpoint that will be used to generate embeddings at query time. + * You can update this parameter by using the Update mapping API. Use the Create inference API to create the endpoint. + * If not specified, the inference endpoint defined by inference_id will be used at both index and query time. + */ + search_inference_id?: Id } export class SearchAsYouTypeProperty extends CorePropertyBase {