Query.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace Elasticsearch\Endpoints\Indices\Validate;
  3. use Elasticsearch\Endpoints\AbstractEndpoint;
  4. use Elasticsearch\Common\Exceptions;
  5. /**
  6. * Class Query
  7. *
  8. * @category Elasticsearch
  9. * @package Elasticsearch\Endpoints\Indices\Validate
  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 Query 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. * @return string
  32. */
  33. public function getURI()
  34. {
  35. return $this->getOptionalURI('_validate/query');
  36. }
  37. /**
  38. * @return string[]
  39. */
  40. public function getParamWhitelist()
  41. {
  42. return array(
  43. 'explain',
  44. 'ignore_indices',
  45. 'operation_threading',
  46. 'source',
  47. 'q',
  48. 'df',
  49. 'default_operator',
  50. 'analyzer',
  51. 'analyze_wildcard',
  52. 'lenient',
  53. 'lowercase_expanded_terms'
  54. );
  55. }
  56. /**
  57. * @return string
  58. */
  59. public function getMethod()
  60. {
  61. return 'GET';
  62. }
  63. }