Skip to content

Commit

Permalink
Correcting the response format for ingest simulate
Browse files Browse the repository at this point in the history
  • Loading branch information
masseyke committed Jan 28, 2025
1 parent abca59a commit 111d191
Show file tree
Hide file tree
Showing 4 changed files with 267 additions and 5 deletions.
47 changes: 46 additions & 1 deletion output/openapi/elasticsearch-openapi.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

158 changes: 156 additions & 2 deletions output/schema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion output/typescript/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 49 additions & 1 deletion specification/simulate/ingest/SimulateIngestResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,56 @@
* 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[] }
}

export class SimulateDocumentResult {
doc?: DocumentSimulation
/**
* 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
}

/**
* 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 DocumentSimulation
implements AdditionalProperties<string, string>
{
/**
* 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<string, UserDefinedValue>
/**
*
*/
_version?: Stringified<VersionNumber>
/**
* A list of the names of the pipelines executed on this document.
*/
executed_pipelines: Array<string>
}

0 comments on commit 111d191

Please sign in to comment.