diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 063c9fb137..4461d71016 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -88564,6 +88564,62 @@ "replace" ] }, + "simulate.ingest:SimulateIngestDocumentResult": { + "type": "object", + "properties": { + "doc": { + "$ref": "#/components/schemas/simulate.ingest:IngestDocumentSimulation" + } + } + }, + "simulate.ingest:IngestDocumentSimulation": { + "type": "object", + "properties": { + "_id": { + "$ref": "#/components/schemas/_types:Id" + }, + "_index": { + "$ref": "#/components/schemas/_types:IndexName" + }, + "_source": { + "description": "JSON body for the document.", + "type": "object", + "additionalProperties": { + "type": "object" + } + }, + "_version": { + "$ref": "#/components/schemas/_spec_utils:StringifiedVersionNumber" + }, + "executed_pipelines": { + "description": "A list of the names of the pipelines executed on this document.", + "type": "array", + "items": { + "type": "string" + } + }, + "ignored_fields": { + "description": "A list of the fields that would be ignored at the indexing step. For example, a field whose\nvalue is larger than the allowed limit would make it through all of the pipoelines, but\nwould not be indexed into Elasticsearch.", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "error": { + "$ref": "#/components/schemas/_types:ErrorCause" + } + }, + "required": [ + "_id", + "_index", + "_source", + "_version", + "executed_pipelines" + ] + }, "slm._types:SnapshotLifecycle": { "type": "object", "properties": { @@ -97446,7 +97502,7 @@ "docs": { "type": "array", "items": { - "$ref": "#/components/schemas/ingest._types:SimulateDocumentResult" + "$ref": "#/components/schemas/simulate.ingest:SimulateIngestDocumentResult" } } }, diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 165619dfb0..b3e8ae0276 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -105761,6 +105761,19 @@ }, "specLocation": "shutdown/get_node/ShutdownGetNodeResponse.ts#L40-L43" }, + { + "kind": "enum", + "members": [ + { + "name": "field" + } + ], + "name": { + "name": "IgnoredFieldKey", + "namespace": "simulate.ingest" + }, + "specLocation": "simulate/ingest/SimulateIngestResponse.ts#L80-L85" + }, { "kind": "type_alias", "name": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 7f9475d2ca..913f802f15 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -207552,6 +207552,178 @@ }, "specLocation": "shutdown/put_node/ShutdownPutNodeResponse.ts#L22-L24" }, + { + "kind": "enum", + "members": [ + { + "name": "field" + } + ], + "name": { + "name": "IgnoredFieldKey", + "namespace": "simulate.ingest" + }, + "specLocation": "simulate/ingest/SimulateIngestResponse.ts#L80-L85" + }, + { + "kind": "interface", + "attachedBehaviors": [ + "AdditionalProperties" + ], + "behaviors": [ + { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + ], + "meta": { + "description": "Additional metadata", + "fieldname": "metadata" + }, + "type": { + "name": "AdditionalProperties", + "namespace": "_spec_utils" + } + } + ], + "description": "The results of ingest simulation on a single document. The _source of the document contains\nthe results after running all pipelines listed in executed_pipelines on the document. The\nlist of executed pipelines is derived from the pipelines that would be executed if this\ndocument had been ingested into _index.", + "name": { + "name": "IngestDocumentSimulation", + "namespace": "simulate.ingest" + }, + "properties": [ + { + "description": "Identifier for the document.", + "name": "_id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Id", + "namespace": "_types" + } + } + }, + { + "description": "Name of the index that the document would be indexed into if this were not a simulation.", + "name": "_index", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" + } + } + }, + { + "description": "JSON body for the document.", + "name": "_source", + "required": true, + "type": { + "kind": "dictionary_of", + "key": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + "singleKey": false, + "value": { + "kind": "user_defined_value" + } + } + }, + { + "description": "", + "name": "_version", + "required": true, + "type": { + "kind": "instance_of", + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "VersionNumber", + "namespace": "_types" + } + } + ], + "type": { + "name": "Stringified", + "namespace": "_spec_utils" + } + } + }, + { + "description": "A list of the names of the pipelines executed on this document.", + "name": "executed_pipelines", + "required": true, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + }, + { + "description": "A list of the fields that would be ignored at the indexing step. For example, a field whose\nvalue is larger than the allowed limit would make it through all of the pipoelines, but\nwould not be indexed into Elasticsearch.", + "name": "ignored_fields", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "dictionary_of", + "key": { + "kind": "instance_of", + "type": { + "name": "IgnoredFieldKey", + "namespace": "simulate.ingest" + } + }, + "singleKey": false, + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + } + }, + { + "description": "Any error resulting from simulatng ingest on this doc. This can be an error generated by\nexecuting a processor, or a mapping validation error when simulating indexing the resulting\ndoc.", + "name": "error", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ErrorCause", + "namespace": "_types" + } + } + } + ], + "specLocation": "simulate/ingest/SimulateIngestResponse.ts#L35-L78" + }, { "kind": "request", "attachedBehaviors": [ @@ -207711,8 +207883,8 @@ "value": { "kind": "instance_of", "type": { - "name": "SimulateDocumentResult", - "namespace": "ingest._types" + "name": "SimulateIngestDocumentResult", + "namespace": "simulate.ingest" } } } @@ -207723,7 +207895,28 @@ "name": "Response", "namespace": "simulate.ingest" }, - "specLocation": "simulate/ingest/SimulateIngestResponse.ts#L22-L24" + "specLocation": "simulate/ingest/SimulateIngestResponse.ts#L27-L29" + }, + { + "kind": "interface", + "name": { + "name": "SimulateIngestDocumentResult", + "namespace": "simulate.ingest" + }, + "properties": [ + { + "name": "doc", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "IngestDocumentSimulation", + "namespace": "simulate.ingest" + } + } + } + ], + "specLocation": "simulate/ingest/SimulateIngestResponse.ts#L31-L33" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 57a33040e0..607df8229f 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -19448,6 +19448,20 @@ export interface ShutdownPutNodeRequest extends RequestBase { export type ShutdownPutNodeResponse = AcknowledgedResponseBase +export type SimulateIngestIgnoredFieldKey = 'field' + +export interface SimulateIngestIngestDocumentSimulationKeys { + _id: Id + _index: IndexName + _source: Record + _version: SpecUtilsStringified + executed_pipelines: string[] + ignored_fields?: Record[] + error?: ErrorCause +} +export type SimulateIngestIngestDocumentSimulation = SimulateIngestIngestDocumentSimulationKeys + & { [property: string]: string | Id | IndexName | Record | SpecUtilsStringified | string[] | Record[] | ErrorCause } + export interface SimulateIngestRequest extends RequestBase { index?: IndexName pipeline?: PipelineName @@ -19461,7 +19475,11 @@ export interface SimulateIngestRequest extends RequestBase { } export interface SimulateIngestResponse { - docs: IngestSimulateDocumentResult[] + docs: SimulateIngestSimulateIngestDocumentResult[] +} + +export interface SimulateIngestSimulateIngestDocumentResult { + doc?: SimulateIngestIngestDocumentSimulation } export interface SlmConfiguration { diff --git a/specification/simulate/ingest/SimulateIngestResponse.ts b/specification/simulate/ingest/SimulateIngestResponse.ts index e1812124fb..f7250689dd 100644 --- a/specification/simulate/ingest/SimulateIngestResponse.ts +++ b/specification/simulate/ingest/SimulateIngestResponse.ts @@ -17,8 +17,69 @@ * under the License. */ -import { SimulateDocumentResult } from '@ingest/_types/Simulation' +import { AdditionalProperties } from '@spec_utils/behaviors' +import { Dictionary } from '@spec_utils/Dictionary' +import { Stringified } from '@spec_utils/Stringified' +import { UserDefinedValue } from '@spec_utils/UserDefinedValue' +import { Id, IndexName, VersionNumber } from '@_types/common' +import { ErrorCause } from '@_types/Errors' export class Response { - body: { docs: SimulateDocumentResult[] } + body: { docs: SimulateIngestDocumentResult[] } +} + +export class SimulateIngestDocumentResult { + doc?: IngestDocumentSimulation +} + +/** + * The results of ingest simulation on a single document. The _source of the document contains + * the results after running all pipelines listed in executed_pipelines on the document. The + * list of executed pipelines is derived from the pipelines that would be executed if this + * document had been ingested into _index. + * + * @behavior_meta AdditionalProperties fieldname=metadata description="Additional metadata" + */ +export class IngestDocumentSimulation + implements AdditionalProperties +{ + /** + * Identifier for the document. + */ + _id: Id + /** + * Name of the index that the document would be indexed into if this were not a simulation. + */ + _index: IndexName + /** + * JSON body for the document. + */ + _source: Dictionary + /** + * + */ + _version: Stringified + /** + * A list of the names of the pipelines executed on this document. + */ + executed_pipelines: Array + /** + * A list of the fields that would be ignored at the indexing step. For example, a field whose + * value is larger than the allowed limit would make it through all of the pipelines, but + * would not be indexed into Elasticsearch. + */ + ignored_fields?: Array> + /** + * Any error resulting from simulatng ingest on this doc. This can be an error generated by + * executing a processor, or a mapping validation error when simulating indexing the resulting + * doc. + */ + error?: ErrorCause +} + +/** + * These are the names of the keys in a Dictionary in the ignored_fields Array. + */ +enum IgnoredFieldKey { + field }