Instantiates a datafeed.
You must create a job before you create a datafeed. You can associate only one datafeed to each job.
You must use Kibana or this API to create a datafeed. Do not put a datafeed
directly to the .ml-config
index using the Elasticsearch index API.
If Elasticsearch security features are enabled, do not give users write
privileges on the .ml-config
index.
feed_id
(required)
aggregations
chunking_config
frequency
150s
.
indices
(required)
["it_ops_metrics", "server*"]
.
job_id
(required)
query
{"match_all": {"boost": 1}}
.
query_delay
60s
.
script_fields
scroll_size
size
parameter that is used in Elasticsearch searches.
The default value is 1000
.
delayed_data_check_config
For more information about these properties, see Datafeed resources.
If Elasticsearch security features are enabled, you must have manage_ml
, or manage
cluster privileges to use this API. For more information, see
Security Privileges.
When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had at the time of creation and runs the query using those same roles.
The following example creates the datafeed-total-requests
datafeed:
PUT _ml/datafeeds/datafeed-total-requests { "job_id": "total-requests", "indices": ["server-metrics"] }
When the datafeed is created, you receive the following results:
{ "datafeed_id": "datafeed-total-requests", "job_id": "total-requests", "query_delay": "83474ms", "indices": [ "server-metrics" ], "query": { "match_all": { "boost": 1.0 } }, "scroll_size": 1000, "chunking_config": { "mode": "auto" } }