Scroll.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. namespace Elasticsearch\Endpoints;
  3. use Elasticsearch\Common\Exceptions;
  4. /**
  5. * Class Scroll
  6. *
  7. * @category Elasticsearch
  8. * @package Elasticsearch\Endpoints
  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 Scroll extends AbstractEndpoint
  14. {
  15. /**
  16. * @param array $body
  17. *
  18. * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException
  19. * @return $this
  20. */
  21. public function setBody($body)
  22. {
  23. if (isset($body) !== true) {
  24. return $this;
  25. }
  26. $this->body = $body;
  27. return $this;
  28. }
  29. /**
  30. * @return array
  31. */
  32. public function getBody()
  33. {
  34. return $this->body;
  35. }
  36. /**
  37. * @param $scroll
  38. *
  39. * @return $this
  40. */
  41. public function setScroll($scroll)
  42. {
  43. if (isset($scroll) !== true) {
  44. return $this;
  45. }
  46. $this->body['scroll'] = $scroll;
  47. return $this;
  48. }
  49. /**
  50. * @param $scroll_id
  51. *
  52. * @return $this
  53. */
  54. public function setScrollId($scroll_id)
  55. {
  56. if (isset($scroll_id) !== true) {
  57. return $this;
  58. }
  59. $this->body['scroll_id'] = $scroll_id;
  60. return $this;
  61. }
  62. /**
  63. * @return string
  64. */
  65. public function getURI()
  66. {
  67. $uri = "/_search/scroll";
  68. return $uri;
  69. }
  70. /**
  71. * @return string[]
  72. */
  73. public function getParamWhitelist()
  74. {
  75. return array(
  76. 'scroll',
  77. );
  78. }
  79. /**
  80. * @return string
  81. */
  82. public function getMethod()
  83. {
  84. return 'GET';
  85. }
  86. }