Execute algorithm

Some algorithms, such as Localization, don’t require trained models. You can run no-model-based algorithms using the execute API.

Path and HTTP methods

  1. POST _plugins/_ml/_execute/<algorithm_name>

Example request: Execute localization

The following example uses the Localization algorithm to find subset-level information for aggregate data (for example, aggregated over time) that demonstrates the activity of interest, such as spikes, drops, changes, or anomalies.

  1. POST /_plugins/_ml/_execute/anomaly_localization
  2. {
  3. "index_name": "rca-index",
  4. "attribute_field_names": [
  5. "attribute"
  6. ],
  7. "aggregations": [
  8. {
  9. "sum": {
  10. "sum": {
  11. "field": "value"
  12. }
  13. }
  14. }
  15. ],
  16. "time_field_name": "timestamp",
  17. "start_time": 1620630000000,
  18. "end_time": 1621234800000,
  19. "min_time_interval": 86400000,
  20. "num_outputs": 10
  21. }

copy

Example response

  1. {
  2. "results" : [
  3. {
  4. "name" : "sum",
  5. "result" : {
  6. "buckets" : [
  7. {
  8. "start_time" : 1620630000000,
  9. "end_time" : 1620716400000,
  10. "overall_aggregate_value" : 65.0
  11. },
  12. {
  13. "start_time" : 1620716400000,
  14. "end_time" : 1620802800000,
  15. "overall_aggregate_value" : 75.0,
  16. "entities" : [
  17. {
  18. "key" : [
  19. "attr0"
  20. ],
  21. "contribution_value" : 1.0,
  22. "base_value" : 2.0,
  23. "new_value" : 3.0
  24. },
  25. {
  26. "key" : [
  27. "attr1"
  28. ],
  29. "contribution_value" : 1.0,
  30. "base_value" : 3.0,
  31. "new_value" : 4.0
  32. },
  33. {
  34. "key" : [
  35. "attr2"
  36. ],
  37. "contribution_value" : 1.0,
  38. "base_value" : 4.0,
  39. "new_value" : 5.0
  40. },
  41. {
  42. "key" : [
  43. "attr3"
  44. ],
  45. "contribution_value" : 1.0,
  46. "base_value" : 5.0,
  47. "new_value" : 6.0
  48. },
  49. {
  50. "key" : [
  51. "attr4"
  52. ],
  53. "contribution_value" : 1.0,
  54. "base_value" : 6.0,
  55. "new_value" : 7.0
  56. },
  57. {
  58. "key" : [
  59. "attr5"
  60. ],
  61. "contribution_value" : 1.0,
  62. "base_value" : 7.0,
  63. "new_value" : 8.0
  64. },
  65. {
  66. "key" : [
  67. "attr6"
  68. ],
  69. "contribution_value" : 1.0,
  70. "base_value" : 8.0,
  71. "new_value" : 9.0
  72. },
  73. {
  74. "key" : [
  75. "attr7"
  76. ],
  77. "contribution_value" : 1.0,
  78. "base_value" : 9.0,
  79. "new_value" : 10.0
  80. },
  81. {
  82. "key" : [
  83. "attr8"
  84. ],
  85. "contribution_value" : 1.0,
  86. "base_value" : 10.0,
  87. "new_value" : 11.0
  88. },
  89. {
  90. "key" : [
  91. "attr9"
  92. ],
  93. "contribution_value" : 1.0,
  94. "base_value" : 11.0,
  95. "new_value" : 12.0
  96. }
  97. ]
  98. },
  99. ...
  100. ]
  101. }
  102. }
  103. ]
  104. }