-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correcting the response format for ingest simulate #3640
Changes from 2 commits
111d191
43e6fa1
e86ebc9
e89fe60
9b0367d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, coule be |
||
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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right -- I had just copy/pasted without looking. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also realized that |
||
/** | ||
* A list of the names of the pipelines executed on this document. | ||
*/ | ||
executed_pipelines: Array<string> | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we try to avoid duplicate names since it can break certain clients, could we rename this to something else? like
SimulateIngestDocumentResult