|
17 | 17 | * under the License. |
18 | 18 | */ |
19 | 19 |
|
20 | | -import { SimulateDocumentResult } from '@ingest/_types/Simulation' |
| 20 | +import { AdditionalProperties } from '@spec_utils/behaviors' |
| 21 | +import { Dictionary } from '@spec_utils/Dictionary' |
| 22 | +import { Stringified } from '@spec_utils/Stringified' |
| 23 | +import { UserDefinedValue } from '@spec_utils/UserDefinedValue' |
| 24 | +import { Id, IndexName, VersionNumber } from '@_types/common' |
| 25 | +import { ErrorCause } from '@_types/Errors' |
21 | 26 |
|
22 | 27 | export class Response { |
23 | 28 | body: { docs: SimulateDocumentResult[] } |
24 | 29 | } |
| 30 | + |
| 31 | +export class SimulateDocumentResult { |
| 32 | + doc?: DocumentSimulation |
| 33 | + /** |
| 34 | + * Any error resulting from simulatng ingest on this doc. This can be an error generated by |
| 35 | + * executing a processor, or a mapping validation error when simulating indexing the resulting |
| 36 | + * doc. |
| 37 | + */ |
| 38 | + error?: ErrorCause |
| 39 | +} |
| 40 | + |
| 41 | +/** |
| 42 | + * The results of ingest simulation on a single document. The _source of the document contains |
| 43 | + * the results after running all pipelines listed in executed_pipelines on the document. The |
| 44 | + * list of executed pipelines is derived from the pipelines that would be executed if this |
| 45 | + * document had been ingested into _index. |
| 46 | + * |
| 47 | + * @behavior_meta AdditionalProperties fieldname=metadata description="Additional metadata" |
| 48 | + */ |
| 49 | +export class DocumentSimulation |
| 50 | + implements AdditionalProperties<string, string> |
| 51 | +{ |
| 52 | + /** |
| 53 | + * Identifier for the document. |
| 54 | + */ |
| 55 | + _id: Id |
| 56 | + /** |
| 57 | + * Name of the index that the document would be indexed into if this were not a simulation. |
| 58 | + */ |
| 59 | + _index: IndexName |
| 60 | + /** |
| 61 | + * JSON body for the document. |
| 62 | + */ |
| 63 | + _source: Dictionary<string, UserDefinedValue> |
| 64 | + /** |
| 65 | + * |
| 66 | + */ |
| 67 | + _version?: Stringified<VersionNumber> |
| 68 | + /** |
| 69 | + * A list of the names of the pipelines executed on this document. |
| 70 | + */ |
| 71 | + executed_pipelines: Array<string> |
| 72 | +} |
0 commit comments