nodeattrs.asciidoc 3.9 KB

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