nodes-usage.asciidoc 2.8 KB

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