nodeattrs.asciidoc 3.4 KB

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