put-job.asciidoc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-put-job]]
  4. === Create Jobs API
  5. ++++
  6. <titleabbrev>Create Jobs</titleabbrev>
  7. ++++
  8. Instantiates a job.
  9. ==== Request
  10. `PUT _xpack/ml/anomaly_detectors/<job_id>`
  11. //===== Description
  12. ==== Path Parameters
  13. `job_id` (required)::
  14. (string) Identifier for the job. This identifier can contain lowercase
  15. alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must
  16. start and end with alphanumeric characters.
  17. ==== Request Body
  18. `analysis_config`::
  19. (object) The analysis configuration, which specifies how to analyze the data.
  20. See <<ml-analysisconfig, analysis configuration objects>>.
  21. `analysis_limits`::
  22. (object) Specifies runtime limits for the job. See
  23. <<ml-apilimits,analysis limits>>.
  24. `background_persist_interval`::
  25. (time units) Advanced configuration option. The time between each periodic
  26. persistence of the model. See <<ml-job-resource>>.
  27. `custom_settings`::
  28. (object) Advanced configuration option. Contains custom meta data about the
  29. job. See <<ml-job-resource>>.
  30. `data_description` (required)::
  31. (object) Describes the format of the input data. This object is required, but
  32. it can be empty (`{}`). See <<ml-datadescription,data description objects>>.
  33. `description`::
  34. (string) A description of the job.
  35. `groups`::
  36. (array of strings) A list of job groups. See <<ml-job-resource>>.
  37. `model_plot_config`::
  38. (object) Advanced configuration option. Specifies to store model information
  39. along with the results. This adds overhead to the performance of the system
  40. and is not feasible for jobs with many entities, see <<ml-apimodelplotconfig>>.
  41. `model_snapshot_retention_days`::
  42. (long) The time in days that model snapshots are retained for the job.
  43. Older snapshots are deleted. The default value is `1`, which means snapshots
  44. are retained for one day (twenty-four hours).
  45. `renormalization_window_days`::
  46. (long) Advanced configuration option. The period over which adjustments to the
  47. score are applied, as new data is seen. See <<ml-job-resource>>.
  48. `results_index_name`::
  49. (string) A text string that affects the name of the {ml} results index. The
  50. default value is `shared`, which generates an index named `.ml-anomalies-shared`.
  51. `results_retention_days`::
  52. (long) Advanced configuration option. The number of days for which job results
  53. are retained. See <<ml-job-resource>>.
  54. ==== Authorization
  55. You must have `manage_ml`, or `manage` cluster privileges to use this API.
  56. For more information, see
  57. {xpack-ref}/security-privileges.html[Security Privileges].
  58. ==== Examples
  59. The following example creates the `total-requests` job:
  60. [source,js]
  61. --------------------------------------------------
  62. PUT _xpack/ml/anomaly_detectors/total-requests
  63. {
  64. "description" : "Total sum of requests",
  65. "analysis_config" : {
  66. "bucket_span":"10m",
  67. "detectors": [
  68. {
  69. "detector_description": "Sum of total",
  70. "function": "sum",
  71. "field_name": "total"
  72. }
  73. ]
  74. },
  75. "data_description" : {
  76. "time_field":"timestamp",
  77. "time_format": "epoch_ms"
  78. }
  79. }
  80. --------------------------------------------------
  81. // CONSOLE
  82. // TEST[skip:need-licence]
  83. When the job is created, you receive the following results:
  84. [source,js]
  85. ----
  86. {
  87. "job_id": "total-requests",
  88. "job_type": "anomaly_detector",
  89. "job_version": "7.0.0-alpha1",
  90. "description": "Total sum of requests",
  91. "create_time": 1517011406091,
  92. "analysis_config": {
  93. "bucket_span": "10m",
  94. "detectors": [
  95. {
  96. "detector_description": "Sum of total",
  97. "function": "sum",
  98. "field_name": "total",
  99. "detector_index": 0
  100. }
  101. ],
  102. "influencers": []
  103. },
  104. "analysis_limits": {
  105. "model_memory_limit": "1024mb",
  106. "categorization_examples_limit": 4
  107. },
  108. "data_description": {
  109. "time_field": "timestamp",
  110. "time_format": "epoch_ms"
  111. },
  112. "model_snapshot_retention_days": 1,
  113. "results_index_name": "shared"
  114. }
  115. ----
  116. // TESTRESPONSE[s/"job_version": "7.0.0-alpha1"/"job_version": $body.job_version/]
  117. // TESTRESPONSE[s/"create_time": 1517011406091/"create_time": $body.create_time/]