Flush.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace Elasticsearch\Endpoints\Indices;
  3. use Elasticsearch\Endpoints\AbstractEndpoint;
  4. /**
  5. * Class Flush
  6. *
  7. * @category Elasticsearch
  8. * @package Elasticsearch\Endpoints\Indices
  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 Flush extends AbstractEndpoint
  14. {
  15. protected $synced = false;
  16. public function setSynced($synced)
  17. {
  18. $this->synced = $synced;
  19. }
  20. /**
  21. * @return string
  22. */
  23. public function getURI()
  24. {
  25. $index = $this->index;
  26. $uri = "/_flush";
  27. if (isset($index) === true) {
  28. $uri = "/$index/_flush";
  29. }
  30. if ($this->synced === true) {
  31. $uri .= "/synced";
  32. }
  33. return $uri;
  34. }
  35. /**
  36. * @return string[]
  37. */
  38. public function getParamWhitelist()
  39. {
  40. return array(
  41. 'force',
  42. 'full',
  43. 'ignore_unavailable',
  44. 'allow_no_indices',
  45. 'expand_wildcards',
  46. 'wait_if_ongoing'
  47. );
  48. }
  49. /**
  50. * @return string
  51. */
  52. public function getMethod()
  53. {
  54. return 'GET';
  55. }
  56. }