Skip to content

Commit 111d191

Browse files
committed
Correcting the response format for ingest simulate
1 parent abca59a commit 111d191

File tree

4 files changed

+267
-5
lines changed

4 files changed

+267
-5
lines changed

output/openapi/elasticsearch-openapi.json

Lines changed: 46 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/schema.json

Lines changed: 156 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/typescript/types.ts

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/simulate/ingest/SimulateIngestResponse.ts

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,56 @@
1717
* under the License.
1818
*/
1919

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'
2126

2227
export class Response {
2328
body: { docs: SimulateDocumentResult[] }
2429
}
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

Comments
 (0)