nodes-usage.asciidoc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. [[cluster-nodes-usage]]
  2. === Nodes feature usage API
  3. ++++
  4. <titleabbrev>Nodes feature usage</titleabbrev>
  5. ++++
  6. Returns information on the usage of features.
  7. [[cluster-nodes-usage-api-request]]
  8. ==== {api-request-title}
  9. `GET /_nodes/usage` +
  10. `GET /_nodes/<node_id>/usage` +
  11. `GET /_nodes/usage/<metric>` +
  12. `GET /_nodes/<node_id>/usage/<metric>`
  13. [[cluster-nodes-usage-api-desc]]
  14. ==== {api-description-title}
  15. The cluster nodes usage API allows you to retrieve information on the usage
  16. of features for each node. All the nodes selective options are explained
  17. <<cluster-nodes,here>>.
  18. [[cluster-nodes-usage-api-path-params]]
  19. ==== {api-path-parms-title}
  20. `<metric>`::
  21. (Optional, string) Limits the information returned to the specific metrics.
  22. A comma-separated list of the following options:
  23. +
  24. --
  25. `_all`::
  26. Returns all stats.
  27. `rest_actions`::
  28. Returns the REST actions classname with a count of the number of times
  29. that action has been called on the node.
  30. --
  31. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=node-id]
  32. [[cluster-nodes-usage-api-query-params]]
  33. ==== {api-query-parms-title}
  34. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  35. [[cluster-nodes-usage-api-example]]
  36. ==== {api-examples-title}
  37. Rest action example:
  38. [source,console]
  39. --------------------------------------------------
  40. GET _nodes/usage
  41. --------------------------------------------------
  42. // TEST[setup:node]
  43. The API returns the following response:
  44. [source,console-result]
  45. --------------------------------------------------
  46. {
  47. "_nodes": {
  48. "total": 1,
  49. "successful": 1,
  50. "failed": 0
  51. },
  52. "cluster_name": "my_cluster",
  53. "nodes": {
  54. "pQHNt5rXTTWNvUgOrdynKg": {
  55. "timestamp": 1492553961812, <1>
  56. "since": 1492553906606, <2>
  57. "rest_actions": {
  58. "nodes_usage_action": 1,
  59. "create_index_action": 1,
  60. "document_get_action": 1,
  61. "search_action": 19, <3>
  62. "nodes_info_action": 36
  63. },
  64. "aggregations": {
  65. ...
  66. }
  67. }
  68. }
  69. }
  70. --------------------------------------------------
  71. // TESTRESPONSE[s/"my_cluster"/$body.cluster_name/]
  72. // TESTRESPONSE[s/"pQHNt5rXTTWNvUgOrdynKg"/\$node_name/]
  73. // TESTRESPONSE[s/1492553961812/$body.$_path/]
  74. // TESTRESPONSE[s/1492553906606/$body.$_path/]
  75. // TESTRESPONSE[s/"rest_actions": [^}]+}/"rest_actions": $body.$_path/]
  76. // TESTRESPONSE[s/"aggregations": [^}]+}/"aggregations": $body.$_path/]
  77. <1> Timestamp for when this nodes usage request was performed.
  78. <2> Timestamp for when the usage information recording was started. This is
  79. equivalent to the time that the node was started.
  80. <3> Search action has been called 19 times for this node.