Skip to content

[Backport 8.8] Add exception to core.get to handle index_not_found & document not found #2158

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

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion output/schema/schema.json

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

10 changes: 10 additions & 0 deletions specification/_global/get/GetResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@
*/

import { GetResult } from '@global/get/types'
import { ErrorResponseBase } from '@_types/Base'

export class Response<TDocument> {
body: GetResult<TDocument>
exceptions: [
{
// Special case exception for 404 status code, Elasticsearch will return either:
// * index_not_found_exception as an error if the index doesn't exist
// * GetResult with only the requested _id, _index properties and found as a false boolean
statusCodes: [404]
body: GetResult<TDocument> | ErrorResponseBase
}
]
}