put-data-frame-analytics.asciidoc 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. --
  2. :api: put-data-frame-analytics
  3. :request: PutDataFrameAnalyticsRequest
  4. :response: PutDataFrameAnalyticsResponse
  5. --
  6. [role="xpack"]
  7. [id="{upid}-{api}"]
  8. === Put {dfanalytics} API
  9. The Put {dfanalytics} API is used to create a new {dataframe-analytics-config}.
  10. The API accepts a +{request}+ object as a request and returns a +{response}+.
  11. [id="{upid}-{api}-request"]
  12. ==== Put {dfanalytics} 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 {dfanalytics-job} to create
  19. [id="{upid}-{api}-config"]
  20. ==== {dfanalytics-cap} configuration
  21. The `DataFrameAnalyticsConfig` object contains all the details about the {dfanalytics-job}
  22. configuration and contains the following arguments:
  23. ["source","java",subs="attributes,callouts,macros"]
  24. --------------------------------------------------
  25. include-tagged::{doc-tests-file}[{api}-config]
  26. --------------------------------------------------
  27. <1> The {dataframe-analytics-config} id
  28. <2> The source index and query from which to gather data
  29. <3> The destination index
  30. <4> The analysis to be performed
  31. <5> The fields to be included in / excluded from the analysis
  32. <6> The memory limit for the model created as part of the analysis process
  33. <7> Optionally, a human-readable description
  34. [id="{upid}-{api}-query-config"]
  35. ==== SourceConfig
  36. The index and the query from which to collect data.
  37. ["source","java",subs="attributes,callouts,macros"]
  38. --------------------------------------------------
  39. include-tagged::{doc-tests-file}[{api}-source-config]
  40. --------------------------------------------------
  41. <1> Constructing a new DataFrameAnalyticsSource
  42. <2> The source index
  43. <3> The query from which to gather the data. If query is not set, a `match_all` query is used by default.
  44. ===== QueryConfig
  45. The query with which to select data from the source.
  46. ["source","java",subs="attributes,callouts,macros"]
  47. --------------------------------------------------
  48. include-tagged::{doc-tests-file}[{api}-query-config]
  49. --------------------------------------------------
  50. ==== DestinationConfig
  51. The index to which data should be written by the {dfanalytics-job}.
  52. ["source","java",subs="attributes,callouts,macros"]
  53. --------------------------------------------------
  54. include-tagged::{doc-tests-file}[{api}-dest-config]
  55. --------------------------------------------------
  56. <1> Constructing a new DataFrameAnalyticsDest
  57. <2> The destination index
  58. ==== Analysis
  59. The analysis to be performed.
  60. Currently, the supported analyses include : +OutlierDetection+, +Regression+.
  61. ===== Outlier detection
  62. +OutlierDetection+ analysis can be created in one of two ways:
  63. ["source","java",subs="attributes,callouts,macros"]
  64. --------------------------------------------------
  65. include-tagged::{doc-tests-file}[{api}-outlier-detection-default]
  66. --------------------------------------------------
  67. <1> Constructing a new OutlierDetection object with default strategy to determine outliers
  68. or
  69. ["source","java",subs="attributes,callouts,macros"]
  70. --------------------------------------------------
  71. include-tagged::{doc-tests-file}[{api}-outlier-detection-customized]
  72. --------------------------------------------------
  73. <1> Constructing a new OutlierDetection object
  74. <2> The method used to perform the analysis
  75. <3> Number of neighbors taken into account during analysis
  76. ===== Regression
  77. +Regression+ analysis requires to set which is the +dependent_variable+ and
  78. has a number of other optional parameters:
  79. ["source","java",subs="attributes,callouts,macros"]
  80. --------------------------------------------------
  81. include-tagged::{doc-tests-file}[{api}-regression]
  82. --------------------------------------------------
  83. <1> Constructing a new Regression builder object with the required dependent variable
  84. <2> The lambda regularization parameter. A non-negative double.
  85. <3> The gamma regularization parameter. A non-negative double.
  86. <4> The applied shrinkage. A double in [0.001, 1].
  87. <5> The maximum number of trees the forest is allowed to contain. An integer in [1, 2000].
  88. <6> The fraction of features which will be used when selecting a random bag for each candidate split. A double in (0, 1].
  89. <7> The name of the prediction field in the results object.
  90. <8> The percentage of training-eligible rows to be used in training. Defaults to 100%.
  91. ==== Analyzed fields
  92. FetchContext object containing fields to be included in / excluded from the analysis
  93. ["source","java",subs="attributes,callouts,macros"]
  94. --------------------------------------------------
  95. include-tagged::{doc-tests-file}[{api}-analyzed-fields]
  96. --------------------------------------------------
  97. include::../execution.asciidoc[]
  98. [id="{upid}-{api}-response"]
  99. ==== Response
  100. The returned +{response}+ contains the newly created {dataframe-analytics-config}.
  101. ["source","java",subs="attributes,callouts,macros"]
  102. --------------------------------------------------
  103. include-tagged::{doc-tests-file}[{api}-response]
  104. --------------------------------------------------