Add machine learning API examples #2452
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relates to #2144
The goal is that these examples would be added to the openAPI specification per https://spec.openapis.org/oas/latest#request-body-examples and https://spec.openapis.org/oas/latest#responses-object-example.
The examples are obtained from https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html, https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html, https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html, and https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html, which are pages that will no longer exist when we start generating docs from the API specifications.
For now I've only added examples for "200" responses (since that's what we've got in the docs), but in case we want to provide examples for other response codes in the future, I've put that code in the folder name. If there's a better location or method for adding these examples, let me know!