Reindex.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace Elasticsearch\Endpoints;
  3. /**
  4. * Class Reindex
  5. *
  6. * @category Elasticsearch
  7. * @package Elasticsearch\Endpoints\Indices
  8. * @author Augustin Husson <husson.augustin@gmail.com>
  9. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
  10. * @link http://elastic.co
  11. */
  12. class Reindex extends AbstractEndpoint
  13. {
  14. /**
  15. * @return string[]
  16. */
  17. public function getParamWhitelist()
  18. {
  19. return array(
  20. 'slices',
  21. 'refresh',
  22. 'timeout',
  23. 'consistency',
  24. 'wait_for_completion',
  25. 'requests_per_second',
  26. );
  27. }
  28. /**
  29. * @return string
  30. */
  31. public function getURI()
  32. {
  33. return '/_reindex';
  34. }
  35. /**
  36. * @return string
  37. */
  38. public function getMethod()
  39. {
  40. return 'POST';
  41. }
  42. /**
  43. * @param array $body
  44. *
  45. * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException
  46. * @return $this
  47. */
  48. public function setBody($body)
  49. {
  50. if (isset($body) !== true) {
  51. return $this;
  52. }
  53. $this->body = $body;
  54. return $this;
  55. }
  56. }