Exists.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace Elasticsearch\Endpoints\Indices;
  3. use Elasticsearch\Endpoints\AbstractEndpoint;
  4. use Elasticsearch\Common\Exceptions;
  5. /**
  6. * Class Exists
  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 Exists 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 Exists'
  25. );
  26. }
  27. $index = $this->index;
  28. $uri = "/$index";
  29. if (isset($index) === true) {
  30. $uri = "/$index";
  31. }
  32. return $uri;
  33. }
  34. /**
  35. * @return string[]
  36. */
  37. public function getParamWhitelist()
  38. {
  39. return array(
  40. 'ignore_unavailable',
  41. 'allow_no_indices',
  42. 'expand_wildcards',
  43. 'local',
  44. );
  45. }
  46. /**
  47. * @return string
  48. */
  49. public function getMethod()
  50. {
  51. return 'HEAD';
  52. }
  53. }