From 4a31c426e6f97ac39964ae997e7d02e99881c466 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?=
 <istvan.szabo@elastic.co>
Date: Thu, 25 Jul 2019 16:45:06 +0200
Subject: [PATCH] [DOCS] Adds allow no datafeeds query param to the GET, GET
 stats and STOP datafeed APIs (#44499)

---
 .../apis/get-datafeed-stats.asciidoc          | 25 +++++++++++++++++++
 .../apis/get-datafeed.asciidoc                | 24 ++++++++++++++++++
 .../apis/stop-datafeed.asciidoc               | 24 ++++++++++++++++++
 3 files changed, 73 insertions(+)

diff --git a/docs/reference/ml/anomaly-detection/apis/get-datafeed-stats.asciidoc b/docs/reference/ml/anomaly-detection/apis/get-datafeed-stats.asciidoc
index 95cb7777b9b..42db449e377 100644
--- a/docs/reference/ml/anomaly-detection/apis/get-datafeed-stats.asciidoc
+++ b/docs/reference/ml/anomaly-detection/apis/get-datafeed-stats.asciidoc
@@ -49,6 +49,24 @@ IMPORTANT: This API returns a maximum of 10,000 {dfeeds}.
   or a wildcard expression. If you do not specify one of these options, the API
   returns statistics for all {dfeeds}.
 
+[[ml-get-datafeed-stats-query-parms]]
+==== {api-query-parms-title}
+
+`allow_no_datafeeds`::
+  (Optional, boolean) Specifies what to do when the request:
++
+--
+* Contains wildcard expressions and there are no {datafeeds} that match.
+* Contains the `_all` string or no identifiers and there are no matches.
+* Contains wildcard expressions and there are only partial matches. 
+
+The default value is `true`, which returns an empty `datafeeds` array when
+there are no matches and the subset of results when there are partial matches.
+If this parameter is `false`, the request returns a `404` status code when there
+are no matches or only partial matches.
+--
+
+
 [[ml-get-datafeed-stats-results]]
 ==== {api-response-body-title}
 
@@ -58,6 +76,13 @@ The API returns the following information:
   (array) An array of {dfeed} count objects.
   For more information, see <<ml-datafeed-counts>>.
 
+[[ml-get-datafeed-stats-response-codes]]
+==== {api-response-codes-title}
+
+`404` (Missing resources)::
+  If `allow_no_datafeeds` is `false`, this code indicates that there are no
+  resources that match the request or only partial matches for the request. 
+
 [[ml-get-datafeed-stats-example]]
 ==== {api-examples-title}
 
diff --git a/docs/reference/ml/anomaly-detection/apis/get-datafeed.asciidoc b/docs/reference/ml/anomaly-detection/apis/get-datafeed.asciidoc
index 6e93c1f9ce1..917599c4b94 100644
--- a/docs/reference/ml/anomaly-detection/apis/get-datafeed.asciidoc
+++ b/docs/reference/ml/anomaly-detection/apis/get-datafeed.asciidoc
@@ -46,6 +46,23 @@ IMPORTANT: This API returns a maximum of 10,000 {dfeeds}.
   or a wildcard expression. If you do not specify one of these options, the API
   returns information about all {dfeeds}.
 
+[[ml-get-datafeed-query-parms]]
+==== {api-query-parms-title}
+
+`allow_no_datafeeds`::
+  (Optional, boolean) Specifies what to do when the request:
++
+--
+* Contains wildcard expressions and there are no {datafeeds} that match.
+* Contains the `_all` string or no identifiers and there are no matches.
+* Contains wildcard expressions and there are only partial matches. 
+
+The default value is `true`, which returns an empty `datafeeds` array when
+there are no matches and the subset of results when there are partial matches.
+If this parameter is `false`, the request returns a `404` status code when there
+are no matches or only partial matches.
+--
+
 [[ml-get-datafeed-results]]
 ==== {api-response-body-title}
 
@@ -55,6 +72,13 @@ The API returns the following information:
   (array) An array of {dfeed} objects.
   For more information, see <<ml-datafeed-resource>>.
 
+[[ml-get-datafeed-response-codes]]
+==== {api-response-codes-title}
+
+`404` (Missing resources)::
+  If `allow_no_datafeeds` is `false`, this code indicates that there are no
+  resources that match the request or only partial matches for the request.
+
 [[ml-get-datafeed-example]]
 ==== {api-examples-title}
 
diff --git a/docs/reference/ml/anomaly-detection/apis/stop-datafeed.asciidoc b/docs/reference/ml/anomaly-detection/apis/stop-datafeed.asciidoc
index e0732b1428f..f849f0faf75 100644
--- a/docs/reference/ml/anomaly-detection/apis/stop-datafeed.asciidoc
+++ b/docs/reference/ml/anomaly-detection/apis/stop-datafeed.asciidoc
@@ -43,6 +43,23 @@ comma-separated list of {dfeeds} or a wildcard expression. You can close all
   (Required, string) Identifier for the {dfeed}. It can be a {dfeed} identifier
   or a wildcard expression.
 
+[[ml-stop-datafeed-query-parms]]
+==== {api-query-parms-title}
+
+`allow_no_datafeeds`::
+  (Optional, boolean) Specifies what to do when the request:
++
+--
+* Contains wildcard expressions and there are no {datafeeds} that match.
+* Contains the `_all` string or no identifiers and there are no matches.
+* Contains wildcard expressions and there are only partial matches. 
+
+The default value is `true`, which returns an empty `datafeeds` array when
+there are no matches and the subset of results when there are partial matches.
+If this parameter is `false`, the request returns a `404` status code when there
+are no matches or only partial matches.
+--
+
 [[ml-stop-datafeed-request-body]]
 ==== {api-request-body-title}
 
@@ -53,6 +70,13 @@ comma-separated list of {dfeeds} or a wildcard expression. You can close all
   (Optional, time) Controls the amount of time to wait until a {dfeed} stops.
   The default value is 20 seconds.
 
+[[ml-stop-datafeed-response-codes]]
+==== {api-response-codes-title}
+
+`404` (Missing resources)::
+  If `allow_no_datafeeds` is `false`, this code indicates that there are no
+  resources that match the request or only partial matches for the request.
+
 [[ml-stop-datafeed-example]]
 ==== {api-examples-title}