Open.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace Elasticsearch\Endpoints\Indices;
  3. use Elasticsearch\Endpoints\AbstractEndpoint;
  4. use Elasticsearch\Common\Exceptions;
  5. /**
  6. * Class Open
  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 Open 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 Open'
  25. );
  26. }
  27. $index = $this->index;
  28. $uri = "/$index/_open";
  29. if (isset($index) === true) {
  30. $uri = "/$index/_open";
  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. 'wait_for_active_shards',
  46. );
  47. }
  48. /**
  49. * @return string
  50. */
  51. public function getMethod()
  52. {
  53. return 'POST';
  54. }
  55. }