From fe224dacfd77d47ca0d8773dc4dace3e7b6daa3e Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 2 Aug 2024 11:18:10 +0200 Subject: [PATCH] Merge doc-examples branch (#2759) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add machine learning API examples (#2452) * Add examples for transform APIs (#2505) * [DOCS] Adds ML API examples (DELETE ops) (#2518) * [DOCS] Adds anomaly detection API examples. * [DOCS] Adds more ML examples. * [DOCS] Further edits. * [DOCS] Fixes style. * [DOCS] Adds example requests and responses to ML APIs (C-E) (#2521) Co-authored-by: Quentin Pradet --------- Co-authored-by: Lisa Cawley Co-authored-by: István Zoltán Szabó --- ...dModelDeploymentCacheResponseExample1.json | 6 + .../MlCloseJobResponseExample1.json | 6 + .../MlDeleteCalendarResponseExample1.json | 6 + ...MlDeleteCalendarEventResponseExample1.json | 6 + .../MlDeleteCalendarJobResponseExample1.json | 7 + ...eteDataFrameAnalyticsResponseExample1.json | 6 + .../MlDeleteDatafeedResponseExample1.json | 6 + .../MlDeleteExpiredDataResponseExample1.json | 6 + .../MlDeleteFilterResponseExample1.json | 6 + .../MlDeleteForecastResponseExample1.json | 6 + .../MlDeleteJobResponseExample1.json | 6 + .../MlDeleteJobResponseExample2.json | 7 + ...MlDeleteModelSnapshotResponseExample1.json | 6 + .../MlDeleteTrainedModelResponseExample1.json | 6 + ...leteTrainedModelAliasResponseExample1.json | 6 + ...MlEstimateModelMemoryResponseExample1.json | 6 + .../MlEstimateModelMemoryRequestExample1.json | 25 ++ ...taFrameResponseClassificationExample1.json | 43 ++++ ...taFrameResponseClassificationExample2.json | 10 + ...aluateDataFrameResponseOutlierExample.json | 40 ++++ ...ataFrameRequestClassificationExample1.json | 16 ++ ...ataFrameRequestClassificationExample2.json | 17 ++ ...valuateDataFrameRequestOutlierExample.json | 12 + ...ateDataFrameRequestRegressionExample1.json | 34 +++ ...ateDataFrameRequestRegressionExample2.json | 26 +++ ...ainDataFrameAnalyticsResponseExample1.json | 39 ++++ ...lainDataFrameAnalyticsRequestExample1.json | 13 ++ .../MlOpenJobResponseExample1.json | 7 + .../request/MlOpenJobRequestExample1.json | 7 + .../MlPutJobResponseExample1.json | 77 ++++++ .../request/MlPutJobRequestExample1.json | 48 ++++ .../DeleteTransformResponseExample1.json | 6 + .../GetTransformResponseExample1.json | 61 +++++ .../GetTransformStatsResponseExample1.json | 49 ++++ .../PreviewTransformResponseExample1.json | 220 ++++++++++++++++++ .../PreviewTransformRequestExample1.json | 25 ++ .../PutTransformResponseExample1.json | 6 + .../request/PutTransformRequestExample1.json | 50 ++++ .../request/PutTransformRequestExample2.json | 23 ++ .../ResetTransformResponseExample1.json | 6 + .../ResetTransformResponseExample1.json | 6 + .../StartTransformResponseExample1.json | 6 + .../StopTransformResponseExample1.json | 6 + .../UpdateTransformResponseExample1.json | 57 +++++ .../UpdateTransformRequestExample1.json | 50 ++++ .../UpgradeTransformResponseExample1.json | 8 + 46 files changed, 1091 insertions(+) create mode 100644 specification/ml/clear_trained_model_deployment_cache/examples/200_response/MlClearTrainedModelDeploymentCacheResponseExample1.json create mode 100644 specification/ml/close_job/examples/200_response/MlCloseJobResponseExample1.json create mode 100644 specification/ml/delete_calendar/examples/200_response/MlDeleteCalendarResponseExample1.json create mode 100644 specification/ml/delete_calendar_event/examples/200_response/MlDeleteCalendarEventResponseExample1.json create mode 100644 specification/ml/delete_calendar_job/examples/200_response/MlDeleteCalendarJobResponseExample1.json create mode 100644 specification/ml/delete_data_frame_analytics/examples/200_response/MlDeleteDataFrameAnalyticsResponseExample1.json create mode 100644 specification/ml/delete_datafeed/examples/200_response/MlDeleteDatafeedResponseExample1.json create mode 100644 specification/ml/delete_expired_data/examples/200_response/MlDeleteExpiredDataResponseExample1.json create mode 100644 specification/ml/delete_filter/examples/200_response/MlDeleteFilterResponseExample1.json create mode 100644 specification/ml/delete_forecast/examples/200_response/MlDeleteForecastResponseExample1.json create mode 100644 specification/ml/delete_job/examples/200_response/MlDeleteJobResponseExample1.json create mode 100644 specification/ml/delete_job/examples/200_response/MlDeleteJobResponseExample2.json create mode 100644 specification/ml/delete_model_snapshot/examples/200_responses/MlDeleteModelSnapshotResponseExample1.json create mode 100644 specification/ml/delete_trained_model/examples/200_response/MlDeleteTrainedModelResponseExample1.json create mode 100644 specification/ml/delete_trained_model_alias/examples/MlDeleteTrainedModelAliasResponseExample1.json create mode 100644 specification/ml/estimate_model_memory/examples/200_response/MlEstimateModelMemoryResponseExample1.json create mode 100644 specification/ml/estimate_model_memory/examples/request/MlEstimateModelMemoryRequestExample1.json create mode 100644 specification/ml/evaluate_data_frame/examples/200_response/MlEvaluateDataFrameResponseClassificationExample1.json create mode 100644 specification/ml/evaluate_data_frame/examples/200_response/MlEvaluateDataFrameResponseClassificationExample2.json create mode 100644 specification/ml/evaluate_data_frame/examples/200_response/MlEvaluateDataFrameResponseOutlierExample.json create mode 100644 specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestClassificationExample1.json create mode 100644 specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestClassificationExample2.json create mode 100644 specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestOutlierExample.json create mode 100644 specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestRegressionExample1.json create mode 100644 specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestRegressionExample2.json create mode 100644 specification/ml/explain_data_frame_analytics/examples/200_response/MlExplainDataFrameAnalyticsResponseExample1.json create mode 100644 specification/ml/explain_data_frame_analytics/examples/request/MlExplainDataFrameAnalyticsRequestExample1.json create mode 100644 specification/ml/open_job/examples/200_response/MlOpenJobResponseExample1.json create mode 100644 specification/ml/open_job/examples/request/MlOpenJobRequestExample1.json create mode 100644 specification/ml/put_job/examples/200_response/MlPutJobResponseExample1.json create mode 100644 specification/ml/put_job/examples/request/MlPutJobRequestExample1.json create mode 100644 specification/transform/delete_transform/examples/200_response/DeleteTransformResponseExample1.json create mode 100644 specification/transform/get_transform/examples/200_response/GetTransformResponseExample1.json create mode 100644 specification/transform/get_transform_stats/examples/200_response/GetTransformStatsResponseExample1.json create mode 100644 specification/transform/preview_transform/examples/200_response/PreviewTransformResponseExample1.json create mode 100644 specification/transform/preview_transform/examples/request/PreviewTransformRequestExample1.json create mode 100644 specification/transform/put_transform/examples/200_response/PutTransformResponseExample1.json create mode 100644 specification/transform/put_transform/examples/request/PutTransformRequestExample1.json create mode 100644 specification/transform/put_transform/examples/request/PutTransformRequestExample2.json create mode 100644 specification/transform/reset_transform/examples/200_response/ResetTransformResponseExample1.json create mode 100644 specification/transform/schedule_now_transform/examples/200_response/ResetTransformResponseExample1.json create mode 100644 specification/transform/start_transform/examples/200_response/StartTransformResponseExample1.json create mode 100644 specification/transform/stop_transform/examples/200_response/StopTransformResponseExample1.json create mode 100644 specification/transform/update_transform/examples/200_response/UpdateTransformResponseExample1.json create mode 100644 specification/transform/update_transform/examples/request/UpdateTransformRequestExample1.json create mode 100644 specification/transform/upgrade_transforms/examples/200_response/UpgradeTransformResponseExample1.json diff --git a/specification/ml/clear_trained_model_deployment_cache/examples/200_response/MlClearTrainedModelDeploymentCacheResponseExample1.json b/specification/ml/clear_trained_model_deployment_cache/examples/200_response/MlClearTrainedModelDeploymentCacheResponseExample1.json new file mode 100644 index 0000000000..e56e953505 --- /dev/null +++ b/specification/ml/clear_trained_model_deployment_cache/examples/200_response/MlClearTrainedModelDeploymentCacheResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when clearing the inference cache.", + "value": { + "cleared": true + } +} diff --git a/specification/ml/close_job/examples/200_response/MlCloseJobResponseExample1.json b/specification/ml/close_job/examples/200_response/MlCloseJobResponseExample1.json new file mode 100644 index 0000000000..e8b8f527ac --- /dev/null +++ b/specification/ml/close_job/examples/200_response/MlCloseJobResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when closing anomaly detection jobs.", + "value": { + "closed": true + } +} diff --git a/specification/ml/delete_calendar/examples/200_response/MlDeleteCalendarResponseExample1.json b/specification/ml/delete_calendar/examples/200_response/MlDeleteCalendarResponseExample1.json new file mode 100644 index 0000000000..26364b688c --- /dev/null +++ b/specification/ml/delete_calendar/examples/200_response/MlDeleteCalendarResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when deleting a calendar.", + "value": { + "acknowledged": true + } +} diff --git a/specification/ml/delete_calendar_event/examples/200_response/MlDeleteCalendarEventResponseExample1.json b/specification/ml/delete_calendar_event/examples/200_response/MlDeleteCalendarEventResponseExample1.json new file mode 100644 index 0000000000..dde62b10f3 --- /dev/null +++ b/specification/ml/delete_calendar_event/examples/200_response/MlDeleteCalendarEventResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when deleting a calendar event.", + "value": { + "acknowledged": true + } +} diff --git a/specification/ml/delete_calendar_job/examples/200_response/MlDeleteCalendarJobResponseExample1.json b/specification/ml/delete_calendar_job/examples/200_response/MlDeleteCalendarJobResponseExample1.json new file mode 100644 index 0000000000..7ad8a389d0 --- /dev/null +++ b/specification/ml/delete_calendar_job/examples/200_response/MlDeleteCalendarJobResponseExample1.json @@ -0,0 +1,7 @@ +{ + "summary": "A successful response when deleting an anomaly detection job from a calendar.", + "value": { + "calendar_id": "planned-outages", + "job_ids": [] + } +} diff --git a/specification/ml/delete_data_frame_analytics/examples/200_response/MlDeleteDataFrameAnalyticsResponseExample1.json b/specification/ml/delete_data_frame_analytics/examples/200_response/MlDeleteDataFrameAnalyticsResponseExample1.json new file mode 100644 index 0000000000..5d46e2f46b --- /dev/null +++ b/specification/ml/delete_data_frame_analytics/examples/200_response/MlDeleteDataFrameAnalyticsResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when deleting a data frame analytics job.", + "value": { + "acknowledged": true + } +} diff --git a/specification/ml/delete_datafeed/examples/200_response/MlDeleteDatafeedResponseExample1.json b/specification/ml/delete_datafeed/examples/200_response/MlDeleteDatafeedResponseExample1.json new file mode 100644 index 0000000000..e6987cf336 --- /dev/null +++ b/specification/ml/delete_datafeed/examples/200_response/MlDeleteDatafeedResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when deleting a datafeed.", + "value": { + "acknowledged": true + } +} diff --git a/specification/ml/delete_expired_data/examples/200_response/MlDeleteExpiredDataResponseExample1.json b/specification/ml/delete_expired_data/examples/200_response/MlDeleteExpiredDataResponseExample1.json new file mode 100644 index 0000000000..b4f131c2ce --- /dev/null +++ b/specification/ml/delete_expired_data/examples/200_response/MlDeleteExpiredDataResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when deleting expired and unused anomaly detection data.", + "value": { + "deleted": true + } +} diff --git a/specification/ml/delete_filter/examples/200_response/MlDeleteFilterResponseExample1.json b/specification/ml/delete_filter/examples/200_response/MlDeleteFilterResponseExample1.json new file mode 100644 index 0000000000..d6a662873b --- /dev/null +++ b/specification/ml/delete_filter/examples/200_response/MlDeleteFilterResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when deleting a filter.", + "value": { + "acknowledged": true + } +} diff --git a/specification/ml/delete_forecast/examples/200_response/MlDeleteForecastResponseExample1.json b/specification/ml/delete_forecast/examples/200_response/MlDeleteForecastResponseExample1.json new file mode 100644 index 0000000000..0f14eb53d4 --- /dev/null +++ b/specification/ml/delete_forecast/examples/200_response/MlDeleteForecastResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when deleting a forecast from an anomaly detection job.", + "value": { + "acknowledged": true + } +} diff --git a/specification/ml/delete_job/examples/200_response/MlDeleteJobResponseExample1.json b/specification/ml/delete_job/examples/200_response/MlDeleteJobResponseExample1.json new file mode 100644 index 0000000000..a4af5f45f6 --- /dev/null +++ b/specification/ml/delete_job/examples/200_response/MlDeleteJobResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when deleting an anomaly detection job.", + "value": { + "acknowledged": true + } +} diff --git a/specification/ml/delete_job/examples/200_response/MlDeleteJobResponseExample2.json b/specification/ml/delete_job/examples/200_response/MlDeleteJobResponseExample2.json new file mode 100644 index 0000000000..69513247cd --- /dev/null +++ b/specification/ml/delete_job/examples/200_response/MlDeleteJobResponseExample2.json @@ -0,0 +1,7 @@ +{ + "summary": "A successful response when deleting an anomaly detection job asynchronously.", + "description": "When the `wait_for_completion` query parameter is set to `false`, the response contains an identifier for the job deletion task.", + "value": { + "task": "oTUltX4IQMOUUVeiohTt8A:39" + } +} diff --git a/specification/ml/delete_model_snapshot/examples/200_responses/MlDeleteModelSnapshotResponseExample1.json b/specification/ml/delete_model_snapshot/examples/200_responses/MlDeleteModelSnapshotResponseExample1.json new file mode 100644 index 0000000000..70b57f01fe --- /dev/null +++ b/specification/ml/delete_model_snapshot/examples/200_responses/MlDeleteModelSnapshotResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when deleting an existing model snapshot.", + "value": { + "acknowledged": true + } +} diff --git a/specification/ml/delete_trained_model/examples/200_response/MlDeleteTrainedModelResponseExample1.json b/specification/ml/delete_trained_model/examples/200_response/MlDeleteTrainedModelResponseExample1.json new file mode 100644 index 0000000000..8cc48fcca7 --- /dev/null +++ b/specification/ml/delete_trained_model/examples/200_response/MlDeleteTrainedModelResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when deleting an existing trained inference model.", + "value": { + "acknowledged": true + } +} diff --git a/specification/ml/delete_trained_model_alias/examples/MlDeleteTrainedModelAliasResponseExample1.json b/specification/ml/delete_trained_model_alias/examples/MlDeleteTrainedModelAliasResponseExample1.json new file mode 100644 index 0000000000..22215fb01a --- /dev/null +++ b/specification/ml/delete_trained_model_alias/examples/MlDeleteTrainedModelAliasResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when deleting a trained model alias.", + "value": { + "acknowledged": true + } +} diff --git a/specification/ml/estimate_model_memory/examples/200_response/MlEstimateModelMemoryResponseExample1.json b/specification/ml/estimate_model_memory/examples/200_response/MlEstimateModelMemoryResponseExample1.json new file mode 100644 index 0000000000..65575c08b1 --- /dev/null +++ b/specification/ml/estimate_model_memory/examples/200_response/MlEstimateModelMemoryResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when estimating sufficent memory for a model.", + "value": { + "model_memory_estimate": "21mb" + } +} diff --git a/specification/ml/estimate_model_memory/examples/request/MlEstimateModelMemoryRequestExample1.json b/specification/ml/estimate_model_memory/examples/request/MlEstimateModelMemoryRequestExample1.json new file mode 100644 index 0000000000..1165694048 --- /dev/null +++ b/specification/ml/estimate_model_memory/examples/request/MlEstimateModelMemoryRequestExample1.json @@ -0,0 +1,25 @@ +{ + "summary": "A request of estimating model memory limit based on the analysis configuration details provided in the body.", + "value": { + "analysis_config": { + "bucket_span": "5m", + "detectors": [ + { + "function": "sum", + "field_name": "bytes", + "by_field_name": "status", + "partition_field_name": "app" + } + ], + "influencers": ["source_ip", "dest_ip"] + }, + "overall_cardinality": { + "status": 10, + "app": 50 + }, + "max_bucket_cardinality": { + "source_ip": 300, + "dest_ip": 30 + } + } +} diff --git a/specification/ml/evaluate_data_frame/examples/200_response/MlEvaluateDataFrameResponseClassificationExample1.json b/specification/ml/evaluate_data_frame/examples/200_response/MlEvaluateDataFrameResponseClassificationExample1.json new file mode 100644 index 0000000000..f11f17604c --- /dev/null +++ b/specification/ml/evaluate_data_frame/examples/200_response/MlEvaluateDataFrameResponseClassificationExample1.json @@ -0,0 +1,43 @@ +{ + "summary": "A succesful response for evaluating a classification analysis job for an annotated index.", + "description": "The `actual_class` contains the name of the class the analysis tried to predict. The `actual_class_doc_count` is the number of documents in the index belonging to the `actual_class`. The `predicted_classes` object contains the list of the predicted classes and the number of predictions associated with the class.", + "value": { + "classification": { + "multiclass_confusion_matrix": { + "confusion_matrix": [ + { + "actual_class": "cat", + "actual_class_doc_count": 12, + "predicted_classes": [ + { + "predicted_class": "cat", + "count": 12 + }, + { + "predicted_class": "dog", + "count": 0 + } + ], + "other_predicted_class_doc_count": 0 + }, + { + "actual_class": "dog", + "actual_class_doc_count": 11, + "predicted_classes": [ + { + "predicted_class": "dog", + "count": 7 + }, + { + "predicted_class": "cat", + "count": 4 + } + ], + "other_predicted_class_doc_count": 0 + } + ], + "other_actual_class_count": 0 + } + } + } +} diff --git a/specification/ml/evaluate_data_frame/examples/200_response/MlEvaluateDataFrameResponseClassificationExample2.json b/specification/ml/evaluate_data_frame/examples/200_response/MlEvaluateDataFrameResponseClassificationExample2.json new file mode 100644 index 0000000000..f7702fd424 --- /dev/null +++ b/specification/ml/evaluate_data_frame/examples/200_response/MlEvaluateDataFrameResponseClassificationExample2.json @@ -0,0 +1,10 @@ +{ + "summary": "A succesful response for evaluating a classification analysis job with the AUC ROC metrics for an annotated index.", + "value": { + "classification": { + "auc_roc": { + "value": 0.8941788639536681 + } + } + } +} diff --git a/specification/ml/evaluate_data_frame/examples/200_response/MlEvaluateDataFrameResponseOutlierExample.json b/specification/ml/evaluate_data_frame/examples/200_response/MlEvaluateDataFrameResponseOutlierExample.json new file mode 100644 index 0000000000..3ec45a6e29 --- /dev/null +++ b/specification/ml/evaluate_data_frame/examples/200_response/MlEvaluateDataFrameResponseOutlierExample.json @@ -0,0 +1,40 @@ +{ + "summary": "A successful response when evaluating an outlier detection job.", + "value": { + "outlier_detection": { + "auc_roc": { + "value": 0.92584757746414444 + }, + "confusion_matrix": { + "0.25": { + "tp": 5, + "fp": 9, + "tn": 204, + "fn": 5 + }, + "0.5": { + "tp": 1, + "fp": 5, + "tn": 208, + "fn": 9 + }, + "0.75": { + "tp": 0, + "fp": 4, + "tn": 209, + "fn": 10 + } + }, + "precision": { + "0.25": 0.35714285714285715, + "0.5": 0.16666666666666666, + "0.75": 0 + }, + "recall": { + "0.25": 0.5, + "0.5": 0.1, + "0.75": 0 + } + } + } +} diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestClassificationExample1.json b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestClassificationExample1.json new file mode 100644 index 0000000000..32bac77108 --- /dev/null +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestClassificationExample1.json @@ -0,0 +1,16 @@ +{ + "summary": "A request for evaluating a classification job for an annotated index.", + "description": "The `actual_field` contains the ground truth for classification. The `predicted_field` contains the predicted value calculated by the classification analysis.", + "value": { + "index": "animal_classification", + "evaluation": { + "classification": { + "actual_field": "animal_class", + "predicted_field": "ml.animal_class_prediction", + "metrics": { + "multiclass_confusion_matrix": {} + } + } + } + } +} diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestClassificationExample2.json b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestClassificationExample2.json new file mode 100644 index 0000000000..b0020c6245 --- /dev/null +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestClassificationExample2.json @@ -0,0 +1,17 @@ +{ + "summary": "A request for evaluating a classification job with AUC ROC metrics for an annotated index.", + "description": "The `class_name` specifies the class name that is treated as positive during the evaluation, all the other classes are treated as negative.", + "value": { + "index": "animal_classification", + "evaluation": { + "classification": { + "actual_field": "animal_class", + "metrics": { + "auc_roc": { + "class_name": "dog" + } + } + } + } + } +} diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestOutlierExample.json b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestOutlierExample.json new file mode 100644 index 0000000000..63eeb5d092 --- /dev/null +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestOutlierExample.json @@ -0,0 +1,12 @@ +{ + "summary": "A request for evaluating an outlier detection job for an annotated index.", + "value": { + "index": "my_analytics_dest_index", + "evaluation": { + "outlier_detection": { + "actual_field": "is_outlier", + "predicted_probability_field": "ml.outlier_score" + } + } + } +} diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestRegressionExample1.json b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestRegressionExample1.json new file mode 100644 index 0000000000..08a206c1a7 --- /dev/null +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestRegressionExample1.json @@ -0,0 +1,34 @@ +{ + "summary": "A request for evaluating the testing error of a regression job for an annotated index.", + "description": "The term query in the body limits evaluation to be performed on the test split only. The `actual_field` contains the ground truth for house prices. The `predicted_field` contains the house price calculated by the regression analysis.", + "value": { + "index": "house_price_predictions", + "query": { + "bool": { + "filter": [ + { + "term": { + "ml.is_training": false + } + } + ] + } + }, + "evaluation": { + "regression": { + "actual_field": "price", + "predicted_field": "ml.price_prediction", + "metrics": { + "r_squared": {}, + "mse": {}, + "msle": { + "offset": 10 + }, + "huber": { + "delta": 1.5 + } + } + } + } + } +} diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestRegressionExample2.json b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestRegressionExample2.json new file mode 100644 index 0000000000..8b2512da07 --- /dev/null +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestRegressionExample2.json @@ -0,0 +1,26 @@ +{ + "summary": "A request for evaluating the training error of a regression job for an annotated index.", + "description": "The term query in the body limits evaluation to be performed on the training split only. The `actual_field` contains the ground truth for house prices. The `predicted_field` contains the house price calculated by the regression analysis.", + "value": { + "index": "house_price_predictions", + "query": { + "term": { + "ml.is_training": { + "value": true + } + } + }, + "evaluation": { + "regression": { + "actual_field": "price", + "predicted_field": "ml.price_prediction", + "metrics": { + "r_squared": {}, + "mse": {}, + "msle": {}, + "huber": {} + } + } + } + } +} diff --git a/specification/ml/explain_data_frame_analytics/examples/200_response/MlExplainDataFrameAnalyticsResponseExample1.json b/specification/ml/explain_data_frame_analytics/examples/200_response/MlExplainDataFrameAnalyticsResponseExample1.json new file mode 100644 index 0000000000..946500d053 --- /dev/null +++ b/specification/ml/explain_data_frame_analytics/examples/200_response/MlExplainDataFrameAnalyticsResponseExample1.json @@ -0,0 +1,39 @@ +{ + "summary": "A succesful response for explaining a data frame analytics job configuration.", + "value": { + "field_selection": [ + { + "field": "number_of_bedrooms", + "mappings_types": ["integer"], + "is_included": true, + "is_required": false, + "feature_type": "numerical" + }, + { + "field": "postcode", + "mappings_types": ["text"], + "is_included": false, + "is_required": false, + "reason": "[postcode.keyword] is preferred because it is aggregatable" + }, + { + "field": "postcode.keyword", + "mappings_types": ["keyword"], + "is_included": true, + "is_required": false, + "feature_type": "categorical" + }, + { + "field": "price", + "mappings_types": ["float"], + "is_included": true, + "is_required": true, + "feature_type": "numerical" + } + ], + "memory_estimation": { + "expected_memory_without_disk": "128MB", + "expected_memory_with_disk": "32MB" + } + } +} diff --git a/specification/ml/explain_data_frame_analytics/examples/request/MlExplainDataFrameAnalyticsRequestExample1.json b/specification/ml/explain_data_frame_analytics/examples/request/MlExplainDataFrameAnalyticsRequestExample1.json new file mode 100644 index 0000000000..97d1057c71 --- /dev/null +++ b/specification/ml/explain_data_frame_analytics/examples/request/MlExplainDataFrameAnalyticsRequestExample1.json @@ -0,0 +1,13 @@ +{ + "summary": "A request for explaining a data frame analytics job configuration.", + "value": { + "source": { + "index": "houses_sold_last_10_yrs" + }, + "analysis": { + "regression": { + "dependent_variable": "price" + } + } + } +} diff --git a/specification/ml/open_job/examples/200_response/MlOpenJobResponseExample1.json b/specification/ml/open_job/examples/200_response/MlOpenJobResponseExample1.json new file mode 100644 index 0000000000..4f5b9b4abf --- /dev/null +++ b/specification/ml/open_job/examples/200_response/MlOpenJobResponseExample1.json @@ -0,0 +1,7 @@ +{ + "summary": "A successful response when opening an anomaly detection job.", + "value": { + "opened": true, + "node": "node-1" + } +} diff --git a/specification/ml/open_job/examples/request/MlOpenJobRequestExample1.json b/specification/ml/open_job/examples/request/MlOpenJobRequestExample1.json new file mode 100644 index 0000000000..44de2836e1 --- /dev/null +++ b/specification/ml/open_job/examples/request/MlOpenJobRequestExample1.json @@ -0,0 +1,7 @@ +{ + "summary": "A request to open anomaly detection jobs.", + "description": "The timeout specifies to wait 35 minutes for the job to open.", + "value": { + "timeout": "35m" + } +} diff --git a/specification/ml/put_job/examples/200_response/MlPutJobResponseExample1.json b/specification/ml/put_job/examples/200_response/MlPutJobResponseExample1.json new file mode 100644 index 0000000000..ed3d4ef453 --- /dev/null +++ b/specification/ml/put_job/examples/200_response/MlPutJobResponseExample1.json @@ -0,0 +1,77 @@ +{ + "summary": "A successful response when creating an anomaly detection job and datafeed.", + "value": { + "job_id": "test-job1", + "job_type": "anomaly_detector", + "job_version": "8.4.0", + "create_time": 1656087283340, + "datafeed_config": { + "datafeed_id": "datafeed-test-job1", + "job_id": "test-job1", + "authorization": { + "roles": ["superuser"] + }, + "query_delay": "61499ms", + "chunking_config": { + "mode": "auto" + }, + "indices_options": { + "expand_wildcards": ["open"], + "ignore_unavailable": false, + "allow_no_indices": true, + "ignore_throttled": true + }, + "query": { + "bool": { + "must": [ + { + "match_all": {} + } + ] + } + }, + "indices": ["kibana_sample_data_logs"], + "scroll_size": 1000, + "delayed_data_check_config": { + "enabled": true + }, + "runtime_mappings": { + "hour_of_day": { + "type": "long", + "script": { + "source": "emit(doc['timestamp'].value.getHour());" + } + } + } + }, + "analysis_config": { + "bucket_span": "15m", + "detectors": [ + { + "detector_description": "Sum of bytes", + "function": "sum", + "field_name": "bytes", + "detector_index": 0 + } + ], + "influencers": [], + "model_prune_window": "30d" + }, + "analysis_limits": { + "model_memory_limit": "11mb", + "categorization_examples_limit": 4 + }, + "data_description": { + "time_field": "timestamp", + "time_format": "epoch_ms" + }, + "model_plot_config": { + "enabled": true, + "annotations_enabled": true + }, + "model_snapshot_retention_days": 10, + "daily_model_snapshot_retention_after_days": 1, + "results_index_name": "custom-test-job1", + "allow_lazy_open": false + } +} diff --git a/specification/ml/put_job/examples/request/MlPutJobRequestExample1.json b/specification/ml/put_job/examples/request/MlPutJobRequestExample1.json new file mode 100644 index 0000000000..5095de5462 --- /dev/null +++ b/specification/ml/put_job/examples/request/MlPutJobRequestExample1.json @@ -0,0 +1,48 @@ +{ + "summary": "A request to create an anomaly detection job and datafeed.", + "value": { + "analysis_config": { + "bucket_span": "15m", + "detectors": [ + { + "detector_description": "Sum of bytes", + "function": "sum", + "field_name": "bytes" + } + ] + }, + "data_description": { + "time_field": "timestamp", + "time_format": "epoch_ms" + }, + "analysis_limits": { + "model_memory_limit": "11MB" + }, + "model_plot_config": { + "enabled": true, + "annotations_enabled": true + }, + "results_index_name": "test-job1", + "datafeed_config": { + "indices": ["kibana_sample_data_logs"], + "query": { + "bool": { + "must": [ + { + "match_all": {} + } + ] + } + }, + "runtime_mappings": { + "hour_of_day": { + "type": "long", + "script": { + "source": "emit(doc['timestamp'].value.getHour());" + } + } + }, + "datafeed_id": "datafeed-test-job1" + } + } +} diff --git a/specification/transform/delete_transform/examples/200_response/DeleteTransformResponseExample1.json b/specification/transform/delete_transform/examples/200_response/DeleteTransformResponseExample1.json new file mode 100644 index 0000000000..4d769228ea --- /dev/null +++ b/specification/transform/delete_transform/examples/200_response/DeleteTransformResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when the transform is deleted.", + "value": { + "acknowledged": true + } +} diff --git a/specification/transform/get_transform/examples/200_response/GetTransformResponseExample1.json b/specification/transform/get_transform/examples/200_response/GetTransformResponseExample1.json new file mode 100644 index 0000000000..eb39831c0d --- /dev/null +++ b/specification/transform/get_transform/examples/200_response/GetTransformResponseExample1.json @@ -0,0 +1,61 @@ +{ + "summary": "A successful response that contains configuration information for a transform.", + "value": { + "count": 1, + "transforms": [ + { + "id": "ecommerce_transform1", + "authorization": { + "roles": ["superuser"] + }, + "version": "8.4.0", + "create_time": 1656023416565, + "source": { + "index": ["kibana_sample_data_ecommerce"], + "query": { + "term": { + "geoip.continent_name": { + "value": "Asia" + } + } + } + }, + "dest": { + "index": "kibana_sample_data_ecommerce_transform1", + "pipeline": "add_timestamp_pipeline" + }, + "frequency": "5m", + "sync": { + "time": { + "field": "order_date", + "delay": "60s" + } + }, + "pivot": { + "group_by": { + "customer_id": { + "terms": { + "field": "customer_id" + } + } + }, + "aggregations": { + "max_price": { + "max": { + "field": "taxful_total_price" + } + } + } + }, + "description": "Maximum priced ecommerce data by customer_id in Asia", + "settings": {}, + "retention_policy": { + "time": { + "field": "order_date", + "max_age": "30d" + } + } + } + ] + } +} diff --git a/specification/transform/get_transform_stats/examples/200_response/GetTransformStatsResponseExample1.json b/specification/transform/get_transform_stats/examples/200_response/GetTransformStatsResponseExample1.json new file mode 100644 index 0000000000..9f9690a9f2 --- /dev/null +++ b/specification/transform/get_transform_stats/examples/200_response/GetTransformStatsResponseExample1.json @@ -0,0 +1,49 @@ +{ + "summary": "A successful response that contains usage information for a transform.", + "value": { + "count": 1, + "transforms": [ + { + "id": "ecommerce-customer-transform", + "state": "started", + "node": { + "id": "cpTIGMsVQ8Gqwqlxxxxxxx", + "name": "my.home", + "ephemeral_id": "5-L21nFsQxxxxxxxxxx-xx", + "transport_address": "127.0.0.1:9300", + "attributes": {} + }, + "stats": { + "pages_processed": 78, + "documents_processed": 6027, + "documents_indexed": 68, + "documents_deleted": 22, + "delete_time_in_ms": 214, + "trigger_count": 168, + "index_time_in_ms": 412, + "index_total": 20, + "index_failures": 0, + "search_time_in_ms": 353, + "search_total": 78, + "search_failures": 0, + "processing_time_in_ms": 8, + "processing_total": 78, + "exponential_avg_checkpoint_duration_ms": 97.30637923893185, + "exponential_avg_documents_indexed": 2.2064915040974062, + "exponential_avg_documents_processed": 179.89419945785045 + }, + "checkpointing": { + "last": { + "checkpoint": 20, + "timestamp_millis": 1585344558220, + "time_upper_bound_millis": 1585344498220 + }, + "changes_last_detected_at": 1585344558219 + }, + "health": { + "status": "green" + } + } + ] + } +} diff --git a/specification/transform/preview_transform/examples/200_response/PreviewTransformResponseExample1.json b/specification/transform/preview_transform/examples/200_response/PreviewTransformResponseExample1.json new file mode 100644 index 0000000000..3c93bc0010 --- /dev/null +++ b/specification/transform/preview_transform/examples/200_response/PreviewTransformResponseExample1.json @@ -0,0 +1,220 @@ +{ + "summary": "A successful response contains a preview a transform that uses the pivot method.", + "value": { + "preview": [ + { + "max_price": 171, + "customer_id": "10" + }, + { + "max_price": 233, + "customer_id": "11" + }, + { + "max_price": 200, + "customer_id": "12" + }, + { + "max_price": 301, + "customer_id": "13" + }, + { + "max_price": 176, + "customer_id": "14" + }, + { + "max_price": 2250, + "customer_id": "15" + }, + { + "max_price": 170, + "customer_id": "16" + }, + { + "max_price": 243, + "customer_id": "17" + }, + { + "max_price": 154, + "customer_id": "18" + }, + { + "max_price": 393, + "customer_id": "19" + }, + { + "max_price": 165, + "customer_id": "20" + }, + { + "max_price": 115, + "customer_id": "21" + }, + { + "max_price": 192, + "customer_id": "22" + }, + { + "max_price": 169, + "customer_id": "23" + }, + { + "max_price": 230, + "customer_id": "24" + }, + { + "max_price": 278, + "customer_id": "25" + }, + { + "max_price": 200, + "customer_id": "26" + }, + { + "max_price": 344, + "customer_id": "27" + }, + { + "max_price": 175, + "customer_id": "28" + }, + { + "max_price": 177, + "customer_id": "29" + }, + { + "max_price": 190, + "customer_id": "30" + }, + { + "max_price": 190, + "customer_id": "31" + }, + { + "max_price": 205, + "customer_id": "32" + }, + { + "max_price": 215, + "customer_id": "33" + }, + { + "max_price": 270, + "customer_id": "34" + }, + { + "max_price": 184, + "customer_id": "36" + }, + { + "max_price": 222, + "customer_id": "37" + }, + { + "max_price": 370, + "customer_id": "38" + }, + { + "max_price": 240, + "customer_id": "39" + }, + { + "max_price": 230, + "customer_id": "4" + }, + { + "max_price": 229, + "customer_id": "41" + }, + { + "max_price": 190, + "customer_id": "42" + }, + { + "max_price": 150, + "customer_id": "43" + }, + { + "max_price": 175, + "customer_id": "44" + }, + { + "max_price": 190, + "customer_id": "45" + }, + { + "max_price": 150, + "customer_id": "46" + }, + { + "max_price": 310, + "customer_id": "48" + }, + { + "max_price": 223, + "customer_id": "49" + }, + { + "max_price": 283, + "customer_id": "5" + }, + { + "max_price": 185, + "customer_id": "50" + }, + { + "max_price": 190, + "customer_id": "51" + }, + { + "max_price": 333, + "customer_id": "52" + }, + { + "max_price": 165, + "customer_id": "6" + }, + { + "max_price": 144, + "customer_id": "7" + }, + { + "max_price": 198, + "customer_id": "8" + }, + { + "max_price": 210, + "customer_id": "9" + } + ], + "generated_dest_index": { + "mappings": { + "_meta": { + "_transform": { + "transform": "transform-preview", + "version": { + "created": "10.0.0" + }, + "creation_date_in_millis": 1712948905889 + }, + "created_by": "transform" + }, + "properties": { + "max_price": { + "type": "half_float" + }, + "customer_id": { + "type": "keyword" + } + } + }, + "settings": { + "index": { + "number_of_shards": "1", + "auto_expand_replicas": "0-1" + } + }, + "aliases": {} + } + } +} diff --git a/specification/transform/preview_transform/examples/request/PreviewTransformRequestExample1.json b/specification/transform/preview_transform/examples/request/PreviewTransformRequestExample1.json new file mode 100644 index 0000000000..8cb8d085e2 --- /dev/null +++ b/specification/transform/preview_transform/examples/request/PreviewTransformRequestExample1.json @@ -0,0 +1,25 @@ +{ + "summary": "A request to preview a transform that uses the pivot method.", + "value": { + "source": { + "index": "kibana_sample_data_ecommerce" + }, + "pivot": { + "group_by": { + "customer_id": { + "terms": { + "field": "customer_id", + "missing_bucket": true + } + } + }, + "aggregations": { + "max_price": { + "max": { + "field": "taxful_total_price" + } + } + } + } + } +} diff --git a/specification/transform/put_transform/examples/200_response/PutTransformResponseExample1.json b/specification/transform/put_transform/examples/200_response/PutTransformResponseExample1.json new file mode 100644 index 0000000000..b07c11b2c0 --- /dev/null +++ b/specification/transform/put_transform/examples/200_response/PutTransformResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when creating a transform.", + "value": { + "acknowledged": true + } +} diff --git a/specification/transform/put_transform/examples/request/PutTransformRequestExample1.json b/specification/transform/put_transform/examples/request/PutTransformRequestExample1.json new file mode 100644 index 0000000000..78ff6fe3fc --- /dev/null +++ b/specification/transform/put_transform/examples/request/PutTransformRequestExample1.json @@ -0,0 +1,50 @@ +{ + "summary": "A request to create a transform that uses the pivot method.", + "value": { + "source": { + "index": "kibana_sample_data_ecommerce", + "query": { + "term": { + "geoip.continent_name": { + "value": "Asia" + } + } + } + }, + "pivot": { + "group_by": { + "customer_id": { + "terms": { + "field": "customer_id", + "missing_bucket": true + } + } + }, + "aggregations": { + "max_price": { + "max": { + "field": "taxful_total_price" + } + } + } + }, + "description": "Maximum priced ecommerce data by customer_id in Asia", + "dest": { + "index": "kibana_sample_data_ecommerce_transform1", + "pipeline": "add_timestamp_pipeline" + }, + "frequency": "5m", + "sync": { + "time": { + "field": "order_date", + "delay": "60s" + } + }, + "retention_policy": { + "time": { + "field": "order_date", + "max_age": "30d" + } + } + } +} diff --git a/specification/transform/put_transform/examples/request/PutTransformRequestExample2.json b/specification/transform/put_transform/examples/request/PutTransformRequestExample2.json new file mode 100644 index 0000000000..7834bbd90b --- /dev/null +++ b/specification/transform/put_transform/examples/request/PutTransformRequestExample2.json @@ -0,0 +1,23 @@ +{ + "summary": "A request to create a transform that uses the latest method.", + "value": { + "source": { + "index": "kibana_sample_data_ecommerce" + }, + "latest": { + "unique_key": ["customer_id"], + "sort": "order_date" + }, + "description": "Latest order for each customer", + "dest": { + "index": "kibana_sample_data_ecommerce_transform2" + }, + "frequency": "5m", + "sync": { + "time": { + "field": "order_date", + "delay": "60s" + } + } + } +} diff --git a/specification/transform/reset_transform/examples/200_response/ResetTransformResponseExample1.json b/specification/transform/reset_transform/examples/200_response/ResetTransformResponseExample1.json new file mode 100644 index 0000000000..5782d24bc5 --- /dev/null +++ b/specification/transform/reset_transform/examples/200_response/ResetTransformResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when the transform is reset.", + "value": { + "acknowledged": true + } +} diff --git a/specification/transform/schedule_now_transform/examples/200_response/ResetTransformResponseExample1.json b/specification/transform/schedule_now_transform/examples/200_response/ResetTransformResponseExample1.json new file mode 100644 index 0000000000..f64f529373 --- /dev/null +++ b/specification/transform/schedule_now_transform/examples/200_response/ResetTransformResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when the transform is scheduled to run now.", + "value": { + "acknowledged": true + } +} diff --git a/specification/transform/start_transform/examples/200_response/StartTransformResponseExample1.json b/specification/transform/start_transform/examples/200_response/StartTransformResponseExample1.json new file mode 100644 index 0000000000..8e06dfeb6f --- /dev/null +++ b/specification/transform/start_transform/examples/200_response/StartTransformResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when a transform starts.", + "value": { + "acknowledged": true + } +} diff --git a/specification/transform/stop_transform/examples/200_response/StopTransformResponseExample1.json b/specification/transform/stop_transform/examples/200_response/StopTransformResponseExample1.json new file mode 100644 index 0000000000..15a8aa85c0 --- /dev/null +++ b/specification/transform/stop_transform/examples/200_response/StopTransformResponseExample1.json @@ -0,0 +1,6 @@ +{ + "summary": "A successful response when a transform stops.", + "value": { + "acknowledged": true + } +} diff --git a/specification/transform/update_transform/examples/200_response/UpdateTransformResponseExample1.json b/specification/transform/update_transform/examples/200_response/UpdateTransformResponseExample1.json new file mode 100644 index 0000000000..ca2d25a7bc --- /dev/null +++ b/specification/transform/update_transform/examples/200_response/UpdateTransformResponseExample1.json @@ -0,0 +1,57 @@ +{ + "summary": "A successful response when creating a transform.", + "value": { + "id": "simple-kibana-ecomm-pivot", + "authorization": { + "roles": ["superuser"] + }, + "version": "10.0.0", + "create_time": 1712951576767, + "source": { + "index": ["kibana_sample_data_ecommerce"], + "query": { + "term": { + "geoip.continent_name": { + "value": "Asia" + } + } + } + }, + "dest": { + "index": "kibana_sample_data_ecommerce_transform_v2", + "pipeline": "add_timestamp_pipeline" + }, + "frequency": "15m", + "sync": { + "time": { + "field": "order_date", + "delay": "120s" + } + }, + "pivot": { + "group_by": { + "customer_id": { + "terms": { + "field": "customer_id", + "missing_bucket": true + } + } + }, + "aggregations": { + "max_price": { + "max": { + "field": "taxful_total_price" + } + } + } + }, + "description": "Maximum priced ecommerce data by customer_id in Asia", + "settings": {}, + "retention_policy": { + "time": { + "field": "order_date", + "max_age": "30d" + } + } + } +} diff --git a/specification/transform/update_transform/examples/request/UpdateTransformRequestExample1.json b/specification/transform/update_transform/examples/request/UpdateTransformRequestExample1.json new file mode 100644 index 0000000000..c792b24d9c --- /dev/null +++ b/specification/transform/update_transform/examples/request/UpdateTransformRequestExample1.json @@ -0,0 +1,50 @@ +{ + "summary": "A request to update a transform that uses the pivot method.", + "value": { + "source": { + "index": "kibana_sample_data_ecommerce", + "query": { + "term": { + "geoip.continent_name": { + "value": "Asia" + } + } + } + }, + "pivot": { + "group_by": { + "customer_id": { + "terms": { + "field": "customer_id", + "missing_bucket": true + } + } + }, + "aggregations": { + "max_price": { + "max": { + "field": "taxful_total_price" + } + } + } + }, + "description": "Maximum priced ecommerce data by customer_id in Asia", + "dest": { + "index": "kibana_sample_data_ecommerce_transform1", + "pipeline": "add_timestamp_pipeline" + }, + "frequency": "5m", + "sync": { + "time": { + "field": "order_date", + "delay": "60s" + } + }, + "retention_policy": { + "time": { + "field": "order_date", + "max_age": "30d" + } + } + } +} diff --git a/specification/transform/upgrade_transforms/examples/200_response/UpgradeTransformResponseExample1.json b/specification/transform/upgrade_transforms/examples/200_response/UpgradeTransformResponseExample1.json new file mode 100644 index 0000000000..4d6587a8c4 --- /dev/null +++ b/specification/transform/upgrade_transforms/examples/200_response/UpgradeTransformResponseExample1.json @@ -0,0 +1,8 @@ +{ + "summary": "A successful response contains a summary when all transforms are upgraded.", + "value": { + "needs_update": 0, + "updated": 2, + "no_action": 1 + } +}