| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?php
- namespace Elasticsearch\Endpoints;
- use Elasticsearch\Common\Exceptions;
- /**
- * Class UpdateByQuery
- *
- * @category Elasticsearch
- * @package Elasticsearch\Endpoints *
- * @author Zachary Tong <zachary.tong@elasticsearch.com>
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
- * @link http://elasticsearch.org
- */
- class UpdateByQuery extends AbstractEndpoint
- {
- /**
- * @param array $body
- *
- * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException
- * @return $this
- */
- public function setBody($body)
- {
- if (isset($body) !== true) {
- return $this;
- }
- if (is_array($body) !== true) {
- throw new Exceptions\InvalidArgumentException(
- 'Body must be an array'
- );
- }
- $this->body = $body;
- return $this;
- }
- /**
- * @throws \Elasticsearch\Common\Exceptions\BadMethodCallException
- * @return string
- */
- public function getURI()
- {
- if (!$this->index) {
- throw new Exceptions\RuntimeException(
- 'index is required for UpdateByQuery'
- );
- }
- $uri = "/{$this->index}/_update_by_query";
- if ($this->type) {
- $uri = "/{$this->index}/{$this->type}/_update_by_query";
- }
- return $uri;
- }
- /**
- * @return string[]
- */
- public function getParamWhitelist()
- {
- return [
- 'analyzer',
- 'analyze_wildcard',
- 'default_operator',
- 'df',
- 'explain',
- 'fields',
- 'fielddata_fields',
- 'from',
- 'ignore_unavailable',
- 'allow_no_indices',
- 'conflicts',
- 'expand_wildcards',
- 'lenient',
- 'lowercase_expanded_terms',
- 'preference',
- 'q',
- 'routing',
- 'scroll',
- 'search_type',
- 'search_timeout',
- 'size',
- 'sort',
- '_source',
- '_source_exclude',
- '_source_include',
- 'terminate_after',
- 'stats',
- 'suggest_field',
- 'suggest_mode',
- 'suggest_size',
- 'suggest_text',
- 'timeout',
- 'track_scores',
- 'version',
- 'version_type',
- 'request_cache',
- 'refresh',
- 'consistency',
- 'scroll_size',
- 'wait_for_completion',
- ];
- }
- /**
- * @return string
- */
- public function getMethod()
- {
- return 'POST';
- }
- }
|