put-datafeed.asciidoc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. --
  2. :api: put-datafeed
  3. :request: PutDatafeedRequest
  4. :response: PutDatafeedResponse
  5. --
  6. [role="xpack"]
  7. [id="{upid}-{api}"]
  8. === Put datafeed API
  9. Creates a new {ml} datafeed in the cluster. The API accepts a +{request}+ object
  10. as a request and returns a +{response}+.
  11. [id="{upid}-{api}-request"]
  12. ==== Put datafeed request
  13. A +{request}+ requires the following argument:
  14. ["source","java",subs="attributes,callouts,macros"]
  15. --------------------------------------------------
  16. include-tagged::{doc-tests-file}[{api}-request]
  17. --------------------------------------------------
  18. <1> The configuration of the {ml} datafeed to create.
  19. [id="{upid}-{api}-config"]
  20. ==== Datafeed configuration
  21. The `DatafeedConfig` object contains all the details about the {ml} datafeed
  22. configuration.
  23. A `DatafeedConfig` requires the following arguments:
  24. ["source","java",subs="attributes,callouts,macros"]
  25. --------------------------------------------------
  26. include-tagged::{doc-tests-file}[{api}-config]
  27. --------------------------------------------------
  28. <1> The datafeed ID and the {anomaly-job} ID.
  29. <2> The indices that contain the data to retrieve and feed into the {anomaly-job}.
  30. ==== Optional arguments
  31. The following arguments are optional:
  32. ["source","java",subs="attributes,callouts,macros"]
  33. --------------------------------------------------
  34. include-tagged::{doc-tests-file}[{api}-config-set-chunking-config]
  35. --------------------------------------------------
  36. <1> Specifies how data searches are split into time chunks.
  37. ["source","java",subs="attributes,callouts,macros"]
  38. --------------------------------------------------
  39. include-tagged::{doc-tests-file}[{api}-config-set-frequency]
  40. --------------------------------------------------
  41. <1> The interval at which scheduled queries are made while the datafeed runs in
  42. real time.
  43. ["source","java",subs="attributes,callouts,macros"]
  44. --------------------------------------------------
  45. include-tagged::{doc-tests-file}[{api}-config-set-query]
  46. --------------------------------------------------
  47. <1> A query to filter the search results by. Defaults to the `match_all` query.
  48. ["source","java",subs="attributes,callouts,macros"]
  49. --------------------------------------------------
  50. include-tagged::{doc-tests-file}[{api}-config-set-query-delay]
  51. --------------------------------------------------
  52. <1> The time interval behind real time that data is queried.
  53. ["source","java",subs="attributes,callouts,macros"]
  54. --------------------------------------------------
  55. include-tagged::{doc-tests-file}[{api}-config-set-delayed-data-check-config]
  56. --------------------------------------------------
  57. <1> Sets the delayed data check configuration.
  58. The window must be larger than the Job's bucket size, but smaller than 24 hours,
  59. and span less than 10,000 buckets.
  60. Defaults to `null`, which causes an appropriate window span to be calculated when
  61. the datafeed runs.
  62. The default `check_window` span calculation is the max between `2h` or
  63. `8 * bucket_span`. To explicitly disable, pass
  64. `DelayedDataCheckConfig.disabledDelayedDataCheckConfig()`.
  65. ["source","java",subs="attributes,callouts,macros"]
  66. --------------------------------------------------
  67. include-tagged::{doc-tests-file}[{api}-config-set-script-fields]
  68. --------------------------------------------------
  69. <1> Allows the use of script fields.
  70. ["source","java",subs="attributes,callouts,macros"]
  71. --------------------------------------------------
  72. include-tagged::{doc-tests-file}[{api}-config-set-scroll-size]
  73. --------------------------------------------------
  74. <1> The `size` parameter used in the searches.
  75. include::../execution.asciidoc[]
  76. [id="{upid}-{api}-response"]
  77. ==== Response
  78. The returned +{response}+ returns the full representation of
  79. the new {ml} datafeed if it has been successfully created. This will
  80. contain the creation time and other fields initialized using
  81. default values:
  82. ["source","java",subs="attributes,callouts,macros"]
  83. --------------------------------------------------
  84. include-tagged::{doc-tests-file}[{api}-response]
  85. --------------------------------------------------
  86. <1> The created datafeed.