From e7385d4df25ea9d8a98ac34702c605c8776a0c73 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 3144c196c6..d59016e5f3 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -65049,11 +65049,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 f2914b98d5..13a34d0674 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -42679,11 +42679,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 b0544b34fb..d3df4845d9 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -88532,7 +88532,7 @@ "name": "IndexOptions", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/core.ts#L262-L267" + "specLocation": "_types/mapping/core.ts#L274-L279" }, { "kind": "enum", @@ -89546,7 +89546,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L306-L337" + "specLocation": "_types/mapping/core.ts#L318-L349" }, { "kind": "enum", @@ -89603,7 +89603,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L269-L272" + "specLocation": "_types/mapping/core.ts#L281-L284" }, { "kind": "enum", @@ -89964,7 +89964,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L235-L260" + "specLocation": "_types/mapping/core.ts#L247-L272" }, { "inherits": { @@ -90193,7 +90193,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L216-L227" + "specLocation": "_types/mapping/core.ts#L228-L239" }, { "inherits": { @@ -90406,7 +90406,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L274-L291" + "specLocation": "_types/mapping/core.ts#L286-L303" }, { "kind": "interface", @@ -90473,7 +90473,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L293-L295" + "specLocation": "_types/mapping/core.ts#L305-L307" }, { "inherits": { @@ -90514,7 +90514,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L297-L304" + "specLocation": "_types/mapping/core.ts#L309-L316" }, { "inherits": { @@ -91306,8 +91306,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": { @@ -91317,7 +91331,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 73e90ad514..201b6ed15a 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -76632,7 +76632,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L306-L337" + "specLocation": "_types/mapping/core.ts#L318-L349" }, { "kind": "interface", @@ -77805,7 +77805,7 @@ "name": "IndexOptions", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/core.ts#L262-L267" + "specLocation": "_types/mapping/core.ts#L274-L279" }, { "kind": "interface", @@ -78387,7 +78387,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L235-L260" + "specLocation": "_types/mapping/core.ts#L247-L272" }, { "kind": "enum", @@ -79834,7 +79834,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L216-L227" + "specLocation": "_types/mapping/core.ts#L228-L239" }, { "kind": "interface", @@ -79874,8 +79874,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": { @@ -79885,7 +79899,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L210-L214" + "specLocation": "_types/mapping/core.ts#L210-L226" }, { "kind": "interface", @@ -80316,7 +80330,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L269-L272" + "specLocation": "_types/mapping/core.ts#L281-L284" }, { "kind": "interface", @@ -80529,7 +80543,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L274-L291" + "specLocation": "_types/mapping/core.ts#L286-L303" }, { "kind": "enum", @@ -80936,7 +80950,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L293-L295" + "specLocation": "_types/mapping/core.ts#L305-L307" }, { "kind": "interface", @@ -80977,7 +80991,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 6d12406aa6..e2903b2d45 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5801,7 +5801,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 {