Stats.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace Elasticsearch\Endpoints\Cluster;
  3. use Elasticsearch\Endpoints\AbstractEndpoint;
  4. /**
  5. * Class Stats
  6. *
  7. * @category Elasticsearch
  8. * @package Elasticsearch\Endpoints\Cluster
  9. * @author Zachary Tong <zach@elastic.co>
  10. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
  11. * @link http://elastic.co
  12. */
  13. class Stats extends AbstractEndpoint
  14. {
  15. // A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you&#039;re connecting to, leave empty to get information from all nodes
  16. private $nodeID;
  17. /**
  18. * @param $node_id
  19. *
  20. * @return $this
  21. */
  22. public function setNodeID($node_id)
  23. {
  24. if (isset($node_id) !== true) {
  25. return $this;
  26. }
  27. $this->nodeID = $node_id;
  28. return $this;
  29. }
  30. /**
  31. * @return string
  32. */
  33. public function getURI()
  34. {
  35. $node_id = $this->nodeID;
  36. $uri = "/_cluster/stats";
  37. if (isset($node_id) === true) {
  38. $uri = "/_cluster/stats/nodes/$node_id";
  39. }
  40. return $uri;
  41. }
  42. /**
  43. * @return string[]
  44. */
  45. public function getParamWhitelist()
  46. {
  47. return array(
  48. 'flat_settings',
  49. 'human',
  50. );
  51. }
  52. /**
  53. * @return string
  54. */
  55. public function getMethod()
  56. {
  57. return 'GET';
  58. }
  59. }