Close.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace Elasticsearch\Endpoints\Indices;
  3. use Elasticsearch\Endpoints\AbstractEndpoint;
  4. use Elasticsearch\Common\Exceptions;
  5. /**
  6. * Class Close
  7. *
  8. * @category Elasticsearch
  9. * @package Elasticsearch\Endpoints\Indices
  10. * @author Zachary Tong <zach@elastic.co>
  11. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
  12. * @link http://elastic.co
  13. */
  14. class Close extends AbstractEndpoint
  15. {
  16. /**
  17. * @throws \Elasticsearch\Common\Exceptions\RuntimeException
  18. * @return string
  19. */
  20. public function getURI()
  21. {
  22. if (isset($this->index) !== true) {
  23. throw new Exceptions\RuntimeException(
  24. 'index is required for Close'
  25. );
  26. }
  27. $index = $this->index;
  28. $uri = "/$index/_close";
  29. if (isset($index) === true) {
  30. $uri = "/$index/_close";
  31. }
  32. return $uri;
  33. }
  34. /**
  35. * @return string[]
  36. */
  37. public function getParamWhitelist()
  38. {
  39. return array(
  40. 'timeout',
  41. 'master_timeout',
  42. 'ignore_unavailable',
  43. 'allow_no_indices',
  44. 'expand_wildcards',
  45. );
  46. }
  47. /**
  48. * @return string
  49. */
  50. public function getMethod()
  51. {
  52. return 'POST';
  53. }
  54. }