| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 | --:api: put-datafeed:request: PutDatafeedRequest:response: PutDatafeedResponse--[id="{upid}-{api}"]=== Put Datafeed APIThe Put Datafeed API can be used to create a new {ml} datafeedin the cluster. The API accepts a +{request}+ objectas a request and returns a +{response}+.[id="{upid}-{api}-request"]==== Put Datafeed RequestA +{request}+ requires the following argument:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request]--------------------------------------------------<1> The configuration of the {ml} datafeed to create[id="{upid}-{api}-config"]==== Datafeed ConfigurationThe `DatafeedConfig` object contains all the details about the {ml} datafeedconfiguration.A `DatafeedConfig` requires the following arguments:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-config]--------------------------------------------------<1> The datafeed ID and the job ID<2> The indices that contain the data to retrieve and feed into the job==== Optional ArgumentsThe following arguments are optional:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-config-set-chunking-config]--------------------------------------------------<1> Specifies how data searches are split into time chunks.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-config-set-frequency]--------------------------------------------------<1> The interval at which scheduled queries are made while the datafeed runs in real time.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-config-set-query]--------------------------------------------------<1> A query to filter the search results by. Defaults to the `match_all` query.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-config-set-query-delay]--------------------------------------------------<1> The time interval behind real time that data is queried.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-config-set-script-fields]--------------------------------------------------<1> Allows the use of script fields.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-config-set-scroll-size]--------------------------------------------------<1> The `size` parameter used in the searches.include::../execution.asciidoc[][id="{upid}-{api}-response"]==== ResponseThe returned +{response}+ returns the full representation ofthe new {ml} datafeed if it has been successfully created. This willcontain the creation time and other fields initialized usingdefault values:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-response]--------------------------------------------------<1> The created datafeed
 |