Simulate.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace Elasticsearch\Endpoints\Ingest;
  3. use Elasticsearch\Common\Exceptions;
  4. use Elasticsearch\Endpoints\AbstractEndpoint;
  5. /**
  6. * Class Simulate
  7. *
  8. * @category Elasticsearch
  9. * @package Elasticsearch\Endpoints\Ingest
  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 Simulate extends AbstractEndpoint
  15. {
  16. /**
  17. * @param array $body
  18. *
  19. * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException
  20. * @return $this
  21. */
  22. public function setBody($body)
  23. {
  24. if (isset($body) !== true) {
  25. return $this;
  26. }
  27. $this->body = $body;
  28. return $this;
  29. }
  30. /**
  31. * @throws \Elasticsearch\Common\Exceptions\RuntimeException
  32. * @return string
  33. */
  34. public function getURI()
  35. {
  36. if (isset($this->id) === true) {
  37. return "/_ingest/pipeline/{$this->id}/_simulate";
  38. }
  39. return "/_ingest/pipeline/_simulate";
  40. }
  41. /**
  42. * @return string[]
  43. */
  44. public function getParamWhitelist()
  45. {
  46. return array(
  47. 'verbose',
  48. );
  49. }
  50. /**
  51. * @return string
  52. */
  53. public function getMethod()
  54. {
  55. return 'GET';
  56. }
  57. }