nodeattrs.asciidoc 3.6 KB

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