[[ml-get-datafeed-stats]]
==== Get Data Feed Statistics

The get data feed statistics API allows you to retrieve usage information for
data feeds.

===== Request

`GET _xpack/ml/datafeeds/_stats` +

`GET _xpack/ml/datafeeds/<feed_id>/_stats`


===== Description

If the data feed is stopped, the only information you receive is the
`datafeed_id` and the `state`.

===== Path Parameters

`feed_id`::
  (+string+) Identifier for the data feed.
  If you do not specify this optional parameter, the API returns information
  about all data feeds that you have authority to view.

===== Results

The API returns the following usage information:

`assigment_explanation`::
  TBD
  For example: ""

`datafeed_id`::
  (+string+) A numerical character string that uniquely identifies the data feed.

`node`::
  (+object+) TBD

`state`::
  (+string+) The status of the data feed, which can be one of the following values:
  * `started`: The data feed is actively receiving data.
  * `stopped`: The data feed is stopped and will not receive data until
    it is re-started.
//failed?
////
===== Responses

200
(EmptyResponse) The cluster has been successfully deleted
404
(BasicFailedReply) The cluster specified by {cluster_id} cannot be found (code: clusters.cluster_not_found)
412
(BasicFailedReply) The Elasticsearch cluster has not been shutdown yet (code: clusters.cluster_plan_state_error)
////
===== Examples

.Example results for a started job
----
{
  "count": 1,
  "datafeeds": [
    {
      "datafeed_id": "datafeed-farequote",
      "state": "started",
      "node": {
        "id": "0-o0tOoRTwKFZifatTWKNw",
        "name": "0-o0tOo",
        "ephemeral_id": "DOZltLxLS_SzYpW6hQ9hyg",
        "transport_address": "127.0.0.1:9300",
        "attributes": {
          "max_running_jobs": "10"
        }
      },
      "assigment_explanation": ""
    }
  ]
}
----
