usage.asciidoc 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. [role="xpack"]
  2. [[usage-api]]
  3. == Usage API
  4. Provides usage information about the installed {xpack} features.
  5. [discrete]
  6. [[usage-api-request]]
  7. === {api-request-title}
  8. `GET /_xpack/usage`
  9. [discrete]
  10. [[usage-api-prereqs]]
  11. === {api-prereq-title}
  12. * If the {es} {security-features} are enabled, you must have the `monitor` or
  13. `manage` <<privileges-list-cluster,cluster privilege>> to use this API.
  14. [discrete]
  15. [[usage-api-desc]]
  16. === {api-description-title}
  17. This API provides information about which features are currently enabled and
  18. available under the current license and some usage statistics.
  19. [discrete]
  20. [[usage-api-query-parms]]
  21. === {api-query-parms-title}
  22. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  23. [discrete]
  24. [[usage-api-example]]
  25. === {api-examples-title}
  26. [source,console]
  27. ------------------------------------------------------------
  28. GET /_xpack/usage
  29. ------------------------------------------------------------
  30. // TEST[s/usage/usage?filter_path=-watcher.execution.actions.logging*/]
  31. // This response filter removes watcher logging results if they are included
  32. // to avoid errors in the CI builds.
  33. [source,console-result]
  34. ------------------------------------------------------------
  35. {
  36. "security" : {
  37. "available" : true,
  38. "enabled" : false
  39. },
  40. "monitoring" : {
  41. "available" : true,
  42. "enabled" : true,
  43. "collection_enabled" : false,
  44. "enabled_exporters" : {
  45. "local" : 1
  46. }
  47. },
  48. "watcher" : {
  49. "available" : true,
  50. "enabled" : true,
  51. "execution" : {
  52. "actions" : {
  53. "_all" : {
  54. "total" : 0,
  55. "total_time_in_ms" : 0
  56. }
  57. }
  58. },
  59. "watch" : {
  60. "input" : {
  61. "_all" : {
  62. "total" : 0,
  63. "active" : 0
  64. }
  65. },
  66. "trigger" : {
  67. "_all" : {
  68. "total" : 0,
  69. "active" : 0
  70. }
  71. }
  72. },
  73. "count" : {
  74. "total" : 0,
  75. "active" : 0
  76. }
  77. },
  78. "graph" : {
  79. "available" : true,
  80. "enabled" : true
  81. },
  82. "ml" : {
  83. "available" : true,
  84. "enabled" : true,
  85. "jobs" : {
  86. "_all" : {
  87. "count" : 0,
  88. "detectors" : {
  89. ...
  90. },
  91. "created_by" : { },
  92. "model_size" : {
  93. ...
  94. },
  95. "forecasts" : {
  96. "total" : 0,
  97. "forecasted_jobs" : 0
  98. }
  99. }
  100. },
  101. "datafeeds" : {
  102. "_all" : {
  103. "count" : 0
  104. }
  105. },
  106. "data_frame_analytics_jobs" : {
  107. "_all" : {
  108. "count" : 0
  109. },
  110. "analysis_counts": { },
  111. "memory_usage": {
  112. "peak_usage_bytes": {
  113. "min": 0.0,
  114. "max": 0.0,
  115. "avg": 0.0,
  116. "total": 0.0
  117. }
  118. }
  119. },
  120. "inference" : {
  121. "ingest_processors" : {
  122. "_all" : {
  123. "num_docs_processed" : {
  124. "max" : 0,
  125. "sum" : 0,
  126. "min" : 0
  127. },
  128. "pipelines" : {
  129. "count" : 0
  130. },
  131. "num_failures" : {
  132. "max" : 0,
  133. "sum" : 0,
  134. "min" : 0
  135. },
  136. "time_ms" : {
  137. "max" : 0,
  138. "sum" : 0,
  139. "min" : 0
  140. }
  141. }
  142. },
  143. "trained_models" : {
  144. "_all" : {
  145. "count": 1
  146. },
  147. "count": {
  148. "total": 1,
  149. "prepackaged": 1,
  150. "other": 0
  151. },
  152. "model_size_bytes": {
  153. "min": 0.0,
  154. "max": 0.0,
  155. "avg": 0.0,
  156. "total": 0.0
  157. },
  158. "estimated_operations": {
  159. "min": 0.0,
  160. "max": 0.0,
  161. "avg": 0.0,
  162. "total": 0.0
  163. }
  164. },
  165. "deployments": {
  166. "count": 0,
  167. "inference_counts": {
  168. "total": 0.0,
  169. "min": 0.0,
  170. "avg": 0.0,
  171. "max": 0.0
  172. },
  173. "model_sizes_bytes": {
  174. "total": 0.0,
  175. "min": 0.0,
  176. "avg": 0.0,
  177. "max": 0.0
  178. },
  179. "time_ms": {
  180. "avg": 0.0
  181. }
  182. }
  183. },
  184. "node_count" : 1
  185. },
  186. "logstash" : {
  187. "available" : true,
  188. "enabled" : true
  189. },
  190. "eql" : {
  191. "available" : true,
  192. "enabled" : true
  193. },
  194. "sql" : {
  195. "available" : true,
  196. "enabled" : true,
  197. "features" : {
  198. "having" : 0,
  199. "subselect" : 0,
  200. "limit" : 0,
  201. "orderby" : 0,
  202. "where" : 0,
  203. "join" : 0,
  204. "groupby" : 0,
  205. "command" : 0,
  206. "local" : 0
  207. },
  208. "queries" : {
  209. "rest" : {
  210. "total" : 0,
  211. "paging" : 0,
  212. "failed" : 0
  213. },
  214. "cli" : {
  215. "total" : 0,
  216. "paging" : 0,
  217. "failed" : 0
  218. },
  219. "canvas" : {
  220. "total" : 0,
  221. "paging" : 0,
  222. "failed" : 0
  223. },
  224. "odbc" : {
  225. "total" : 0,
  226. "paging" : 0,
  227. "failed" : 0
  228. },
  229. "jdbc" : {
  230. "total" : 0,
  231. "paging" : 0,
  232. "failed" : 0
  233. },
  234. "odbc32" : {
  235. "total" : 0,
  236. "paging" : 0,
  237. "failed" : 0
  238. },
  239. "odbc64" : {
  240. "total" : 0,
  241. "paging" : 0,
  242. "failed" : 0
  243. },
  244. "_all" : {
  245. "total" : 0,
  246. "paging" : 0,
  247. "failed" : 0
  248. },
  249. "translate" : {
  250. "count" : 0
  251. }
  252. }
  253. },
  254. "rollup" : {
  255. "available" : true,
  256. "enabled" : true
  257. },
  258. "ilm" : {
  259. "policy_count" : 3,
  260. "policy_stats" : [
  261. ...
  262. ]
  263. },
  264. "slm" : {
  265. "available" : true,
  266. "enabled" : true
  267. },
  268. "ccr" : {
  269. "available" : true,
  270. "enabled" : true,
  271. "follower_indices_count" : 0,
  272. "auto_follow_patterns_count" : 0
  273. },
  274. "transform" : {
  275. "available" : true,
  276. "enabled" : true
  277. },
  278. "voting_only" : {
  279. "available" : true,
  280. "enabled" : true
  281. },
  282. "searchable_snapshots" : {
  283. "available" : true,
  284. "enabled" : true,
  285. "indices_count" : 0,
  286. "full_copy_indices_count" : 0,
  287. "shared_cache_indices_count" : 0
  288. },
  289. "frozen_indices" : {
  290. "available" : true,
  291. "enabled" : true,
  292. "indices_count" : 0
  293. },
  294. "spatial" : {
  295. "available" : true,
  296. "enabled" : true
  297. },
  298. "analytics" : {
  299. "available" : true,
  300. "enabled" : true,
  301. "stats": {
  302. "boxplot_usage" : 0,
  303. "top_metrics_usage" : 0,
  304. "normalize_usage" : 0,
  305. "cumulative_cardinality_usage" : 0,
  306. "t_test_usage" : 0,
  307. "rate_usage" : 0,
  308. "string_stats_usage" : 0,
  309. "moving_percentiles_usage" : 0,
  310. "multi_terms_usage" : 0
  311. }
  312. },
  313. "data_streams" : {
  314. "available" : true,
  315. "enabled" : true,
  316. "data_streams" : 0,
  317. "indices_count" : 0
  318. },
  319. "data_tiers" : {
  320. "available" : true,
  321. "enabled" : true,
  322. "data_warm" : {
  323. "node_count" : 0,
  324. "index_count" : 0,
  325. "total_shard_count" : 0,
  326. "primary_shard_count" : 0,
  327. "doc_count" : 0,
  328. "total_size_bytes" : 0,
  329. "primary_size_bytes" : 0,
  330. "primary_shard_size_avg_bytes" : 0,
  331. "primary_shard_size_median_bytes" : 0,
  332. "primary_shard_size_mad_bytes" : 0
  333. },
  334. "data_frozen" : {
  335. "node_count" : 1,
  336. "index_count" : 0,
  337. "total_shard_count" : 0,
  338. "primary_shard_count" : 0,
  339. "doc_count" : 0,
  340. "total_size_bytes" : 0,
  341. "primary_size_bytes" : 0,
  342. "primary_shard_size_avg_bytes" : 0,
  343. "primary_shard_size_median_bytes" : 0,
  344. "primary_shard_size_mad_bytes" : 0
  345. },
  346. "data_cold" : {
  347. "node_count" : 0,
  348. "index_count" : 0,
  349. "total_shard_count" : 0,
  350. "primary_shard_count" : 0,
  351. "doc_count" : 0,
  352. "total_size_bytes" : 0,
  353. "primary_size_bytes" : 0,
  354. "primary_shard_size_avg_bytes" : 0,
  355. "primary_shard_size_median_bytes" : 0,
  356. "primary_shard_size_mad_bytes" : 0
  357. },
  358. "data_content" : {
  359. "node_count" : 0,
  360. "index_count" : 0,
  361. "total_shard_count" : 0,
  362. "primary_shard_count" : 0,
  363. "doc_count" : 0,
  364. "total_size_bytes" : 0,
  365. "primary_size_bytes" : 0,
  366. "primary_shard_size_avg_bytes" : 0,
  367. "primary_shard_size_median_bytes" : 0,
  368. "primary_shard_size_mad_bytes" : 0
  369. },
  370. "data_hot" : {
  371. "node_count" : 0,
  372. "index_count" : 0,
  373. "total_shard_count" : 0,
  374. "primary_shard_count" : 0,
  375. "doc_count" : 0,
  376. "total_size_bytes" : 0,
  377. "primary_size_bytes" : 0,
  378. "primary_shard_size_avg_bytes" : 0,
  379. "primary_shard_size_median_bytes" : 0,
  380. "primary_shard_size_mad_bytes" : 0
  381. }
  382. },
  383. "aggregate_metric" : {
  384. "available" : true,
  385. "enabled" : true
  386. },
  387. "archive" : {
  388. "available" : true,
  389. "enabled" : true,
  390. "indices_count" : 0
  391. },
  392. "health_api" : {
  393. "available" : true,
  394. "enabled" : true,
  395. "invocations": {
  396. "total": 0
  397. }
  398. }
  399. }
  400. ------------------------------------------------------------
  401. // TESTRESPONSE[s/"detectors" : \{[^\}]*\},/"detectors" : $body.$_path,/]
  402. // TESTRESPONSE[s/"model_size" : \{[^\}]*\},/"model_size" : $body.$_path,/]
  403. // TESTRESPONSE[s/"eql" : \{[^\}]*\},/"eql" : $body.$_path,/]
  404. // TESTRESPONSE[s/"policy_stats" : \[[^\]]*\]/"policy_stats" : $body.$_path/]
  405. // TESTRESPONSE[s/"slm" : \{[^\}]*\},/"slm" : $body.$_path,/]
  406. // TESTRESPONSE[s/"health_api" : \{[^\}]*\}\s*\}/"health_api" : $body.$_path/]
  407. // TESTRESPONSE[s/ : true/ : $body.$_path/]
  408. // TESTRESPONSE[s/ : false/ : $body.$_path/]
  409. // TESTRESPONSE[s/ : (\-)?[0-9]+/ : $body.$_path/]
  410. // These replacements do a few things:
  411. // 1. Ignore the contents of the `policy_stats` object because we don't know all
  412. // of the policies that will be in it. And because we figure folks don't need
  413. // to see an exhaustive list anyway.
  414. // 2. Handling eql, which is disabled by default on release builds and enabled
  415. // everywhere else during the initial implementation phase until its release
  416. // 3. Ignore the contents of the `slm` object because it might contain policies
  417. // 4. Ignore the contents of the `health_api` object because we do not know if the api has been called or not
  418. // 5. All of the numbers and strings on the right hand side of *every* field in
  419. // the response are ignored. So we're really only asserting things about the
  420. // the shape of this response, not the values in it.