nodes-usage.asciidoc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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::{docdir}/rest-api/common-parms.asciidoc[tag=node-id]
  32. [[cluster-nodes-usage-api-query-params]]
  33. ==== {api-query-parms-title}
  34. include::{docdir}/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. "org.elasticsearch.rest.action.admin.cluster.RestNodesUsageAction": 1,
  59. "org.elasticsearch.rest.action.admin.indices.RestCreateIndexAction": 1,
  60. "org.elasticsearch.rest.action.document.RestGetAction": 1,
  61. "org.elasticsearch.rest.action.search.RestSearchAction": 19, <3>
  62. "org.elasticsearch.rest.action.admin.cluster.RestNodesInfoAction": 36
  63. }
  64. }
  65. }
  66. }
  67. --------------------------------------------------
  68. // TESTRESPONSE[s/"my_cluster"/$body.cluster_name/]
  69. // TESTRESPONSE[s/"pQHNt5rXTTWNvUgOrdynKg"/\$node_name/]
  70. // TESTRESPONSE[s/1492553961812/$body.$_path/]
  71. // TESTRESPONSE[s/1492553906606/$body.$_path/]
  72. // TESTRESPONSE[s/"rest_actions": [^}]+}/"rest_actions": $body.$_path/]
  73. <1> Timestamp for when this nodes usage request was performed.
  74. <2> Timestamp for when the usage information recording was started. This is
  75. equivalent to the time that the node was started.
  76. <3> Search action has been called 19 times for this node.