put-data-frame-analytics.asciidoc 5.0 KB

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