nodeattrs.asciidoc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. [[cat-nodeattrs]]
  2. === cat nodeattrs API
  3. ++++
  4. <titleabbrev>cat nodeattrs</titleabbrev>
  5. ++++
  6. .New API reference
  7. [sidebar]
  8. --
  9. For the most up-to-date API details, refer to {api-es}/group/endpoint-cat[Compact and aligned text (CAT) APIs]..
  10. --
  11. [IMPORTANT]
  12. ====
  13. cat APIs are only intended for human consumption using the command line or {kib}
  14. console. They are _not_ intended for use by applications. For application
  15. consumption, use the <<cluster-nodes-info,nodes info API>>.
  16. ====
  17. Returns information about custom node attributes.
  18. [[cat-nodeattrs-api-request]]
  19. ==== {api-request-title}
  20. `GET /_cat/nodeattrs`
  21. [[cat-nodeattrs-api-prereqs]]
  22. ==== {api-prereq-title}
  23. * If the {es} {security-features} are enabled, you must have the `monitor` or
  24. `manage` <<privileges-list-cluster,cluster privilege>> to use this API.
  25. [[cat-nodeattrs-api-query-params]]
  26. ==== {api-query-parms-title}
  27. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=http-format]
  28. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
  29. +
  30. --
  31. If you do not specify which columns to include, the API returns the default columns in the order listed below. If you explicitly specify one or more columns, it only returns the specified columns.
  32. Valid columns are:
  33. `node`,`name`::
  34. (Default) Name of the node, such as `DKDM97B`.
  35. `host`, `h`::
  36. (Default) Host name, such as `n1`.
  37. `ip`, `i`::
  38. (Default) IP address, such as `127.0.1.1`.
  39. `attr`, `attr.name`::
  40. (Default) Attribute name, such as `rack`.
  41. `value`, `attr.value`::
  42. (Default) Attribute value, such as `rack123`.
  43. `id`, `nodeId`::
  44. ID of the node, such as `k0zy`.
  45. `pid`, `p`::
  46. Process ID, such as `13061`.
  47. `port`, `po`::
  48. Bound transport port, such as `9300`.
  49. --
  50. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=help]
  51. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=local]
  52. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  53. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
  54. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
  55. [[cat-nodeattrs-api-example]]
  56. ==== {api-examples-title}
  57. [[cat-nodeattrs-api-ex-default]]
  58. ===== Example with default columns
  59. [source,console]
  60. --------------------------------------------------
  61. GET /_cat/nodeattrs?v=true
  62. --------------------------------------------------
  63. // TEST[s/\?v=true/\?v=true&s=node,attr/]
  64. // Sort the resulting attributes so we can assert on them more easily
  65. The API returns the following response:
  66. [source,txt]
  67. --------------------------------------------------
  68. node host ip attr value
  69. ...
  70. node-0 127.0.0.1 127.0.0.1 testattr test
  71. ...
  72. --------------------------------------------------
  73. // TESTRESPONSE[s/\.\.\.\n$/\n(.+ xpack\\.installed true\n)?\n/]
  74. // TESTRESPONSE[s/\.\.\.\n/(.+ ml\\..+\n)*/ non_json]
  75. // If xpack is not installed then neither ... with match anything
  76. // If xpack is installed then the first ... contains ml attributes
  77. // and the second contains xpack.installed=true
  78. The `node`, `host`, and `ip` columns provide basic information about each node.
  79. The `attr` and `value` columns return custom node attributes, one per line.
  80. [[cat-nodeattrs-api-ex-headings]]
  81. ===== Example with explicit columns
  82. The following API request returns the `name`, `pid`, `attr`, and `value`
  83. columns.
  84. [source,console]
  85. --------------------------------------------------
  86. GET /_cat/nodeattrs?v=true&h=name,pid,attr,value
  87. --------------------------------------------------
  88. // TEST[s/,value/,value&s=node,attr/]
  89. // Sort the resulting attributes so we can assert on them more easily
  90. The API returns the following response:
  91. [source,txt]
  92. --------------------------------------------------
  93. name pid attr value
  94. ...
  95. node-0 19566 testattr test
  96. ...
  97. --------------------------------------------------
  98. // TESTRESPONSE[s/19566/\\d*/]
  99. // TESTRESPONSE[s/\.\.\.\n$/\n(.+ xpack\\.installed true\n)?\n/]
  100. // TESTRESPONSE[s/\.\.\.\n/(.+ ml\\..+\n)*/ non_json]
  101. // If xpack is not installed then neither ... with match anything
  102. // If xpack is installed then the first ... contains ml attributes
  103. // and the second contains xpack.installed=true