@@ -16,42 +16,42 @@ |
||
16 | 16 | |
17 | 17 | class Utility |
18 | 18 | { |
19 | - const ENV_URL_PLUS_AS_SPACE = 'ELASTIC_CLIENT_URL_PLUS_AS_SPACE'; |
|
20 | - /** |
|
21 | - * Get the ENV variable with a thread safe fallback criteria |
|
22 | - * @see https://github.com/elastic/elasticsearch-php/issues/1237 |
|
23 | - * |
|
24 | - * @return string | false |
|
25 | - */ |
|
26 | - public static function getEnv(string $env) |
|
27 | - { |
|
28 | - return $_SERVER[$env] ?? $_ENV[$env] ?? \getenv($env); |
|
29 | - } |
|
30 | - /** |
|
31 | - * Encode a string in URL using urlencode() or rawurlencode() |
|
32 | - * according to ENV_URL_PLUS_AS_SPACE. |
|
33 | - * If ENV_URL_PLUS_AS_SPACE is not defined or true use urlencode(), |
|
34 | - * otherwise use rawurlencode() |
|
35 | - * |
|
36 | - * @see https://github.com/elastic/elasticsearch-php/issues/1278 |
|
37 | - * @deprecated will be replaced by PHP function rawurlencode() |
|
38 | - */ |
|
39 | - public static function urlencode(string $url) : string |
|
40 | - { |
|
41 | - $plusAsSpace = self::getEnv(self::ENV_URL_PLUS_AS_SPACE); |
|
42 | - return $plusAsSpace === \false || $plusAsSpace === 'true' ? \urlencode($url) : \rawurlencode($url); |
|
43 | - } |
|
44 | - /** |
|
45 | - * Remove all the characters not valid for a PHP variable name |
|
46 | - * The valid characters are: a-z, A-Z, 0-9 and _ (underscore) |
|
47 | - * The variable name CANNOT start with a number |
|
48 | - */ |
|
49 | - public static function formatVariableName(string $var) : string |
|
50 | - { |
|
51 | - // If the first character is a digit, we append the underscore |
|
52 | - if (\is_int($var[0])) { |
|
53 | - $var = '_' . $var; |
|
54 | - } |
|
55 | - return \preg_replace('/[^a-zA-Z0-9_]/', '', $var); |
|
56 | - } |
|
19 | + const ENV_URL_PLUS_AS_SPACE = 'ELASTIC_CLIENT_URL_PLUS_AS_SPACE'; |
|
20 | + /** |
|
21 | + * Get the ENV variable with a thread safe fallback criteria |
|
22 | + * @see https://github.com/elastic/elasticsearch-php/issues/1237 |
|
23 | + * |
|
24 | + * @return string | false |
|
25 | + */ |
|
26 | + public static function getEnv(string $env) |
|
27 | + { |
|
28 | + return $_SERVER[$env] ?? $_ENV[$env] ?? \getenv($env); |
|
29 | + } |
|
30 | + /** |
|
31 | + * Encode a string in URL using urlencode() or rawurlencode() |
|
32 | + * according to ENV_URL_PLUS_AS_SPACE. |
|
33 | + * If ENV_URL_PLUS_AS_SPACE is not defined or true use urlencode(), |
|
34 | + * otherwise use rawurlencode() |
|
35 | + * |
|
36 | + * @see https://github.com/elastic/elasticsearch-php/issues/1278 |
|
37 | + * @deprecated will be replaced by PHP function rawurlencode() |
|
38 | + */ |
|
39 | + public static function urlencode(string $url) : string |
|
40 | + { |
|
41 | + $plusAsSpace = self::getEnv(self::ENV_URL_PLUS_AS_SPACE); |
|
42 | + return $plusAsSpace === \false || $plusAsSpace === 'true' ? \urlencode($url) : \rawurlencode($url); |
|
43 | + } |
|
44 | + /** |
|
45 | + * Remove all the characters not valid for a PHP variable name |
|
46 | + * The valid characters are: a-z, A-Z, 0-9 and _ (underscore) |
|
47 | + * The variable name CANNOT start with a number |
|
48 | + */ |
|
49 | + public static function formatVariableName(string $var) : string |
|
50 | + { |
|
51 | + // If the first character is a digit, we append the underscore |
|
52 | + if (\is_int($var[0])) { |
|
53 | + $var = '_' . $var; |
|
54 | + } |
|
55 | + return \preg_replace('/[^a-zA-Z0-9_]/', '', $var); |
|
56 | + } |
|
57 | 57 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch; |
16 | 16 | |
17 | 17 | class Utility |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | // If the first character is a digit, we append the underscore |
52 | 52 | if (\is_int($var[0])) { |
53 | - $var = '_' . $var; |
|
53 | + $var = '_'.$var; |
|
54 | 54 | } |
55 | 55 | return \preg_replace('/[^a-zA-Z0-9_]/', '', $var); |
56 | 56 | } |
@@ -14,8 +14,7 @@ |
||
14 | 14 | declare (strict_types=1); |
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch; |
16 | 16 | |
17 | -class Utility |
|
18 | -{ |
|
17 | +class Utility { |
|
19 | 18 | const ENV_URL_PLUS_AS_SPACE = 'ELASTIC_CLIENT_URL_PLUS_AS_SPACE'; |
20 | 19 | /** |
21 | 20 | * Get the ENV variable with a thread safe fallback criteria |
@@ -20,130 +20,130 @@ |
||
20 | 20 | use Iterator; |
21 | 21 | class SearchHitIterator implements Iterator, Countable |
22 | 22 | { |
23 | - /** |
|
24 | - * @var SearchResponseIterator |
|
25 | - */ |
|
26 | - private SearchResponseIterator $searchResponses; |
|
27 | - /** |
|
28 | - * @var int |
|
29 | - */ |
|
30 | - protected int $currentKey; |
|
31 | - /** |
|
32 | - * @var int |
|
33 | - */ |
|
34 | - protected int $currentHitIndex; |
|
35 | - /** |
|
36 | - * @var array|null |
|
37 | - */ |
|
38 | - protected ?array $currentHitData; |
|
39 | - /** |
|
40 | - * @var int |
|
41 | - */ |
|
42 | - protected int $count = 0; |
|
43 | - /** |
|
44 | - * Constructor |
|
45 | - * |
|
46 | - * @param SearchResponseIterator $searchResponses |
|
47 | - */ |
|
48 | - public function __construct(SearchResponseIterator $searchResponses) |
|
49 | - { |
|
50 | - $this->searchResponses = $searchResponses; |
|
51 | - } |
|
52 | - /** |
|
53 | - * Rewinds the internal SearchResponseIterator and itself |
|
54 | - * |
|
55 | - * @return void |
|
56 | - * @throws ClientResponseException |
|
57 | - * @throws ServerResponseException |
|
58 | - * @see Iterator::rewind() |
|
59 | - */ |
|
60 | - public function rewind() : void |
|
61 | - { |
|
62 | - $this->currentKey = 0; |
|
63 | - $this->searchResponses->rewind(); |
|
64 | - // The first page may be empty. In that case, the next page is fetched. |
|
65 | - $currentPage = $this->searchResponses->current(); |
|
66 | - if ($this->searchResponses->valid() && empty($currentPage['hits']['hits'])) { |
|
67 | - $this->searchResponses->next(); |
|
68 | - } |
|
69 | - $this->count = 0; |
|
70 | - if (isset($currentPage['hits']['total']['value'], $currentPage['hits']['total'])) { |
|
71 | - $this->count = $currentPage['hits']['total']['value'] ?? $currentPage['hits']['total']; |
|
72 | - } |
|
73 | - $this->readPageData(); |
|
74 | - } |
|
75 | - /** |
|
76 | - * Advances pointer of the current hit to the next one in the current page. If there |
|
77 | - * isn't a next hit in the current page, then it advances the current page and moves the |
|
78 | - * pointer to the first hit in the page. |
|
79 | - * |
|
80 | - * @return void |
|
81 | - * @throws ClientResponseException |
|
82 | - * @throws ServerResponseException |
|
83 | - * @see Iterator::next() |
|
84 | - */ |
|
85 | - public function next() : void |
|
86 | - { |
|
87 | - $this->currentKey++; |
|
88 | - $this->currentHitIndex++; |
|
89 | - $currentPage = $this->searchResponses->current(); |
|
90 | - if (isset($currentPage['hits']['hits'][$this->currentHitIndex])) { |
|
91 | - $this->currentHitData = $currentPage['hits']['hits'][$this->currentHitIndex]; |
|
92 | - } else { |
|
93 | - $this->searchResponses->next(); |
|
94 | - $this->readPageData(); |
|
95 | - } |
|
96 | - } |
|
97 | - /** |
|
98 | - * Returns a boolean indicating whether or not the current pointer has valid data |
|
99 | - * |
|
100 | - * @return bool |
|
101 | - * @see Iterator::valid() |
|
102 | - */ |
|
103 | - public function valid() : bool |
|
104 | - { |
|
105 | - return \is_array($this->currentHitData); |
|
106 | - } |
|
107 | - /** |
|
108 | - * Returns the current hit |
|
109 | - * |
|
110 | - * @return array |
|
111 | - * @see Iterator::current() |
|
112 | - */ |
|
113 | - public function current() : array |
|
114 | - { |
|
115 | - return $this->currentHitData; |
|
116 | - } |
|
117 | - /** |
|
118 | - * Returns the current hit index. The hit index spans all pages. |
|
119 | - * |
|
120 | - * @return int |
|
121 | - * @see Iterator::key() |
|
122 | - */ |
|
123 | - public function key() : int |
|
124 | - { |
|
125 | - return $this->currentKey; |
|
126 | - } |
|
127 | - /** |
|
128 | - * Advances the internal SearchResponseIterator and resets the currentHitIndex to 0 |
|
129 | - * |
|
130 | - * @internal |
|
131 | - */ |
|
132 | - private function readPageData() : void |
|
133 | - { |
|
134 | - if ($this->searchResponses->valid()) { |
|
135 | - $currentPage = $this->searchResponses->current(); |
|
136 | - $this->currentHitIndex = 0; |
|
137 | - $this->currentHitData = $currentPage['hits']['hits'][$this->currentHitIndex]; |
|
138 | - } else { |
|
139 | - $this->currentHitData = null; |
|
140 | - } |
|
141 | - } |
|
142 | - /** |
|
143 | - * {@inheritDoc} |
|
144 | - */ |
|
145 | - public function count() : int |
|
146 | - { |
|
147 | - return $this->count; |
|
148 | - } |
|
23 | + /** |
|
24 | + * @var SearchResponseIterator |
|
25 | + */ |
|
26 | + private SearchResponseIterator $searchResponses; |
|
27 | + /** |
|
28 | + * @var int |
|
29 | + */ |
|
30 | + protected int $currentKey; |
|
31 | + /** |
|
32 | + * @var int |
|
33 | + */ |
|
34 | + protected int $currentHitIndex; |
|
35 | + /** |
|
36 | + * @var array|null |
|
37 | + */ |
|
38 | + protected ?array $currentHitData; |
|
39 | + /** |
|
40 | + * @var int |
|
41 | + */ |
|
42 | + protected int $count = 0; |
|
43 | + /** |
|
44 | + * Constructor |
|
45 | + * |
|
46 | + * @param SearchResponseIterator $searchResponses |
|
47 | + */ |
|
48 | + public function __construct(SearchResponseIterator $searchResponses) |
|
49 | + { |
|
50 | + $this->searchResponses = $searchResponses; |
|
51 | + } |
|
52 | + /** |
|
53 | + * Rewinds the internal SearchResponseIterator and itself |
|
54 | + * |
|
55 | + * @return void |
|
56 | + * @throws ClientResponseException |
|
57 | + * @throws ServerResponseException |
|
58 | + * @see Iterator::rewind() |
|
59 | + */ |
|
60 | + public function rewind() : void |
|
61 | + { |
|
62 | + $this->currentKey = 0; |
|
63 | + $this->searchResponses->rewind(); |
|
64 | + // The first page may be empty. In that case, the next page is fetched. |
|
65 | + $currentPage = $this->searchResponses->current(); |
|
66 | + if ($this->searchResponses->valid() && empty($currentPage['hits']['hits'])) { |
|
67 | + $this->searchResponses->next(); |
|
68 | + } |
|
69 | + $this->count = 0; |
|
70 | + if (isset($currentPage['hits']['total']['value'], $currentPage['hits']['total'])) { |
|
71 | + $this->count = $currentPage['hits']['total']['value'] ?? $currentPage['hits']['total']; |
|
72 | + } |
|
73 | + $this->readPageData(); |
|
74 | + } |
|
75 | + /** |
|
76 | + * Advances pointer of the current hit to the next one in the current page. If there |
|
77 | + * isn't a next hit in the current page, then it advances the current page and moves the |
|
78 | + * pointer to the first hit in the page. |
|
79 | + * |
|
80 | + * @return void |
|
81 | + * @throws ClientResponseException |
|
82 | + * @throws ServerResponseException |
|
83 | + * @see Iterator::next() |
|
84 | + */ |
|
85 | + public function next() : void |
|
86 | + { |
|
87 | + $this->currentKey++; |
|
88 | + $this->currentHitIndex++; |
|
89 | + $currentPage = $this->searchResponses->current(); |
|
90 | + if (isset($currentPage['hits']['hits'][$this->currentHitIndex])) { |
|
91 | + $this->currentHitData = $currentPage['hits']['hits'][$this->currentHitIndex]; |
|
92 | + } else { |
|
93 | + $this->searchResponses->next(); |
|
94 | + $this->readPageData(); |
|
95 | + } |
|
96 | + } |
|
97 | + /** |
|
98 | + * Returns a boolean indicating whether or not the current pointer has valid data |
|
99 | + * |
|
100 | + * @return bool |
|
101 | + * @see Iterator::valid() |
|
102 | + */ |
|
103 | + public function valid() : bool |
|
104 | + { |
|
105 | + return \is_array($this->currentHitData); |
|
106 | + } |
|
107 | + /** |
|
108 | + * Returns the current hit |
|
109 | + * |
|
110 | + * @return array |
|
111 | + * @see Iterator::current() |
|
112 | + */ |
|
113 | + public function current() : array |
|
114 | + { |
|
115 | + return $this->currentHitData; |
|
116 | + } |
|
117 | + /** |
|
118 | + * Returns the current hit index. The hit index spans all pages. |
|
119 | + * |
|
120 | + * @return int |
|
121 | + * @see Iterator::key() |
|
122 | + */ |
|
123 | + public function key() : int |
|
124 | + { |
|
125 | + return $this->currentKey; |
|
126 | + } |
|
127 | + /** |
|
128 | + * Advances the internal SearchResponseIterator and resets the currentHitIndex to 0 |
|
129 | + * |
|
130 | + * @internal |
|
131 | + */ |
|
132 | + private function readPageData() : void |
|
133 | + { |
|
134 | + if ($this->searchResponses->valid()) { |
|
135 | + $currentPage = $this->searchResponses->current(); |
|
136 | + $this->currentHitIndex = 0; |
|
137 | + $this->currentHitData = $currentPage['hits']['hits'][$this->currentHitIndex]; |
|
138 | + } else { |
|
139 | + $this->currentHitData = null; |
|
140 | + } |
|
141 | + } |
|
142 | + /** |
|
143 | + * {@inheritDoc} |
|
144 | + */ |
|
145 | + public function count() : int |
|
146 | + { |
|
147 | + return $this->count; |
|
148 | + } |
|
149 | 149 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Helper\Iterators; |
16 | 16 | |
17 | 17 | use Countable; |
@@ -20,140 +20,140 @@ |
||
20 | 20 | use Iterator; |
21 | 21 | class SearchResponseIterator implements Iterator |
22 | 22 | { |
23 | - /** |
|
24 | - * @var ClientInterface |
|
25 | - */ |
|
26 | - private ClientInterface $client; |
|
27 | - /** |
|
28 | - * @var array |
|
29 | - */ |
|
30 | - private array $params; |
|
31 | - /** |
|
32 | - * @var int |
|
33 | - */ |
|
34 | - private int $currentKey = 0; |
|
35 | - /** |
|
36 | - * @var array |
|
37 | - */ |
|
38 | - private array $currentScrolledResponse; |
|
39 | - /** |
|
40 | - * @var string|null |
|
41 | - */ |
|
42 | - private ?string $scrollId; |
|
43 | - /** |
|
44 | - * @var string duration |
|
45 | - */ |
|
46 | - private $scrollTtl; |
|
47 | - /** |
|
48 | - * Constructor |
|
49 | - * |
|
50 | - * @param ClientInterface $client |
|
51 | - * @param array $searchParams Associative array of parameters |
|
52 | - * @see ClientInterface::search() |
|
53 | - */ |
|
54 | - public function __construct(ClientInterface $client, array $searchParams) |
|
55 | - { |
|
56 | - $this->client = $client; |
|
57 | - $this->params = $searchParams; |
|
58 | - if (isset($searchParams['scroll'])) { |
|
59 | - $this->scrollTtl = $searchParams['scroll']; |
|
60 | - } |
|
61 | - } |
|
62 | - /** |
|
63 | - * Destructor |
|
64 | - * |
|
65 | - * @throws ClientResponseException |
|
66 | - * @throws ServerResponseException |
|
67 | - */ |
|
68 | - public function __destruct() |
|
69 | - { |
|
70 | - $this->clearScroll(); |
|
71 | - } |
|
72 | - /** |
|
73 | - * Sets the time to live duration of a scroll window |
|
74 | - * |
|
75 | - * @param string $timeToLive |
|
76 | - * @return $this |
|
77 | - */ |
|
78 | - public function setScrollTimeout(string $timeToLive) : SearchResponseIterator |
|
79 | - { |
|
80 | - $this->scrollTtl = $timeToLive; |
|
81 | - return $this; |
|
82 | - } |
|
83 | - /** |
|
84 | - * Clears the current scroll window if there is a scroll_id stored |
|
85 | - * |
|
86 | - * @return void |
|
87 | - * @throws ClientResponseException |
|
88 | - * @throws ServerResponseException |
|
89 | - */ |
|
90 | - private function clearScroll() : void |
|
91 | - { |
|
92 | - if (!empty($this->scrollId)) { |
|
93 | - /* @phpstan-ignore-next-line */ |
|
94 | - $this->client->clearScroll(['body' => ['scroll_id' => $this->scrollId], 'client' => ['ignore' => 404]]); |
|
95 | - $this->scrollId = null; |
|
96 | - } |
|
97 | - } |
|
98 | - /** |
|
99 | - * Rewinds the iterator by performing the initial search. |
|
100 | - * |
|
101 | - * @return void |
|
102 | - * @throws ClientResponseException |
|
103 | - * @throws ServerResponseException |
|
104 | - * @see Iterator::rewind() |
|
105 | - */ |
|
106 | - public function rewind() : void |
|
107 | - { |
|
108 | - $this->clearScroll(); |
|
109 | - $this->currentKey = 0; |
|
110 | - /* @phpstan-ignore-next-line */ |
|
111 | - $this->currentScrolledResponse = $this->client->search($this->params)->asArray(); |
|
112 | - $this->scrollId = $this->currentScrolledResponse['_scroll_id']; |
|
113 | - } |
|
114 | - /** |
|
115 | - * Fetches every "page" after the first one using the lastest "scroll_id" |
|
116 | - * |
|
117 | - * @return void |
|
118 | - * @throws ClientResponseException |
|
119 | - * @throws ServerResponseException |
|
120 | - * @see Iterator::next() |
|
121 | - */ |
|
122 | - public function next() : void |
|
123 | - { |
|
124 | - /* @phpstan-ignore-next-line */ |
|
125 | - $this->currentScrolledResponse = $this->client->scroll(['body' => ['scroll_id' => $this->scrollId, 'scroll' => $this->scrollTtl]])->asArray(); |
|
126 | - $this->scrollId = $this->currentScrolledResponse['_scroll_id']; |
|
127 | - $this->currentKey++; |
|
128 | - } |
|
129 | - /** |
|
130 | - * Returns a boolean value indicating if the current page is valid or not |
|
131 | - * |
|
132 | - * @return bool |
|
133 | - * @see Iterator::valid() |
|
134 | - */ |
|
135 | - public function valid() : bool |
|
136 | - { |
|
137 | - return isset($this->currentScrolledResponse['hits']['hits'][0]); |
|
138 | - } |
|
139 | - /** |
|
140 | - * Returns the current "page" |
|
141 | - * |
|
142 | - * @return array |
|
143 | - * @see Iterator::current() |
|
144 | - */ |
|
145 | - public function current() : array |
|
146 | - { |
|
147 | - return $this->currentScrolledResponse; |
|
148 | - } |
|
149 | - /** |
|
150 | - * Returns the current "page number" of the current "page" |
|
151 | - * |
|
152 | - * @return int |
|
153 | - * @see Iterator::key() |
|
154 | - */ |
|
155 | - public function key() : int |
|
156 | - { |
|
157 | - return $this->currentKey; |
|
158 | - } |
|
23 | + /** |
|
24 | + * @var ClientInterface |
|
25 | + */ |
|
26 | + private ClientInterface $client; |
|
27 | + /** |
|
28 | + * @var array |
|
29 | + */ |
|
30 | + private array $params; |
|
31 | + /** |
|
32 | + * @var int |
|
33 | + */ |
|
34 | + private int $currentKey = 0; |
|
35 | + /** |
|
36 | + * @var array |
|
37 | + */ |
|
38 | + private array $currentScrolledResponse; |
|
39 | + /** |
|
40 | + * @var string|null |
|
41 | + */ |
|
42 | + private ?string $scrollId; |
|
43 | + /** |
|
44 | + * @var string duration |
|
45 | + */ |
|
46 | + private $scrollTtl; |
|
47 | + /** |
|
48 | + * Constructor |
|
49 | + * |
|
50 | + * @param ClientInterface $client |
|
51 | + * @param array $searchParams Associative array of parameters |
|
52 | + * @see ClientInterface::search() |
|
53 | + */ |
|
54 | + public function __construct(ClientInterface $client, array $searchParams) |
|
55 | + { |
|
56 | + $this->client = $client; |
|
57 | + $this->params = $searchParams; |
|
58 | + if (isset($searchParams['scroll'])) { |
|
59 | + $this->scrollTtl = $searchParams['scroll']; |
|
60 | + } |
|
61 | + } |
|
62 | + /** |
|
63 | + * Destructor |
|
64 | + * |
|
65 | + * @throws ClientResponseException |
|
66 | + * @throws ServerResponseException |
|
67 | + */ |
|
68 | + public function __destruct() |
|
69 | + { |
|
70 | + $this->clearScroll(); |
|
71 | + } |
|
72 | + /** |
|
73 | + * Sets the time to live duration of a scroll window |
|
74 | + * |
|
75 | + * @param string $timeToLive |
|
76 | + * @return $this |
|
77 | + */ |
|
78 | + public function setScrollTimeout(string $timeToLive) : SearchResponseIterator |
|
79 | + { |
|
80 | + $this->scrollTtl = $timeToLive; |
|
81 | + return $this; |
|
82 | + } |
|
83 | + /** |
|
84 | + * Clears the current scroll window if there is a scroll_id stored |
|
85 | + * |
|
86 | + * @return void |
|
87 | + * @throws ClientResponseException |
|
88 | + * @throws ServerResponseException |
|
89 | + */ |
|
90 | + private function clearScroll() : void |
|
91 | + { |
|
92 | + if (!empty($this->scrollId)) { |
|
93 | + /* @phpstan-ignore-next-line */ |
|
94 | + $this->client->clearScroll(['body' => ['scroll_id' => $this->scrollId], 'client' => ['ignore' => 404]]); |
|
95 | + $this->scrollId = null; |
|
96 | + } |
|
97 | + } |
|
98 | + /** |
|
99 | + * Rewinds the iterator by performing the initial search. |
|
100 | + * |
|
101 | + * @return void |
|
102 | + * @throws ClientResponseException |
|
103 | + * @throws ServerResponseException |
|
104 | + * @see Iterator::rewind() |
|
105 | + */ |
|
106 | + public function rewind() : void |
|
107 | + { |
|
108 | + $this->clearScroll(); |
|
109 | + $this->currentKey = 0; |
|
110 | + /* @phpstan-ignore-next-line */ |
|
111 | + $this->currentScrolledResponse = $this->client->search($this->params)->asArray(); |
|
112 | + $this->scrollId = $this->currentScrolledResponse['_scroll_id']; |
|
113 | + } |
|
114 | + /** |
|
115 | + * Fetches every "page" after the first one using the lastest "scroll_id" |
|
116 | + * |
|
117 | + * @return void |
|
118 | + * @throws ClientResponseException |
|
119 | + * @throws ServerResponseException |
|
120 | + * @see Iterator::next() |
|
121 | + */ |
|
122 | + public function next() : void |
|
123 | + { |
|
124 | + /* @phpstan-ignore-next-line */ |
|
125 | + $this->currentScrolledResponse = $this->client->scroll(['body' => ['scroll_id' => $this->scrollId, 'scroll' => $this->scrollTtl]])->asArray(); |
|
126 | + $this->scrollId = $this->currentScrolledResponse['_scroll_id']; |
|
127 | + $this->currentKey++; |
|
128 | + } |
|
129 | + /** |
|
130 | + * Returns a boolean value indicating if the current page is valid or not |
|
131 | + * |
|
132 | + * @return bool |
|
133 | + * @see Iterator::valid() |
|
134 | + */ |
|
135 | + public function valid() : bool |
|
136 | + { |
|
137 | + return isset($this->currentScrolledResponse['hits']['hits'][0]); |
|
138 | + } |
|
139 | + /** |
|
140 | + * Returns the current "page" |
|
141 | + * |
|
142 | + * @return array |
|
143 | + * @see Iterator::current() |
|
144 | + */ |
|
145 | + public function current() : array |
|
146 | + { |
|
147 | + return $this->currentScrolledResponse; |
|
148 | + } |
|
149 | + /** |
|
150 | + * Returns the current "page number" of the current "page" |
|
151 | + * |
|
152 | + * @return int |
|
153 | + * @see Iterator::key() |
|
154 | + */ |
|
155 | + public function key() : int |
|
156 | + { |
|
157 | + return $this->currentKey; |
|
158 | + } |
|
159 | 159 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Helper\Iterators; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\ClientInterface; |
@@ -18,8 +18,7 @@ |
||
18 | 18 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Exception\ClientResponseException; |
19 | 19 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Exception\ServerResponseException; |
20 | 20 | use Iterator; |
21 | -class SearchResponseIterator implements Iterator |
|
22 | -{ |
|
21 | +class SearchResponseIterator implements Iterator { |
|
23 | 22 | /** |
24 | 23 | * @var ClientInterface |
25 | 24 | */ |
@@ -25,98 +25,98 @@ |
||
25 | 25 | */ |
26 | 26 | class Shutdown extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Removes a node from the shutdown list. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current |
|
32 | - * |
|
33 | - * @param array{ |
|
34 | - * node_id: string, // (REQUIRED) The node id of node to be removed from the shutdown state |
|
35 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
36 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
37 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
38 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
39 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
40 | - * } $params |
|
41 | - * |
|
42 | - * @throws MissingParameterException if a required parameter is missing |
|
43 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
44 | - * @throws ClientResponseException if the status code of response is 4xx |
|
45 | - * @throws ServerResponseException if the status code of response is 5xx |
|
46 | - * |
|
47 | - * @return Elasticsearch|Promise |
|
48 | - */ |
|
49 | - public function deleteNode(array $params = []) |
|
50 | - { |
|
51 | - $this->checkRequiredParameters(['node_id'], $params); |
|
52 | - $url = '/_nodes/' . $this->encode($params['node_id']) . '/shutdown'; |
|
53 | - $method = 'DELETE'; |
|
54 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
55 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
56 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
57 | - } |
|
58 | - /** |
|
59 | - * Retrieve status of a node or nodes that are currently marked as shutting down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. |
|
60 | - * |
|
61 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current |
|
62 | - * |
|
63 | - * @param array{ |
|
64 | - * node_id: string, // Which node for which to retrieve the shutdown status |
|
65 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
66 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
67 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
68 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
69 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
70 | - * } $params |
|
71 | - * |
|
72 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
73 | - * @throws ClientResponseException if the status code of response is 4xx |
|
74 | - * @throws ServerResponseException if the status code of response is 5xx |
|
75 | - * |
|
76 | - * @return Elasticsearch|Promise |
|
77 | - */ |
|
78 | - public function getNode(array $params = []) |
|
79 | - { |
|
80 | - if (isset($params['node_id'])) { |
|
81 | - $url = '/_nodes/' . $this->encode($params['node_id']) . '/shutdown'; |
|
82 | - $method = 'GET'; |
|
83 | - } else { |
|
84 | - $url = '/_nodes/shutdown'; |
|
85 | - $method = 'GET'; |
|
86 | - } |
|
87 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
88 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
89 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
90 | - } |
|
91 | - /** |
|
92 | - * Adds a node to be shut down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. |
|
93 | - * |
|
94 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current |
|
95 | - * |
|
96 | - * @param array{ |
|
97 | - * node_id: string, // (REQUIRED) The node id of node to be shut down |
|
98 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
99 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
100 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
101 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
102 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
103 | - * body: array, // (REQUIRED) The shutdown type definition to register |
|
104 | - * } $params |
|
105 | - * |
|
106 | - * @throws MissingParameterException if a required parameter is missing |
|
107 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
108 | - * @throws ClientResponseException if the status code of response is 4xx |
|
109 | - * @throws ServerResponseException if the status code of response is 5xx |
|
110 | - * |
|
111 | - * @return Elasticsearch|Promise |
|
112 | - */ |
|
113 | - public function putNode(array $params = []) |
|
114 | - { |
|
115 | - $this->checkRequiredParameters(['node_id', 'body'], $params); |
|
116 | - $url = '/_nodes/' . $this->encode($params['node_id']) . '/shutdown'; |
|
117 | - $method = 'PUT'; |
|
118 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
119 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
120 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
121 | - } |
|
28 | + /** |
|
29 | + * Removes a node from the shutdown list. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current |
|
32 | + * |
|
33 | + * @param array{ |
|
34 | + * node_id: string, // (REQUIRED) The node id of node to be removed from the shutdown state |
|
35 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
36 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
37 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
38 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
39 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
40 | + * } $params |
|
41 | + * |
|
42 | + * @throws MissingParameterException if a required parameter is missing |
|
43 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
44 | + * @throws ClientResponseException if the status code of response is 4xx |
|
45 | + * @throws ServerResponseException if the status code of response is 5xx |
|
46 | + * |
|
47 | + * @return Elasticsearch|Promise |
|
48 | + */ |
|
49 | + public function deleteNode(array $params = []) |
|
50 | + { |
|
51 | + $this->checkRequiredParameters(['node_id'], $params); |
|
52 | + $url = '/_nodes/' . $this->encode($params['node_id']) . '/shutdown'; |
|
53 | + $method = 'DELETE'; |
|
54 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
55 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
56 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
57 | + } |
|
58 | + /** |
|
59 | + * Retrieve status of a node or nodes that are currently marked as shutting down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. |
|
60 | + * |
|
61 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current |
|
62 | + * |
|
63 | + * @param array{ |
|
64 | + * node_id: string, // Which node for which to retrieve the shutdown status |
|
65 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
66 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
67 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
68 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
69 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
70 | + * } $params |
|
71 | + * |
|
72 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
73 | + * @throws ClientResponseException if the status code of response is 4xx |
|
74 | + * @throws ServerResponseException if the status code of response is 5xx |
|
75 | + * |
|
76 | + * @return Elasticsearch|Promise |
|
77 | + */ |
|
78 | + public function getNode(array $params = []) |
|
79 | + { |
|
80 | + if (isset($params['node_id'])) { |
|
81 | + $url = '/_nodes/' . $this->encode($params['node_id']) . '/shutdown'; |
|
82 | + $method = 'GET'; |
|
83 | + } else { |
|
84 | + $url = '/_nodes/shutdown'; |
|
85 | + $method = 'GET'; |
|
86 | + } |
|
87 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
88 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
89 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
90 | + } |
|
91 | + /** |
|
92 | + * Adds a node to be shut down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. |
|
93 | + * |
|
94 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current |
|
95 | + * |
|
96 | + * @param array{ |
|
97 | + * node_id: string, // (REQUIRED) The node id of node to be shut down |
|
98 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
99 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
100 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
101 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
102 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
103 | + * body: array, // (REQUIRED) The shutdown type definition to register |
|
104 | + * } $params |
|
105 | + * |
|
106 | + * @throws MissingParameterException if a required parameter is missing |
|
107 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
108 | + * @throws ClientResponseException if the status code of response is 4xx |
|
109 | + * @throws ServerResponseException if the status code of response is 5xx |
|
110 | + * |
|
111 | + * @return Elasticsearch|Promise |
|
112 | + */ |
|
113 | + public function putNode(array $params = []) |
|
114 | + { |
|
115 | + $this->checkRequiredParameters(['node_id', 'body'], $params); |
|
116 | + $url = '/_nodes/' . $this->encode($params['node_id']) . '/shutdown'; |
|
117 | + $method = 'PUT'; |
|
118 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
119 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
120 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
121 | + } |
|
122 | 122 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Endpoints; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Exception\ClientResponseException; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function deleteNode(array $params = []) |
50 | 50 | { |
51 | 51 | $this->checkRequiredParameters(['node_id'], $params); |
52 | - $url = '/_nodes/' . $this->encode($params['node_id']) . '/shutdown'; |
|
52 | + $url = '/_nodes/'.$this->encode($params['node_id']).'/shutdown'; |
|
53 | 53 | $method = 'DELETE'; |
54 | 54 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
55 | 55 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | public function getNode(array $params = []) |
79 | 79 | { |
80 | 80 | if (isset($params['node_id'])) { |
81 | - $url = '/_nodes/' . $this->encode($params['node_id']) . '/shutdown'; |
|
81 | + $url = '/_nodes/'.$this->encode($params['node_id']).'/shutdown'; |
|
82 | 82 | $method = 'GET'; |
83 | 83 | } else { |
84 | 84 | $url = '/_nodes/shutdown'; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | public function putNode(array $params = []) |
114 | 114 | { |
115 | 115 | $this->checkRequiredParameters(['node_id', 'body'], $params); |
116 | - $url = '/_nodes/' . $this->encode($params['node_id']) . '/shutdown'; |
|
116 | + $url = '/_nodes/'.$this->encode($params['node_id']).'/shutdown'; |
|
117 | 117 | $method = 'PUT'; |
118 | 118 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
119 | 119 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -23,8 +23,7 @@ |
||
23 | 23 | /** |
24 | 24 | * @generated This file is generated, please do not edit |
25 | 25 | */ |
26 | -class Shutdown extends AbstractEndpoint |
|
27 | -{ |
|
26 | +class Shutdown extends AbstractEndpoint { |
|
28 | 27 | /** |
29 | 28 | * Removes a node from the shutdown list. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. |
30 | 29 | * |
@@ -25,78 +25,78 @@ |
||
25 | 25 | */ |
26 | 26 | class TextStructure extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch. |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html |
|
32 | - * |
|
33 | - * @param array{ |
|
34 | - * lines_to_sample: int, // How many lines of the file should be included in the analysis |
|
35 | - * line_merge_size_limit: int, // Maximum number of characters permitted in a single message when lines are merged to create messages. |
|
36 | - * timeout: time, // Timeout after which the analysis will be aborted |
|
37 | - * charset: string, // Optional parameter to specify the character set of the file |
|
38 | - * format: enum, // Optional parameter to specify the high level file format |
|
39 | - * has_header_row: boolean, // Optional parameter to specify whether a delimited file includes the column names in its first row |
|
40 | - * column_names: list, // Optional parameter containing a comma separated list of the column names for a delimited file |
|
41 | - * delimiter: string, // Optional parameter to specify the delimiter character for a delimited file - must be a single character |
|
42 | - * quote: string, // Optional parameter to specify the quote character for a delimited file - must be a single character |
|
43 | - * should_trim_fields: boolean, // Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them |
|
44 | - * grok_pattern: string, // Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file |
|
45 | - * ecs_compatibility: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' |
|
46 | - * timestamp_field: string, // Optional parameter to specify the timestamp field in the file |
|
47 | - * timestamp_format: string, // Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format |
|
48 | - * explain: boolean, // Whether to include a commentary on how the structure was derived |
|
49 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
50 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
51 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
52 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
53 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
54 | - * body: array, // (REQUIRED) The contents of the file to be analyzed |
|
55 | - * } $params |
|
56 | - * |
|
57 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
58 | - * @throws ClientResponseException if the status code of response is 4xx |
|
59 | - * @throws ServerResponseException if the status code of response is 5xx |
|
60 | - * |
|
61 | - * @return Elasticsearch|Promise |
|
62 | - */ |
|
63 | - public function findStructure(array $params = []) |
|
64 | - { |
|
65 | - $this->checkRequiredParameters(['body'], $params); |
|
66 | - $url = '/_text_structure/find_structure'; |
|
67 | - $method = 'POST'; |
|
68 | - $url = $this->addQueryString($url, $params, ['lines_to_sample', 'line_merge_size_limit', 'timeout', 'charset', 'format', 'has_header_row', 'column_names', 'delimiter', 'quote', 'should_trim_fields', 'grok_pattern', 'ecs_compatibility', 'timestamp_field', 'timestamp_format', 'explain', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
69 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson']; |
|
70 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
71 | - } |
|
72 | - /** |
|
73 | - * Tests a Grok pattern on some text. |
|
74 | - * |
|
75 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/test-grok-pattern.html |
|
76 | - * |
|
77 | - * @param array{ |
|
78 | - * ecs_compatibility: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' |
|
79 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
80 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
81 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
82 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
83 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
84 | - * body: array, // (REQUIRED) The Grok pattern and text. |
|
85 | - * } $params |
|
86 | - * |
|
87 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
88 | - * @throws ClientResponseException if the status code of response is 4xx |
|
89 | - * @throws ServerResponseException if the status code of response is 5xx |
|
90 | - * |
|
91 | - * @return Elasticsearch|Promise |
|
92 | - */ |
|
93 | - public function testGrokPattern(array $params = []) |
|
94 | - { |
|
95 | - $this->checkRequiredParameters(['body'], $params); |
|
96 | - $url = '/_text_structure/test_grok_pattern'; |
|
97 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
98 | - $url = $this->addQueryString($url, $params, ['ecs_compatibility', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
99 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
100 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
101 | - } |
|
28 | + /** |
|
29 | + * Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch. |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html |
|
32 | + * |
|
33 | + * @param array{ |
|
34 | + * lines_to_sample: int, // How many lines of the file should be included in the analysis |
|
35 | + * line_merge_size_limit: int, // Maximum number of characters permitted in a single message when lines are merged to create messages. |
|
36 | + * timeout: time, // Timeout after which the analysis will be aborted |
|
37 | + * charset: string, // Optional parameter to specify the character set of the file |
|
38 | + * format: enum, // Optional parameter to specify the high level file format |
|
39 | + * has_header_row: boolean, // Optional parameter to specify whether a delimited file includes the column names in its first row |
|
40 | + * column_names: list, // Optional parameter containing a comma separated list of the column names for a delimited file |
|
41 | + * delimiter: string, // Optional parameter to specify the delimiter character for a delimited file - must be a single character |
|
42 | + * quote: string, // Optional parameter to specify the quote character for a delimited file - must be a single character |
|
43 | + * should_trim_fields: boolean, // Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them |
|
44 | + * grok_pattern: string, // Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file |
|
45 | + * ecs_compatibility: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' |
|
46 | + * timestamp_field: string, // Optional parameter to specify the timestamp field in the file |
|
47 | + * timestamp_format: string, // Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format |
|
48 | + * explain: boolean, // Whether to include a commentary on how the structure was derived |
|
49 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
50 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
51 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
52 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
53 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
54 | + * body: array, // (REQUIRED) The contents of the file to be analyzed |
|
55 | + * } $params |
|
56 | + * |
|
57 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
58 | + * @throws ClientResponseException if the status code of response is 4xx |
|
59 | + * @throws ServerResponseException if the status code of response is 5xx |
|
60 | + * |
|
61 | + * @return Elasticsearch|Promise |
|
62 | + */ |
|
63 | + public function findStructure(array $params = []) |
|
64 | + { |
|
65 | + $this->checkRequiredParameters(['body'], $params); |
|
66 | + $url = '/_text_structure/find_structure'; |
|
67 | + $method = 'POST'; |
|
68 | + $url = $this->addQueryString($url, $params, ['lines_to_sample', 'line_merge_size_limit', 'timeout', 'charset', 'format', 'has_header_row', 'column_names', 'delimiter', 'quote', 'should_trim_fields', 'grok_pattern', 'ecs_compatibility', 'timestamp_field', 'timestamp_format', 'explain', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
69 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson']; |
|
70 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
71 | + } |
|
72 | + /** |
|
73 | + * Tests a Grok pattern on some text. |
|
74 | + * |
|
75 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/test-grok-pattern.html |
|
76 | + * |
|
77 | + * @param array{ |
|
78 | + * ecs_compatibility: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' |
|
79 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
80 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
81 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
82 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
83 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
84 | + * body: array, // (REQUIRED) The Grok pattern and text. |
|
85 | + * } $params |
|
86 | + * |
|
87 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
88 | + * @throws ClientResponseException if the status code of response is 4xx |
|
89 | + * @throws ServerResponseException if the status code of response is 5xx |
|
90 | + * |
|
91 | + * @return Elasticsearch|Promise |
|
92 | + */ |
|
93 | + public function testGrokPattern(array $params = []) |
|
94 | + { |
|
95 | + $this->checkRequiredParameters(['body'], $params); |
|
96 | + $url = '/_text_structure/test_grok_pattern'; |
|
97 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
98 | + $url = $this->addQueryString($url, $params, ['ecs_compatibility', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
99 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
100 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
101 | + } |
|
102 | 102 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Endpoints; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Exception\ClientResponseException; |
@@ -23,8 +23,7 @@ |
||
23 | 23 | /** |
24 | 24 | * @generated This file is generated, please do not edit |
25 | 25 | */ |
26 | -class TextStructure extends AbstractEndpoint |
|
27 | -{ |
|
26 | +class TextStructure extends AbstractEndpoint { |
|
28 | 27 | /** |
29 | 28 | * Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch. |
30 | 29 | * |
@@ -25,324 +25,324 @@ |
||
25 | 25 | */ |
26 | 26 | class SearchApplication extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Deletes a search application. |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-search-application.html |
|
32 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
33 | - * |
|
34 | - * @param array{ |
|
35 | - * name: string, // (REQUIRED) The name of the search application |
|
36 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
37 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
38 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
39 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
40 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
41 | - * } $params |
|
42 | - * |
|
43 | - * @throws MissingParameterException if a required parameter is missing |
|
44 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
45 | - * @throws ClientResponseException if the status code of response is 4xx |
|
46 | - * @throws ServerResponseException if the status code of response is 5xx |
|
47 | - * |
|
48 | - * @return Elasticsearch|Promise |
|
49 | - */ |
|
50 | - public function delete(array $params = []) |
|
51 | - { |
|
52 | - $this->checkRequiredParameters(['name'], $params); |
|
53 | - $url = '/_application/search_application/' . $this->encode($params['name']); |
|
54 | - $method = 'DELETE'; |
|
55 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
56 | - $headers = ['Accept' => 'application/json']; |
|
57 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
58 | - } |
|
59 | - /** |
|
60 | - * Delete a behavioral analytics collection. |
|
61 | - * |
|
62 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-analytics-collection.html |
|
63 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
64 | - * |
|
65 | - * @param array{ |
|
66 | - * name: string, // (REQUIRED) The name of the analytics collection to be deleted |
|
67 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
68 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
69 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
70 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
71 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
72 | - * } $params |
|
73 | - * |
|
74 | - * @throws MissingParameterException if a required parameter is missing |
|
75 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
76 | - * @throws ClientResponseException if the status code of response is 4xx |
|
77 | - * @throws ServerResponseException if the status code of response is 5xx |
|
78 | - * |
|
79 | - * @return Elasticsearch|Promise |
|
80 | - */ |
|
81 | - public function deleteBehavioralAnalytics(array $params = []) |
|
82 | - { |
|
83 | - $this->checkRequiredParameters(['name'], $params); |
|
84 | - $url = '/_application/analytics/' . $this->encode($params['name']); |
|
85 | - $method = 'DELETE'; |
|
86 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
87 | - $headers = ['Accept' => 'application/json']; |
|
88 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
89 | - } |
|
90 | - /** |
|
91 | - * Returns the details about a search application. |
|
92 | - * |
|
93 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-search-application.html |
|
94 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
95 | - * |
|
96 | - * @param array{ |
|
97 | - * name: string, // (REQUIRED) The name of the search application |
|
98 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
99 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
100 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
101 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
102 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
103 | - * } $params |
|
104 | - * |
|
105 | - * @throws MissingParameterException if a required parameter is missing |
|
106 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
107 | - * @throws ClientResponseException if the status code of response is 4xx |
|
108 | - * @throws ServerResponseException if the status code of response is 5xx |
|
109 | - * |
|
110 | - * @return Elasticsearch|Promise |
|
111 | - */ |
|
112 | - public function get(array $params = []) |
|
113 | - { |
|
114 | - $this->checkRequiredParameters(['name'], $params); |
|
115 | - $url = '/_application/search_application/' . $this->encode($params['name']); |
|
116 | - $method = 'GET'; |
|
117 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
118 | - $headers = ['Accept' => 'application/json']; |
|
119 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
120 | - } |
|
121 | - /** |
|
122 | - * Returns the existing behavioral analytics collections. |
|
123 | - * |
|
124 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-analytics-collection.html |
|
125 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
126 | - * |
|
127 | - * @param array{ |
|
128 | - * name: list, // A comma-separated list of analytics collections to limit the returned information |
|
129 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
130 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
131 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
132 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
133 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
134 | - * } $params |
|
135 | - * |
|
136 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
137 | - * @throws ClientResponseException if the status code of response is 4xx |
|
138 | - * @throws ServerResponseException if the status code of response is 5xx |
|
139 | - * |
|
140 | - * @return Elasticsearch|Promise |
|
141 | - */ |
|
142 | - public function getBehavioralAnalytics(array $params = []) |
|
143 | - { |
|
144 | - if (isset($params['name'])) { |
|
145 | - $url = '/_application/analytics/' . $this->encode($params['name']); |
|
146 | - $method = 'GET'; |
|
147 | - } else { |
|
148 | - $url = '/_application/analytics'; |
|
149 | - $method = 'GET'; |
|
150 | - } |
|
151 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
152 | - $headers = ['Accept' => 'application/json']; |
|
153 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
154 | - } |
|
155 | - /** |
|
156 | - * Returns the existing search applications. |
|
157 | - * |
|
158 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-search-applications.html |
|
159 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
160 | - * |
|
161 | - * @param array{ |
|
162 | - * q: string, // Query in the Lucene query string syntax |
|
163 | - * from: int, // Starting offset (default: 0) |
|
164 | - * size: int, // specifies a max number of results to get |
|
165 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
166 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
167 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
168 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
169 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
170 | - * } $params |
|
171 | - * |
|
172 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
173 | - * @throws ClientResponseException if the status code of response is 4xx |
|
174 | - * @throws ServerResponseException if the status code of response is 5xx |
|
175 | - * |
|
176 | - * @return Elasticsearch|Promise |
|
177 | - */ |
|
178 | - public function list(array $params = []) |
|
179 | - { |
|
180 | - $url = '/_application/search_application'; |
|
181 | - $method = 'GET'; |
|
182 | - $url = $this->addQueryString($url, $params, ['q', 'from', 'size', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
183 | - $headers = ['Accept' => 'application/json']; |
|
184 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
185 | - } |
|
186 | - /** |
|
187 | - * Creates a behavioral analytics event for existing collection. |
|
188 | - * |
|
189 | - * @see http://todo.com/tbd |
|
190 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
191 | - * |
|
192 | - * @param array{ |
|
193 | - * collection_name: string, // (REQUIRED) The name of behavioral analytics collection |
|
194 | - * event_type: string, // (REQUIRED) Behavioral analytics event type. Available: page_view, search, search_click |
|
195 | - * debug: boolean, // If true, returns event information that will be stored |
|
196 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
197 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
198 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
199 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
200 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
201 | - * body: array, // (REQUIRED) The event definition |
|
202 | - * } $params |
|
203 | - * |
|
204 | - * @throws MissingParameterException if a required parameter is missing |
|
205 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
206 | - * @throws ClientResponseException if the status code of response is 4xx |
|
207 | - * @throws ServerResponseException if the status code of response is 5xx |
|
208 | - * |
|
209 | - * @return Elasticsearch|Promise |
|
210 | - */ |
|
211 | - public function postBehavioralAnalyticsEvent(array $params = []) |
|
212 | - { |
|
213 | - $this->checkRequiredParameters(['collection_name', 'event_type', 'body'], $params); |
|
214 | - $url = '/_application/analytics/' . $this->encode($params['collection_name']) . '/event/' . $this->encode($params['event_type']); |
|
215 | - $method = 'POST'; |
|
216 | - $url = $this->addQueryString($url, $params, ['debug', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
217 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
218 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
219 | - } |
|
220 | - /** |
|
221 | - * Creates or updates a search application. |
|
222 | - * |
|
223 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-search-application.html |
|
224 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
225 | - * |
|
226 | - * @param array{ |
|
227 | - * name: string, // (REQUIRED) The name of the search application to be created or updated |
|
228 | - * create: boolean, // If true, requires that a search application with the specified resource_id does not already exist. (default: false) |
|
229 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
230 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
231 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
232 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
233 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
234 | - * body: array, // (REQUIRED) The search application configuration, including `indices` |
|
235 | - * } $params |
|
236 | - * |
|
237 | - * @throws MissingParameterException if a required parameter is missing |
|
238 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
239 | - * @throws ClientResponseException if the status code of response is 4xx |
|
240 | - * @throws ServerResponseException if the status code of response is 5xx |
|
241 | - * |
|
242 | - * @return Elasticsearch|Promise |
|
243 | - */ |
|
244 | - public function put(array $params = []) |
|
245 | - { |
|
246 | - $this->checkRequiredParameters(['name', 'body'], $params); |
|
247 | - $url = '/_application/search_application/' . $this->encode($params['name']); |
|
248 | - $method = 'PUT'; |
|
249 | - $url = $this->addQueryString($url, $params, ['create', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
250 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
251 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
252 | - } |
|
253 | - /** |
|
254 | - * Creates a behavioral analytics collection. |
|
255 | - * |
|
256 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-analytics-collection.html |
|
257 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
258 | - * |
|
259 | - * @param array{ |
|
260 | - * name: string, // (REQUIRED) The name of the analytics collection to be created or updated |
|
261 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
262 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
263 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
264 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
265 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
266 | - * } $params |
|
267 | - * |
|
268 | - * @throws MissingParameterException if a required parameter is missing |
|
269 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
270 | - * @throws ClientResponseException if the status code of response is 4xx |
|
271 | - * @throws ServerResponseException if the status code of response is 5xx |
|
272 | - * |
|
273 | - * @return Elasticsearch|Promise |
|
274 | - */ |
|
275 | - public function putBehavioralAnalytics(array $params = []) |
|
276 | - { |
|
277 | - $this->checkRequiredParameters(['name'], $params); |
|
278 | - $url = '/_application/analytics/' . $this->encode($params['name']); |
|
279 | - $method = 'PUT'; |
|
280 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
281 | - $headers = ['Accept' => 'application/json']; |
|
282 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
283 | - } |
|
284 | - /** |
|
285 | - * Renders a query for given search application search parameters |
|
286 | - * |
|
287 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-application-render-query.html |
|
288 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
289 | - * |
|
290 | - * @param array{ |
|
291 | - * name: string, // (REQUIRED) The name of the search application to render the query for |
|
292 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
293 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
294 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
295 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
296 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
297 | - * body: array, // Search parameters, which will override any default search parameters defined in the search application template |
|
298 | - * } $params |
|
299 | - * |
|
300 | - * @throws MissingParameterException if a required parameter is missing |
|
301 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
302 | - * @throws ClientResponseException if the status code of response is 4xx |
|
303 | - * @throws ServerResponseException if the status code of response is 5xx |
|
304 | - * |
|
305 | - * @return Elasticsearch|Promise |
|
306 | - */ |
|
307 | - public function renderQuery(array $params = []) |
|
308 | - { |
|
309 | - $this->checkRequiredParameters(['name'], $params); |
|
310 | - $url = '/_application/search_application/' . $this->encode($params['name']) . '/_render_query'; |
|
311 | - $method = 'POST'; |
|
312 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
313 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
314 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
315 | - } |
|
316 | - /** |
|
317 | - * Perform a search against a search application |
|
318 | - * |
|
319 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-application-search.html |
|
320 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
321 | - * |
|
322 | - * @param array{ |
|
323 | - * name: string, // (REQUIRED) The name of the search application to be searched |
|
324 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
325 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
326 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
327 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
328 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
329 | - * body: array, // Search parameters, including template parameters that override defaults |
|
330 | - * } $params |
|
331 | - * |
|
332 | - * @throws MissingParameterException if a required parameter is missing |
|
333 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
334 | - * @throws ClientResponseException if the status code of response is 4xx |
|
335 | - * @throws ServerResponseException if the status code of response is 5xx |
|
336 | - * |
|
337 | - * @return Elasticsearch|Promise |
|
338 | - */ |
|
339 | - public function search(array $params = []) |
|
340 | - { |
|
341 | - $this->checkRequiredParameters(['name'], $params); |
|
342 | - $url = '/_application/search_application/' . $this->encode($params['name']) . '/_search'; |
|
343 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
344 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
345 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
346 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
347 | - } |
|
28 | + /** |
|
29 | + * Deletes a search application. |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-search-application.html |
|
32 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
33 | + * |
|
34 | + * @param array{ |
|
35 | + * name: string, // (REQUIRED) The name of the search application |
|
36 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
37 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
38 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
39 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
40 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
41 | + * } $params |
|
42 | + * |
|
43 | + * @throws MissingParameterException if a required parameter is missing |
|
44 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
45 | + * @throws ClientResponseException if the status code of response is 4xx |
|
46 | + * @throws ServerResponseException if the status code of response is 5xx |
|
47 | + * |
|
48 | + * @return Elasticsearch|Promise |
|
49 | + */ |
|
50 | + public function delete(array $params = []) |
|
51 | + { |
|
52 | + $this->checkRequiredParameters(['name'], $params); |
|
53 | + $url = '/_application/search_application/' . $this->encode($params['name']); |
|
54 | + $method = 'DELETE'; |
|
55 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
56 | + $headers = ['Accept' => 'application/json']; |
|
57 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
58 | + } |
|
59 | + /** |
|
60 | + * Delete a behavioral analytics collection. |
|
61 | + * |
|
62 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-analytics-collection.html |
|
63 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
64 | + * |
|
65 | + * @param array{ |
|
66 | + * name: string, // (REQUIRED) The name of the analytics collection to be deleted |
|
67 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
68 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
69 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
70 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
71 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
72 | + * } $params |
|
73 | + * |
|
74 | + * @throws MissingParameterException if a required parameter is missing |
|
75 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
76 | + * @throws ClientResponseException if the status code of response is 4xx |
|
77 | + * @throws ServerResponseException if the status code of response is 5xx |
|
78 | + * |
|
79 | + * @return Elasticsearch|Promise |
|
80 | + */ |
|
81 | + public function deleteBehavioralAnalytics(array $params = []) |
|
82 | + { |
|
83 | + $this->checkRequiredParameters(['name'], $params); |
|
84 | + $url = '/_application/analytics/' . $this->encode($params['name']); |
|
85 | + $method = 'DELETE'; |
|
86 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
87 | + $headers = ['Accept' => 'application/json']; |
|
88 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
89 | + } |
|
90 | + /** |
|
91 | + * Returns the details about a search application. |
|
92 | + * |
|
93 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-search-application.html |
|
94 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
95 | + * |
|
96 | + * @param array{ |
|
97 | + * name: string, // (REQUIRED) The name of the search application |
|
98 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
99 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
100 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
101 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
102 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
103 | + * } $params |
|
104 | + * |
|
105 | + * @throws MissingParameterException if a required parameter is missing |
|
106 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
107 | + * @throws ClientResponseException if the status code of response is 4xx |
|
108 | + * @throws ServerResponseException if the status code of response is 5xx |
|
109 | + * |
|
110 | + * @return Elasticsearch|Promise |
|
111 | + */ |
|
112 | + public function get(array $params = []) |
|
113 | + { |
|
114 | + $this->checkRequiredParameters(['name'], $params); |
|
115 | + $url = '/_application/search_application/' . $this->encode($params['name']); |
|
116 | + $method = 'GET'; |
|
117 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
118 | + $headers = ['Accept' => 'application/json']; |
|
119 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
120 | + } |
|
121 | + /** |
|
122 | + * Returns the existing behavioral analytics collections. |
|
123 | + * |
|
124 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-analytics-collection.html |
|
125 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
126 | + * |
|
127 | + * @param array{ |
|
128 | + * name: list, // A comma-separated list of analytics collections to limit the returned information |
|
129 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
130 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
131 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
132 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
133 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
134 | + * } $params |
|
135 | + * |
|
136 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
137 | + * @throws ClientResponseException if the status code of response is 4xx |
|
138 | + * @throws ServerResponseException if the status code of response is 5xx |
|
139 | + * |
|
140 | + * @return Elasticsearch|Promise |
|
141 | + */ |
|
142 | + public function getBehavioralAnalytics(array $params = []) |
|
143 | + { |
|
144 | + if (isset($params['name'])) { |
|
145 | + $url = '/_application/analytics/' . $this->encode($params['name']); |
|
146 | + $method = 'GET'; |
|
147 | + } else { |
|
148 | + $url = '/_application/analytics'; |
|
149 | + $method = 'GET'; |
|
150 | + } |
|
151 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
152 | + $headers = ['Accept' => 'application/json']; |
|
153 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
154 | + } |
|
155 | + /** |
|
156 | + * Returns the existing search applications. |
|
157 | + * |
|
158 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-search-applications.html |
|
159 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
160 | + * |
|
161 | + * @param array{ |
|
162 | + * q: string, // Query in the Lucene query string syntax |
|
163 | + * from: int, // Starting offset (default: 0) |
|
164 | + * size: int, // specifies a max number of results to get |
|
165 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
166 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
167 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
168 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
169 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
170 | + * } $params |
|
171 | + * |
|
172 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
173 | + * @throws ClientResponseException if the status code of response is 4xx |
|
174 | + * @throws ServerResponseException if the status code of response is 5xx |
|
175 | + * |
|
176 | + * @return Elasticsearch|Promise |
|
177 | + */ |
|
178 | + public function list(array $params = []) |
|
179 | + { |
|
180 | + $url = '/_application/search_application'; |
|
181 | + $method = 'GET'; |
|
182 | + $url = $this->addQueryString($url, $params, ['q', 'from', 'size', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
183 | + $headers = ['Accept' => 'application/json']; |
|
184 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
185 | + } |
|
186 | + /** |
|
187 | + * Creates a behavioral analytics event for existing collection. |
|
188 | + * |
|
189 | + * @see http://todo.com/tbd |
|
190 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
191 | + * |
|
192 | + * @param array{ |
|
193 | + * collection_name: string, // (REQUIRED) The name of behavioral analytics collection |
|
194 | + * event_type: string, // (REQUIRED) Behavioral analytics event type. Available: page_view, search, search_click |
|
195 | + * debug: boolean, // If true, returns event information that will be stored |
|
196 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
197 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
198 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
199 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
200 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
201 | + * body: array, // (REQUIRED) The event definition |
|
202 | + * } $params |
|
203 | + * |
|
204 | + * @throws MissingParameterException if a required parameter is missing |
|
205 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
206 | + * @throws ClientResponseException if the status code of response is 4xx |
|
207 | + * @throws ServerResponseException if the status code of response is 5xx |
|
208 | + * |
|
209 | + * @return Elasticsearch|Promise |
|
210 | + */ |
|
211 | + public function postBehavioralAnalyticsEvent(array $params = []) |
|
212 | + { |
|
213 | + $this->checkRequiredParameters(['collection_name', 'event_type', 'body'], $params); |
|
214 | + $url = '/_application/analytics/' . $this->encode($params['collection_name']) . '/event/' . $this->encode($params['event_type']); |
|
215 | + $method = 'POST'; |
|
216 | + $url = $this->addQueryString($url, $params, ['debug', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
217 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
218 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
219 | + } |
|
220 | + /** |
|
221 | + * Creates or updates a search application. |
|
222 | + * |
|
223 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-search-application.html |
|
224 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
225 | + * |
|
226 | + * @param array{ |
|
227 | + * name: string, // (REQUIRED) The name of the search application to be created or updated |
|
228 | + * create: boolean, // If true, requires that a search application with the specified resource_id does not already exist. (default: false) |
|
229 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
230 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
231 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
232 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
233 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
234 | + * body: array, // (REQUIRED) The search application configuration, including `indices` |
|
235 | + * } $params |
|
236 | + * |
|
237 | + * @throws MissingParameterException if a required parameter is missing |
|
238 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
239 | + * @throws ClientResponseException if the status code of response is 4xx |
|
240 | + * @throws ServerResponseException if the status code of response is 5xx |
|
241 | + * |
|
242 | + * @return Elasticsearch|Promise |
|
243 | + */ |
|
244 | + public function put(array $params = []) |
|
245 | + { |
|
246 | + $this->checkRequiredParameters(['name', 'body'], $params); |
|
247 | + $url = '/_application/search_application/' . $this->encode($params['name']); |
|
248 | + $method = 'PUT'; |
|
249 | + $url = $this->addQueryString($url, $params, ['create', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
250 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
251 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
252 | + } |
|
253 | + /** |
|
254 | + * Creates a behavioral analytics collection. |
|
255 | + * |
|
256 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-analytics-collection.html |
|
257 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
258 | + * |
|
259 | + * @param array{ |
|
260 | + * name: string, // (REQUIRED) The name of the analytics collection to be created or updated |
|
261 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
262 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
263 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
264 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
265 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
266 | + * } $params |
|
267 | + * |
|
268 | + * @throws MissingParameterException if a required parameter is missing |
|
269 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
270 | + * @throws ClientResponseException if the status code of response is 4xx |
|
271 | + * @throws ServerResponseException if the status code of response is 5xx |
|
272 | + * |
|
273 | + * @return Elasticsearch|Promise |
|
274 | + */ |
|
275 | + public function putBehavioralAnalytics(array $params = []) |
|
276 | + { |
|
277 | + $this->checkRequiredParameters(['name'], $params); |
|
278 | + $url = '/_application/analytics/' . $this->encode($params['name']); |
|
279 | + $method = 'PUT'; |
|
280 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
281 | + $headers = ['Accept' => 'application/json']; |
|
282 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
283 | + } |
|
284 | + /** |
|
285 | + * Renders a query for given search application search parameters |
|
286 | + * |
|
287 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-application-render-query.html |
|
288 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
289 | + * |
|
290 | + * @param array{ |
|
291 | + * name: string, // (REQUIRED) The name of the search application to render the query for |
|
292 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
293 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
294 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
295 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
296 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
297 | + * body: array, // Search parameters, which will override any default search parameters defined in the search application template |
|
298 | + * } $params |
|
299 | + * |
|
300 | + * @throws MissingParameterException if a required parameter is missing |
|
301 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
302 | + * @throws ClientResponseException if the status code of response is 4xx |
|
303 | + * @throws ServerResponseException if the status code of response is 5xx |
|
304 | + * |
|
305 | + * @return Elasticsearch|Promise |
|
306 | + */ |
|
307 | + public function renderQuery(array $params = []) |
|
308 | + { |
|
309 | + $this->checkRequiredParameters(['name'], $params); |
|
310 | + $url = '/_application/search_application/' . $this->encode($params['name']) . '/_render_query'; |
|
311 | + $method = 'POST'; |
|
312 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
313 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
314 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
315 | + } |
|
316 | + /** |
|
317 | + * Perform a search against a search application |
|
318 | + * |
|
319 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-application-search.html |
|
320 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
321 | + * |
|
322 | + * @param array{ |
|
323 | + * name: string, // (REQUIRED) The name of the search application to be searched |
|
324 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
325 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
326 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
327 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
328 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
329 | + * body: array, // Search parameters, including template parameters that override defaults |
|
330 | + * } $params |
|
331 | + * |
|
332 | + * @throws MissingParameterException if a required parameter is missing |
|
333 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
334 | + * @throws ClientResponseException if the status code of response is 4xx |
|
335 | + * @throws ServerResponseException if the status code of response is 5xx |
|
336 | + * |
|
337 | + * @return Elasticsearch|Promise |
|
338 | + */ |
|
339 | + public function search(array $params = []) |
|
340 | + { |
|
341 | + $this->checkRequiredParameters(['name'], $params); |
|
342 | + $url = '/_application/search_application/' . $this->encode($params['name']) . '/_search'; |
|
343 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
344 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
345 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
346 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
347 | + } |
|
348 | 348 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Endpoints; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Exception\ClientResponseException; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function delete(array $params = []) |
51 | 51 | { |
52 | 52 | $this->checkRequiredParameters(['name'], $params); |
53 | - $url = '/_application/search_application/' . $this->encode($params['name']); |
|
53 | + $url = '/_application/search_application/'.$this->encode($params['name']); |
|
54 | 54 | $method = 'DELETE'; |
55 | 55 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
56 | 56 | $headers = ['Accept' => 'application/json']; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function deleteBehavioralAnalytics(array $params = []) |
82 | 82 | { |
83 | 83 | $this->checkRequiredParameters(['name'], $params); |
84 | - $url = '/_application/analytics/' . $this->encode($params['name']); |
|
84 | + $url = '/_application/analytics/'.$this->encode($params['name']); |
|
85 | 85 | $method = 'DELETE'; |
86 | 86 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
87 | 87 | $headers = ['Accept' => 'application/json']; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | public function get(array $params = []) |
113 | 113 | { |
114 | 114 | $this->checkRequiredParameters(['name'], $params); |
115 | - $url = '/_application/search_application/' . $this->encode($params['name']); |
|
115 | + $url = '/_application/search_application/'.$this->encode($params['name']); |
|
116 | 116 | $method = 'GET'; |
117 | 117 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
118 | 118 | $headers = ['Accept' => 'application/json']; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | public function getBehavioralAnalytics(array $params = []) |
143 | 143 | { |
144 | 144 | if (isset($params['name'])) { |
145 | - $url = '/_application/analytics/' . $this->encode($params['name']); |
|
145 | + $url = '/_application/analytics/'.$this->encode($params['name']); |
|
146 | 146 | $method = 'GET'; |
147 | 147 | } else { |
148 | 148 | $url = '/_application/analytics'; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | public function postBehavioralAnalyticsEvent(array $params = []) |
212 | 212 | { |
213 | 213 | $this->checkRequiredParameters(['collection_name', 'event_type', 'body'], $params); |
214 | - $url = '/_application/analytics/' . $this->encode($params['collection_name']) . '/event/' . $this->encode($params['event_type']); |
|
214 | + $url = '/_application/analytics/'.$this->encode($params['collection_name']).'/event/'.$this->encode($params['event_type']); |
|
215 | 215 | $method = 'POST'; |
216 | 216 | $url = $this->addQueryString($url, $params, ['debug', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
217 | 217 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | public function put(array $params = []) |
245 | 245 | { |
246 | 246 | $this->checkRequiredParameters(['name', 'body'], $params); |
247 | - $url = '/_application/search_application/' . $this->encode($params['name']); |
|
247 | + $url = '/_application/search_application/'.$this->encode($params['name']); |
|
248 | 248 | $method = 'PUT'; |
249 | 249 | $url = $this->addQueryString($url, $params, ['create', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
250 | 250 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | public function putBehavioralAnalytics(array $params = []) |
276 | 276 | { |
277 | 277 | $this->checkRequiredParameters(['name'], $params); |
278 | - $url = '/_application/analytics/' . $this->encode($params['name']); |
|
278 | + $url = '/_application/analytics/'.$this->encode($params['name']); |
|
279 | 279 | $method = 'PUT'; |
280 | 280 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
281 | 281 | $headers = ['Accept' => 'application/json']; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | public function renderQuery(array $params = []) |
308 | 308 | { |
309 | 309 | $this->checkRequiredParameters(['name'], $params); |
310 | - $url = '/_application/search_application/' . $this->encode($params['name']) . '/_render_query'; |
|
310 | + $url = '/_application/search_application/'.$this->encode($params['name']).'/_render_query'; |
|
311 | 311 | $method = 'POST'; |
312 | 312 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
313 | 313 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | public function search(array $params = []) |
340 | 340 | { |
341 | 341 | $this->checkRequiredParameters(['name'], $params); |
342 | - $url = '/_application/search_application/' . $this->encode($params['name']) . '/_search'; |
|
342 | + $url = '/_application/search_application/'.$this->encode($params['name']).'/_search'; |
|
343 | 343 | $method = empty($params['body']) ? 'GET' : 'POST'; |
344 | 344 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
345 | 345 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -23,8 +23,7 @@ |
||
23 | 23 | /** |
24 | 24 | * @generated This file is generated, please do not edit |
25 | 25 | */ |
26 | -class SearchApplication extends AbstractEndpoint |
|
27 | -{ |
|
26 | +class SearchApplication extends AbstractEndpoint { |
|
28 | 27 | /** |
29 | 28 | * Deletes a search application. |
30 | 29 | * |
@@ -25,173 +25,173 @@ |
||
25 | 25 | */ |
26 | 26 | class AsyncSearch extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Deletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted. |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
32 | - * |
|
33 | - * @param array{ |
|
34 | - * id: string, // (REQUIRED) The async search ID |
|
35 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
36 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
37 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
38 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
39 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
40 | - * } $params |
|
41 | - * |
|
42 | - * @throws MissingParameterException if a required parameter is missing |
|
43 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
44 | - * @throws ClientResponseException if the status code of response is 4xx |
|
45 | - * @throws ServerResponseException if the status code of response is 5xx |
|
46 | - * |
|
47 | - * @return Elasticsearch|Promise |
|
48 | - */ |
|
49 | - public function delete(array $params = []) |
|
50 | - { |
|
51 | - $this->checkRequiredParameters(['id'], $params); |
|
52 | - $url = '/_async_search/' . $this->encode($params['id']); |
|
53 | - $method = 'DELETE'; |
|
54 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
55 | - $headers = ['Accept' => 'application/json']; |
|
56 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
57 | - } |
|
58 | - /** |
|
59 | - * Retrieves the results of a previously submitted async search request given its ID. |
|
60 | - * |
|
61 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
62 | - * |
|
63 | - * @param array{ |
|
64 | - * id: string, // (REQUIRED) The async search ID |
|
65 | - * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response |
|
66 | - * keep_alive: time, // Specify the time interval in which the results (partial or final) for this search will be available |
|
67 | - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
68 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
69 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
70 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
71 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
72 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
73 | - * } $params |
|
74 | - * |
|
75 | - * @throws MissingParameterException if a required parameter is missing |
|
76 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
77 | - * @throws ClientResponseException if the status code of response is 4xx |
|
78 | - * @throws ServerResponseException if the status code of response is 5xx |
|
79 | - * |
|
80 | - * @return Elasticsearch|Promise |
|
81 | - */ |
|
82 | - public function get(array $params = []) |
|
83 | - { |
|
84 | - $this->checkRequiredParameters(['id'], $params); |
|
85 | - $url = '/_async_search/' . $this->encode($params['id']); |
|
86 | - $method = 'GET'; |
|
87 | - $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout', 'keep_alive', 'typed_keys', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
88 | - $headers = ['Accept' => 'application/json']; |
|
89 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
90 | - } |
|
91 | - /** |
|
92 | - * Retrieves the status of a previously submitted async search request given its ID. |
|
93 | - * |
|
94 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
95 | - * |
|
96 | - * @param array{ |
|
97 | - * id: string, // (REQUIRED) The async search ID |
|
98 | - * keep_alive: time, // Specify the time interval in which the results (partial or final) for this search will be available |
|
99 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
100 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
101 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
102 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
103 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
104 | - * } $params |
|
105 | - * |
|
106 | - * @throws MissingParameterException if a required parameter is missing |
|
107 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
108 | - * @throws ClientResponseException if the status code of response is 4xx |
|
109 | - * @throws ServerResponseException if the status code of response is 5xx |
|
110 | - * |
|
111 | - * @return Elasticsearch|Promise |
|
112 | - */ |
|
113 | - public function status(array $params = []) |
|
114 | - { |
|
115 | - $this->checkRequiredParameters(['id'], $params); |
|
116 | - $url = '/_async_search/status/' . $this->encode($params['id']); |
|
117 | - $method = 'GET'; |
|
118 | - $url = $this->addQueryString($url, $params, ['keep_alive', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
119 | - $headers = ['Accept' => 'application/json']; |
|
120 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
121 | - } |
|
122 | - /** |
|
123 | - * Executes a search request asynchronously. |
|
124 | - * |
|
125 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
126 | - * |
|
127 | - * @param array{ |
|
128 | - * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
129 | - * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response |
|
130 | - * keep_on_completion: boolean, // Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false) |
|
131 | - * keep_alive: time, // Update the time interval in which the results (partial or final) for this search will be available |
|
132 | - * batched_reduce_size: number, // The number of shard results that should be reduced at once on the coordinating node. This value should be used as the granularity at which progress results will be made available. |
|
133 | - * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to true |
|
134 | - * analyzer: string, // The analyzer to use for the query string |
|
135 | - * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
136 | - * default_operator: enum, // The default operator for query string query (AND or OR) |
|
137 | - * df: string, // The field to use as default where no field prefix is given in the query string |
|
138 | - * explain: boolean, // Specify whether to return detailed information about score computation as part of a hit |
|
139 | - * stored_fields: list, // A comma-separated list of stored fields to return as part of a hit |
|
140 | - * docvalue_fields: list, // A comma-separated list of fields to return as the docvalue representation of a field for each hit |
|
141 | - * from: number, // Starting offset (default: 0) |
|
142 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
143 | - * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled |
|
144 | - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
145 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
146 | - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
147 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
148 | - * q: string, // Query in the Lucene query string syntax |
|
149 | - * routing: list, // A comma-separated list of specific routing values |
|
150 | - * search_type: enum, // Search operation type |
|
151 | - * size: number, // Number of hits to return (default: 10) |
|
152 | - * sort: list, // A comma-separated list of <field>:<direction> pairs |
|
153 | - * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
154 | - * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
155 | - * _source_includes: list, // A list of fields to extract and return from the _source field |
|
156 | - * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. |
|
157 | - * stats: list, // Specific 'tag' of the request for logging and statistical purposes |
|
158 | - * suggest_field: string, // Specify which field to use for suggestions |
|
159 | - * suggest_mode: enum, // Specify suggest mode |
|
160 | - * suggest_size: number, // How many suggestions to return in response |
|
161 | - * suggest_text: string, // The source text for which the suggestions should be returned |
|
162 | - * timeout: time, // Explicit operation timeout |
|
163 | - * track_scores: boolean, // Whether to calculate and return scores even if they are not used for sorting |
|
164 | - * track_total_hits: boolean|long, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. |
|
165 | - * allow_partial_search_results: boolean, // Indicate if an error should be returned if there is a partial search failure or timeout |
|
166 | - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
167 | - * version: boolean, // Specify whether to return document version as part of a hit |
|
168 | - * seq_no_primary_term: boolean, // Specify whether to return sequence number and primary term of the last modification of each hit |
|
169 | - * max_concurrent_shard_requests: number, // The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests |
|
170 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
171 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
172 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
173 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
174 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
175 | - * body: array, // The search definition using the Query DSL |
|
176 | - * } $params |
|
177 | - * |
|
178 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
179 | - * @throws ClientResponseException if the status code of response is 4xx |
|
180 | - * @throws ServerResponseException if the status code of response is 5xx |
|
181 | - * |
|
182 | - * @return Elasticsearch|Promise |
|
183 | - */ |
|
184 | - public function submit(array $params = []) |
|
185 | - { |
|
186 | - if (isset($params['index'])) { |
|
187 | - $url = '/' . $this->encode($params['index']) . '/_async_search'; |
|
188 | - $method = 'POST'; |
|
189 | - } else { |
|
190 | - $url = '/_async_search'; |
|
191 | - $method = 'POST'; |
|
192 | - } |
|
193 | - $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout', 'keep_on_completion', 'keep_alive', 'batched_reduce_size', 'request_cache', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'search_type', 'size', 'sort', '_source', '_source_excludes', '_source_includes', 'terminate_after', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', 'track_scores', 'track_total_hits', 'allow_partial_search_results', 'typed_keys', 'version', 'seq_no_primary_term', 'max_concurrent_shard_requests', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
194 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
195 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
196 | - } |
|
28 | + /** |
|
29 | + * Deletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted. |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
32 | + * |
|
33 | + * @param array{ |
|
34 | + * id: string, // (REQUIRED) The async search ID |
|
35 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
36 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
37 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
38 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
39 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
40 | + * } $params |
|
41 | + * |
|
42 | + * @throws MissingParameterException if a required parameter is missing |
|
43 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
44 | + * @throws ClientResponseException if the status code of response is 4xx |
|
45 | + * @throws ServerResponseException if the status code of response is 5xx |
|
46 | + * |
|
47 | + * @return Elasticsearch|Promise |
|
48 | + */ |
|
49 | + public function delete(array $params = []) |
|
50 | + { |
|
51 | + $this->checkRequiredParameters(['id'], $params); |
|
52 | + $url = '/_async_search/' . $this->encode($params['id']); |
|
53 | + $method = 'DELETE'; |
|
54 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
55 | + $headers = ['Accept' => 'application/json']; |
|
56 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
57 | + } |
|
58 | + /** |
|
59 | + * Retrieves the results of a previously submitted async search request given its ID. |
|
60 | + * |
|
61 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
62 | + * |
|
63 | + * @param array{ |
|
64 | + * id: string, // (REQUIRED) The async search ID |
|
65 | + * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response |
|
66 | + * keep_alive: time, // Specify the time interval in which the results (partial or final) for this search will be available |
|
67 | + * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
68 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
69 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
70 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
71 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
72 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
73 | + * } $params |
|
74 | + * |
|
75 | + * @throws MissingParameterException if a required parameter is missing |
|
76 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
77 | + * @throws ClientResponseException if the status code of response is 4xx |
|
78 | + * @throws ServerResponseException if the status code of response is 5xx |
|
79 | + * |
|
80 | + * @return Elasticsearch|Promise |
|
81 | + */ |
|
82 | + public function get(array $params = []) |
|
83 | + { |
|
84 | + $this->checkRequiredParameters(['id'], $params); |
|
85 | + $url = '/_async_search/' . $this->encode($params['id']); |
|
86 | + $method = 'GET'; |
|
87 | + $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout', 'keep_alive', 'typed_keys', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
88 | + $headers = ['Accept' => 'application/json']; |
|
89 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
90 | + } |
|
91 | + /** |
|
92 | + * Retrieves the status of a previously submitted async search request given its ID. |
|
93 | + * |
|
94 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
95 | + * |
|
96 | + * @param array{ |
|
97 | + * id: string, // (REQUIRED) The async search ID |
|
98 | + * keep_alive: time, // Specify the time interval in which the results (partial or final) for this search will be available |
|
99 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
100 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
101 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
102 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
103 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
104 | + * } $params |
|
105 | + * |
|
106 | + * @throws MissingParameterException if a required parameter is missing |
|
107 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
108 | + * @throws ClientResponseException if the status code of response is 4xx |
|
109 | + * @throws ServerResponseException if the status code of response is 5xx |
|
110 | + * |
|
111 | + * @return Elasticsearch|Promise |
|
112 | + */ |
|
113 | + public function status(array $params = []) |
|
114 | + { |
|
115 | + $this->checkRequiredParameters(['id'], $params); |
|
116 | + $url = '/_async_search/status/' . $this->encode($params['id']); |
|
117 | + $method = 'GET'; |
|
118 | + $url = $this->addQueryString($url, $params, ['keep_alive', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
119 | + $headers = ['Accept' => 'application/json']; |
|
120 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
121 | + } |
|
122 | + /** |
|
123 | + * Executes a search request asynchronously. |
|
124 | + * |
|
125 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
126 | + * |
|
127 | + * @param array{ |
|
128 | + * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
129 | + * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response |
|
130 | + * keep_on_completion: boolean, // Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false) |
|
131 | + * keep_alive: time, // Update the time interval in which the results (partial or final) for this search will be available |
|
132 | + * batched_reduce_size: number, // The number of shard results that should be reduced at once on the coordinating node. This value should be used as the granularity at which progress results will be made available. |
|
133 | + * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to true |
|
134 | + * analyzer: string, // The analyzer to use for the query string |
|
135 | + * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
136 | + * default_operator: enum, // The default operator for query string query (AND or OR) |
|
137 | + * df: string, // The field to use as default where no field prefix is given in the query string |
|
138 | + * explain: boolean, // Specify whether to return detailed information about score computation as part of a hit |
|
139 | + * stored_fields: list, // A comma-separated list of stored fields to return as part of a hit |
|
140 | + * docvalue_fields: list, // A comma-separated list of fields to return as the docvalue representation of a field for each hit |
|
141 | + * from: number, // Starting offset (default: 0) |
|
142 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
143 | + * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled |
|
144 | + * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
145 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
146 | + * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
147 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
148 | + * q: string, // Query in the Lucene query string syntax |
|
149 | + * routing: list, // A comma-separated list of specific routing values |
|
150 | + * search_type: enum, // Search operation type |
|
151 | + * size: number, // Number of hits to return (default: 10) |
|
152 | + * sort: list, // A comma-separated list of <field>:<direction> pairs |
|
153 | + * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
154 | + * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
155 | + * _source_includes: list, // A list of fields to extract and return from the _source field |
|
156 | + * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. |
|
157 | + * stats: list, // Specific 'tag' of the request for logging and statistical purposes |
|
158 | + * suggest_field: string, // Specify which field to use for suggestions |
|
159 | + * suggest_mode: enum, // Specify suggest mode |
|
160 | + * suggest_size: number, // How many suggestions to return in response |
|
161 | + * suggest_text: string, // The source text for which the suggestions should be returned |
|
162 | + * timeout: time, // Explicit operation timeout |
|
163 | + * track_scores: boolean, // Whether to calculate and return scores even if they are not used for sorting |
|
164 | + * track_total_hits: boolean|long, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. |
|
165 | + * allow_partial_search_results: boolean, // Indicate if an error should be returned if there is a partial search failure or timeout |
|
166 | + * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
167 | + * version: boolean, // Specify whether to return document version as part of a hit |
|
168 | + * seq_no_primary_term: boolean, // Specify whether to return sequence number and primary term of the last modification of each hit |
|
169 | + * max_concurrent_shard_requests: number, // The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests |
|
170 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
171 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
172 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
173 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
174 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
175 | + * body: array, // The search definition using the Query DSL |
|
176 | + * } $params |
|
177 | + * |
|
178 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
179 | + * @throws ClientResponseException if the status code of response is 4xx |
|
180 | + * @throws ServerResponseException if the status code of response is 5xx |
|
181 | + * |
|
182 | + * @return Elasticsearch|Promise |
|
183 | + */ |
|
184 | + public function submit(array $params = []) |
|
185 | + { |
|
186 | + if (isset($params['index'])) { |
|
187 | + $url = '/' . $this->encode($params['index']) . '/_async_search'; |
|
188 | + $method = 'POST'; |
|
189 | + } else { |
|
190 | + $url = '/_async_search'; |
|
191 | + $method = 'POST'; |
|
192 | + } |
|
193 | + $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout', 'keep_on_completion', 'keep_alive', 'batched_reduce_size', 'request_cache', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'search_type', 'size', 'sort', '_source', '_source_excludes', '_source_includes', 'terminate_after', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', 'track_scores', 'track_total_hits', 'allow_partial_search_results', 'typed_keys', 'version', 'seq_no_primary_term', 'max_concurrent_shard_requests', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
194 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
195 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
196 | + } |
|
197 | 197 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Endpoints; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Exception\ClientResponseException; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function delete(array $params = []) |
50 | 50 | { |
51 | 51 | $this->checkRequiredParameters(['id'], $params); |
52 | - $url = '/_async_search/' . $this->encode($params['id']); |
|
52 | + $url = '/_async_search/'.$this->encode($params['id']); |
|
53 | 53 | $method = 'DELETE'; |
54 | 54 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
55 | 55 | $headers = ['Accept' => 'application/json']; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public function get(array $params = []) |
83 | 83 | { |
84 | 84 | $this->checkRequiredParameters(['id'], $params); |
85 | - $url = '/_async_search/' . $this->encode($params['id']); |
|
85 | + $url = '/_async_search/'.$this->encode($params['id']); |
|
86 | 86 | $method = 'GET'; |
87 | 87 | $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout', 'keep_alive', 'typed_keys', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
88 | 88 | $headers = ['Accept' => 'application/json']; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | public function status(array $params = []) |
114 | 114 | { |
115 | 115 | $this->checkRequiredParameters(['id'], $params); |
116 | - $url = '/_async_search/status/' . $this->encode($params['id']); |
|
116 | + $url = '/_async_search/status/'.$this->encode($params['id']); |
|
117 | 117 | $method = 'GET'; |
118 | 118 | $url = $this->addQueryString($url, $params, ['keep_alive', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
119 | 119 | $headers = ['Accept' => 'application/json']; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | public function submit(array $params = []) |
185 | 185 | { |
186 | 186 | if (isset($params['index'])) { |
187 | - $url = '/' . $this->encode($params['index']) . '/_async_search'; |
|
187 | + $url = '/'.$this->encode($params['index']).'/_async_search'; |
|
188 | 188 | $method = 'POST'; |
189 | 189 | } else { |
190 | 190 | $url = '/_async_search'; |
@@ -23,8 +23,7 @@ |
||
23 | 23 | /** |
24 | 24 | * @generated This file is generated, please do not edit |
25 | 25 | */ |
26 | -class AsyncSearch extends AbstractEndpoint |
|
27 | -{ |
|
26 | +class AsyncSearch extends AbstractEndpoint { |
|
28 | 27 | /** |
29 | 28 | * Deletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted. |
30 | 29 | * |
@@ -25,60 +25,60 @@ |
||
25 | 25 | */ |
26 | 26 | class Features extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Gets a list of features which can be included in snapshots using the feature_states field when creating a snapshot |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-features-api.html |
|
32 | - * |
|
33 | - * @param array{ |
|
34 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
35 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
36 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
37 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
38 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
39 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
40 | - * } $params |
|
41 | - * |
|
42 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
43 | - * @throws ClientResponseException if the status code of response is 4xx |
|
44 | - * @throws ServerResponseException if the status code of response is 5xx |
|
45 | - * |
|
46 | - * @return Elasticsearch|Promise |
|
47 | - */ |
|
48 | - public function getFeatures(array $params = []) |
|
49 | - { |
|
50 | - $url = '/_features'; |
|
51 | - $method = 'GET'; |
|
52 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
53 | - $headers = ['Accept' => 'application/json']; |
|
54 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
55 | - } |
|
56 | - /** |
|
57 | - * Resets the internal state of features, usually by deleting system indices |
|
58 | - * |
|
59 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
60 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
61 | - * |
|
62 | - * @param array{ |
|
63 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
64 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
65 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
66 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
67 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
68 | - * } $params |
|
69 | - * |
|
70 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
71 | - * @throws ClientResponseException if the status code of response is 4xx |
|
72 | - * @throws ServerResponseException if the status code of response is 5xx |
|
73 | - * |
|
74 | - * @return Elasticsearch|Promise |
|
75 | - */ |
|
76 | - public function resetFeatures(array $params = []) |
|
77 | - { |
|
78 | - $url = '/_features/_reset'; |
|
79 | - $method = 'POST'; |
|
80 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
81 | - $headers = ['Accept' => 'application/json']; |
|
82 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
83 | - } |
|
28 | + /** |
|
29 | + * Gets a list of features which can be included in snapshots using the feature_states field when creating a snapshot |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-features-api.html |
|
32 | + * |
|
33 | + * @param array{ |
|
34 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
35 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
36 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
37 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
38 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
39 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
40 | + * } $params |
|
41 | + * |
|
42 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
43 | + * @throws ClientResponseException if the status code of response is 4xx |
|
44 | + * @throws ServerResponseException if the status code of response is 5xx |
|
45 | + * |
|
46 | + * @return Elasticsearch|Promise |
|
47 | + */ |
|
48 | + public function getFeatures(array $params = []) |
|
49 | + { |
|
50 | + $url = '/_features'; |
|
51 | + $method = 'GET'; |
|
52 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
53 | + $headers = ['Accept' => 'application/json']; |
|
54 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
55 | + } |
|
56 | + /** |
|
57 | + * Resets the internal state of features, usually by deleting system indices |
|
58 | + * |
|
59 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
60 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
61 | + * |
|
62 | + * @param array{ |
|
63 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
64 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
65 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
66 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
67 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
68 | + * } $params |
|
69 | + * |
|
70 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
71 | + * @throws ClientResponseException if the status code of response is 4xx |
|
72 | + * @throws ServerResponseException if the status code of response is 5xx |
|
73 | + * |
|
74 | + * @return Elasticsearch|Promise |
|
75 | + */ |
|
76 | + public function resetFeatures(array $params = []) |
|
77 | + { |
|
78 | + $url = '/_features/_reset'; |
|
79 | + $method = 'POST'; |
|
80 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
81 | + $headers = ['Accept' => 'application/json']; |
|
82 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
83 | + } |
|
84 | 84 | } |
@@ -23,8 +23,7 @@ |
||
23 | 23 | /** |
24 | 24 | * @generated This file is generated, please do not edit |
25 | 25 | */ |
26 | -class Features extends AbstractEndpoint |
|
27 | -{ |
|
26 | +class Features extends AbstractEndpoint { |
|
28 | 27 | /** |
29 | 28 | * Gets a list of features which can be included in snapshots using the feature_states field when creating a snapshot |
30 | 29 | * |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Endpoints; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Exception\ClientResponseException; |
@@ -25,427 +25,427 @@ |
||
25 | 25 | */ |
26 | 26 | class Snapshot extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Removes stale data from repository. |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/clean-up-snapshot-repo-api.html |
|
32 | - * |
|
33 | - * @param array{ |
|
34 | - * repository: string, // (REQUIRED) A repository name |
|
35 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
36 | - * timeout: time, // Explicit operation timeout |
|
37 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
38 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
39 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
40 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
41 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
42 | - * } $params |
|
43 | - * |
|
44 | - * @throws MissingParameterException if a required parameter is missing |
|
45 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
46 | - * @throws ClientResponseException if the status code of response is 4xx |
|
47 | - * @throws ServerResponseException if the status code of response is 5xx |
|
48 | - * |
|
49 | - * @return Elasticsearch|Promise |
|
50 | - */ |
|
51 | - public function cleanupRepository(array $params = []) |
|
52 | - { |
|
53 | - $this->checkRequiredParameters(['repository'], $params); |
|
54 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/_cleanup'; |
|
55 | - $method = 'POST'; |
|
56 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
57 | - $headers = ['Accept' => 'application/json']; |
|
58 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
59 | - } |
|
60 | - /** |
|
61 | - * Clones indices from one snapshot into another snapshot in the same repository. |
|
62 | - * |
|
63 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
64 | - * |
|
65 | - * @param array{ |
|
66 | - * repository: string, // (REQUIRED) A repository name |
|
67 | - * snapshot: string, // (REQUIRED) The name of the snapshot to clone from |
|
68 | - * target_snapshot: string, // (REQUIRED) The name of the cloned snapshot to create |
|
69 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
70 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
71 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
72 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
73 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
74 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
75 | - * body: array, // (REQUIRED) The snapshot clone definition |
|
76 | - * } $params |
|
77 | - * |
|
78 | - * @throws MissingParameterException if a required parameter is missing |
|
79 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
80 | - * @throws ClientResponseException if the status code of response is 4xx |
|
81 | - * @throws ServerResponseException if the status code of response is 5xx |
|
82 | - * |
|
83 | - * @return Elasticsearch|Promise |
|
84 | - */ |
|
85 | - public function clone(array $params = []) |
|
86 | - { |
|
87 | - $this->checkRequiredParameters(['repository', 'snapshot', 'target_snapshot', 'body'], $params); |
|
88 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']) . '/_clone/' . $this->encode($params['target_snapshot']); |
|
89 | - $method = 'PUT'; |
|
90 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
91 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
92 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
93 | - } |
|
94 | - /** |
|
95 | - * Creates a snapshot in a repository. |
|
96 | - * |
|
97 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
98 | - * |
|
99 | - * @param array{ |
|
100 | - * repository: string, // (REQUIRED) A repository name |
|
101 | - * snapshot: string, // (REQUIRED) A snapshot name |
|
102 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
103 | - * wait_for_completion: boolean, // Should this request wait until the operation has completed before returning |
|
104 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
105 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
106 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
107 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
108 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
109 | - * body: array, // The snapshot definition |
|
110 | - * } $params |
|
111 | - * |
|
112 | - * @throws MissingParameterException if a required parameter is missing |
|
113 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
114 | - * @throws ClientResponseException if the status code of response is 4xx |
|
115 | - * @throws ServerResponseException if the status code of response is 5xx |
|
116 | - * |
|
117 | - * @return Elasticsearch|Promise |
|
118 | - */ |
|
119 | - public function create(array $params = []) |
|
120 | - { |
|
121 | - $this->checkRequiredParameters(['repository', 'snapshot'], $params); |
|
122 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']); |
|
123 | - $method = 'PUT'; |
|
124 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'wait_for_completion', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
125 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
126 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
127 | - } |
|
128 | - /** |
|
129 | - * Creates a repository. |
|
130 | - * |
|
131 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
132 | - * |
|
133 | - * @param array{ |
|
134 | - * repository: string, // (REQUIRED) A repository name |
|
135 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
136 | - * timeout: time, // Explicit operation timeout |
|
137 | - * verify: boolean, // Whether to verify the repository after creation |
|
138 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
139 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
140 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
141 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
142 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
143 | - * body: array, // (REQUIRED) The repository definition |
|
144 | - * } $params |
|
145 | - * |
|
146 | - * @throws MissingParameterException if a required parameter is missing |
|
147 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
148 | - * @throws ClientResponseException if the status code of response is 4xx |
|
149 | - * @throws ServerResponseException if the status code of response is 5xx |
|
150 | - * |
|
151 | - * @return Elasticsearch|Promise |
|
152 | - */ |
|
153 | - public function createRepository(array $params = []) |
|
154 | - { |
|
155 | - $this->checkRequiredParameters(['repository', 'body'], $params); |
|
156 | - $url = '/_snapshot/' . $this->encode($params['repository']); |
|
157 | - $method = 'PUT'; |
|
158 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'verify', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
159 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
160 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
161 | - } |
|
162 | - /** |
|
163 | - * Deletes one or more snapshots. |
|
164 | - * |
|
165 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
166 | - * |
|
167 | - * @param array{ |
|
168 | - * repository: string, // (REQUIRED) A repository name |
|
169 | - * snapshot: list, // (REQUIRED) A comma-separated list of snapshot names |
|
170 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
171 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
172 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
173 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
174 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
175 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
176 | - * } $params |
|
177 | - * |
|
178 | - * @throws MissingParameterException if a required parameter is missing |
|
179 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
180 | - * @throws ClientResponseException if the status code of response is 4xx |
|
181 | - * @throws ServerResponseException if the status code of response is 5xx |
|
182 | - * |
|
183 | - * @return Elasticsearch|Promise |
|
184 | - */ |
|
185 | - public function delete(array $params = []) |
|
186 | - { |
|
187 | - $this->checkRequiredParameters(['repository', 'snapshot'], $params); |
|
188 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']); |
|
189 | - $method = 'DELETE'; |
|
190 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
191 | - $headers = ['Accept' => 'application/json']; |
|
192 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
193 | - } |
|
194 | - /** |
|
195 | - * Deletes a repository. |
|
196 | - * |
|
197 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
198 | - * |
|
199 | - * @param array{ |
|
200 | - * repository: list, // (REQUIRED) Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported. |
|
201 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
202 | - * timeout: time, // Explicit operation timeout |
|
203 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
204 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
205 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
206 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
207 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
208 | - * } $params |
|
209 | - * |
|
210 | - * @throws MissingParameterException if a required parameter is missing |
|
211 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
212 | - * @throws ClientResponseException if the status code of response is 4xx |
|
213 | - * @throws ServerResponseException if the status code of response is 5xx |
|
214 | - * |
|
215 | - * @return Elasticsearch|Promise |
|
216 | - */ |
|
217 | - public function deleteRepository(array $params = []) |
|
218 | - { |
|
219 | - $this->checkRequiredParameters(['repository'], $params); |
|
220 | - $url = '/_snapshot/' . $this->encode($params['repository']); |
|
221 | - $method = 'DELETE'; |
|
222 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
223 | - $headers = ['Accept' => 'application/json']; |
|
224 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
225 | - } |
|
226 | - /** |
|
227 | - * Returns information about a snapshot. |
|
228 | - * |
|
229 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
230 | - * |
|
231 | - * @param array{ |
|
232 | - * repository: string, // (REQUIRED) A repository name |
|
233 | - * snapshot: list, // (REQUIRED) A comma-separated list of snapshot names |
|
234 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
235 | - * ignore_unavailable: boolean, // Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown |
|
236 | - * index_names: boolean, // Whether to include the name of each index in the snapshot. Defaults to true. |
|
237 | - * index_details: boolean, // Whether to include details of each index in the snapshot, if those details are available. Defaults to false. |
|
238 | - * include_repository: boolean, // Whether to include the repository name in the snapshot info. Defaults to true. |
|
239 | - * sort: enum, // Allows setting a sort order for the result. Defaults to start_time |
|
240 | - * size: integer, // Maximum number of snapshots to return. Defaults to 0 which means return all that match without limit. |
|
241 | - * order: enum, // Sort order |
|
242 | - * from_sort_value: string, // Value of the current sort column at which to start retrieval. |
|
243 | - * after: string, // Offset identifier to start pagination from as returned by the 'next' field in the response body. |
|
244 | - * offset: integer, // Numeric offset to start pagination based on the snapshots matching the request. Defaults to 0 |
|
245 | - * slm_policy_filter: string, // Filter snapshots by a comma-separated list of SLM policy names that snapshots belong to. Accepts wildcards. Use the special pattern '_none' to match snapshots without an SLM policy |
|
246 | - * verbose: boolean, // Whether to show verbose snapshot info or only show the basic info found in the repository index blob |
|
247 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
248 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
249 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
250 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
251 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
252 | - * } $params |
|
253 | - * |
|
254 | - * @throws MissingParameterException if a required parameter is missing |
|
255 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
256 | - * @throws ClientResponseException if the status code of response is 4xx |
|
257 | - * @throws ServerResponseException if the status code of response is 5xx |
|
258 | - * |
|
259 | - * @return Elasticsearch|Promise |
|
260 | - */ |
|
261 | - public function get(array $params = []) |
|
262 | - { |
|
263 | - $this->checkRequiredParameters(['repository', 'snapshot'], $params); |
|
264 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']); |
|
265 | - $method = 'GET'; |
|
266 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'ignore_unavailable', 'index_names', 'index_details', 'include_repository', 'sort', 'size', 'order', 'from_sort_value', 'after', 'offset', 'slm_policy_filter', 'verbose', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
267 | - $headers = ['Accept' => 'application/json']; |
|
268 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
269 | - } |
|
270 | - /** |
|
271 | - * Returns information about a repository. |
|
272 | - * |
|
273 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
274 | - * |
|
275 | - * @param array{ |
|
276 | - * repository: list, // A comma-separated list of repository names |
|
277 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
278 | - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
279 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
280 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
281 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
282 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
283 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
284 | - * } $params |
|
285 | - * |
|
286 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
287 | - * @throws ClientResponseException if the status code of response is 4xx |
|
288 | - * @throws ServerResponseException if the status code of response is 5xx |
|
289 | - * |
|
290 | - * @return Elasticsearch|Promise |
|
291 | - */ |
|
292 | - public function getRepository(array $params = []) |
|
293 | - { |
|
294 | - if (isset($params['repository'])) { |
|
295 | - $url = '/_snapshot/' . $this->encode($params['repository']); |
|
296 | - $method = 'GET'; |
|
297 | - } else { |
|
298 | - $url = '/_snapshot'; |
|
299 | - $method = 'GET'; |
|
300 | - } |
|
301 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
302 | - $headers = ['Accept' => 'application/json']; |
|
303 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
304 | - } |
|
305 | - /** |
|
306 | - * Analyzes a repository for correctness and performance |
|
307 | - * |
|
308 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
309 | - * |
|
310 | - * @param array{ |
|
311 | - * repository: string, // (REQUIRED) A repository name |
|
312 | - * blob_count: number, // Number of blobs to create during the test. Defaults to 100. |
|
313 | - * concurrency: number, // Number of operations to run concurrently during the test. Defaults to 10. |
|
314 | - * read_node_count: number, // Number of nodes on which to read a blob after writing. Defaults to 10. |
|
315 | - * early_read_node_count: number, // Number of nodes on which to perform an early read on a blob, i.e. before writing has completed. Early reads are rare actions so the 'rare_action_probability' parameter is also relevant. Defaults to 2. |
|
316 | - * seed: number, // Seed for the random number generator used to create the test workload. Defaults to a random value. |
|
317 | - * rare_action_probability: number, // Probability of taking a rare action such as an early read or an overwrite. Defaults to 0.02. |
|
318 | - * max_blob_size: string, // Maximum size of a blob to create during the test, e.g '1gb' or '100mb'. Defaults to '10mb'. |
|
319 | - * max_total_data_size: string, // Maximum total size of all blobs to create during the test, e.g '1tb' or '100gb'. Defaults to '1gb'. |
|
320 | - * timeout: time, // Explicit operation timeout. Defaults to '30s'. |
|
321 | - * detailed: boolean, // Whether to return detailed results or a summary. Defaults to 'false' so that only the summary is returned. |
|
322 | - * rarely_abort_writes: boolean, // Whether to rarely abort writes before they complete. Defaults to 'true'. |
|
323 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
324 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
325 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
326 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
327 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
328 | - * } $params |
|
329 | - * |
|
330 | - * @throws MissingParameterException if a required parameter is missing |
|
331 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
332 | - * @throws ClientResponseException if the status code of response is 4xx |
|
333 | - * @throws ServerResponseException if the status code of response is 5xx |
|
334 | - * |
|
335 | - * @return Elasticsearch|Promise |
|
336 | - */ |
|
337 | - public function repositoryAnalyze(array $params = []) |
|
338 | - { |
|
339 | - $this->checkRequiredParameters(['repository'], $params); |
|
340 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/_analyze'; |
|
341 | - $method = 'POST'; |
|
342 | - $url = $this->addQueryString($url, $params, ['blob_count', 'concurrency', 'read_node_count', 'early_read_node_count', 'seed', 'rare_action_probability', 'max_blob_size', 'max_total_data_size', 'timeout', 'detailed', 'rarely_abort_writes', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
343 | - $headers = ['Accept' => 'application/json']; |
|
344 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
345 | - } |
|
346 | - /** |
|
347 | - * Restores a snapshot. |
|
348 | - * |
|
349 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
350 | - * |
|
351 | - * @param array{ |
|
352 | - * repository: string, // (REQUIRED) A repository name |
|
353 | - * snapshot: string, // (REQUIRED) A snapshot name |
|
354 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
355 | - * wait_for_completion: boolean, // Should this request wait until the operation has completed before returning |
|
356 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
357 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
358 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
359 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
360 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
361 | - * body: array, // Details of what to restore |
|
362 | - * } $params |
|
363 | - * |
|
364 | - * @throws MissingParameterException if a required parameter is missing |
|
365 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
366 | - * @throws ClientResponseException if the status code of response is 4xx |
|
367 | - * @throws ServerResponseException if the status code of response is 5xx |
|
368 | - * |
|
369 | - * @return Elasticsearch|Promise |
|
370 | - */ |
|
371 | - public function restore(array $params = []) |
|
372 | - { |
|
373 | - $this->checkRequiredParameters(['repository', 'snapshot'], $params); |
|
374 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']) . '/_restore'; |
|
375 | - $method = 'POST'; |
|
376 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'wait_for_completion', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
377 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
378 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
379 | - } |
|
380 | - /** |
|
381 | - * Returns information about the status of a snapshot. |
|
382 | - * |
|
383 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
384 | - * |
|
385 | - * @param array{ |
|
386 | - * repository: string, // A repository name |
|
387 | - * snapshot: list, // A comma-separated list of snapshot names |
|
388 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
389 | - * ignore_unavailable: boolean, // Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown |
|
390 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
391 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
392 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
393 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
394 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
395 | - * } $params |
|
396 | - * |
|
397 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
398 | - * @throws ClientResponseException if the status code of response is 4xx |
|
399 | - * @throws ServerResponseException if the status code of response is 5xx |
|
400 | - * |
|
401 | - * @return Elasticsearch|Promise |
|
402 | - */ |
|
403 | - public function status(array $params = []) |
|
404 | - { |
|
405 | - if (isset($params['repository']) && isset($params['snapshot'])) { |
|
406 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']) . '/_status'; |
|
407 | - $method = 'GET'; |
|
408 | - } elseif (isset($params['repository'])) { |
|
409 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/_status'; |
|
410 | - $method = 'GET'; |
|
411 | - } else { |
|
412 | - $url = '/_snapshot/_status'; |
|
413 | - $method = 'GET'; |
|
414 | - } |
|
415 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'ignore_unavailable', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
416 | - $headers = ['Accept' => 'application/json']; |
|
417 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
418 | - } |
|
419 | - /** |
|
420 | - * Verifies a repository. |
|
421 | - * |
|
422 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
423 | - * |
|
424 | - * @param array{ |
|
425 | - * repository: string, // (REQUIRED) A repository name |
|
426 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
427 | - * timeout: time, // Explicit operation timeout |
|
428 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
429 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
430 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
431 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
432 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
433 | - * } $params |
|
434 | - * |
|
435 | - * @throws MissingParameterException if a required parameter is missing |
|
436 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
437 | - * @throws ClientResponseException if the status code of response is 4xx |
|
438 | - * @throws ServerResponseException if the status code of response is 5xx |
|
439 | - * |
|
440 | - * @return Elasticsearch|Promise |
|
441 | - */ |
|
442 | - public function verifyRepository(array $params = []) |
|
443 | - { |
|
444 | - $this->checkRequiredParameters(['repository'], $params); |
|
445 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/_verify'; |
|
446 | - $method = 'POST'; |
|
447 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
448 | - $headers = ['Accept' => 'application/json']; |
|
449 | - return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
450 | - } |
|
28 | + /** |
|
29 | + * Removes stale data from repository. |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/clean-up-snapshot-repo-api.html |
|
32 | + * |
|
33 | + * @param array{ |
|
34 | + * repository: string, // (REQUIRED) A repository name |
|
35 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
36 | + * timeout: time, // Explicit operation timeout |
|
37 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
38 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
39 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
40 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
41 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
42 | + * } $params |
|
43 | + * |
|
44 | + * @throws MissingParameterException if a required parameter is missing |
|
45 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
46 | + * @throws ClientResponseException if the status code of response is 4xx |
|
47 | + * @throws ServerResponseException if the status code of response is 5xx |
|
48 | + * |
|
49 | + * @return Elasticsearch|Promise |
|
50 | + */ |
|
51 | + public function cleanupRepository(array $params = []) |
|
52 | + { |
|
53 | + $this->checkRequiredParameters(['repository'], $params); |
|
54 | + $url = '/_snapshot/' . $this->encode($params['repository']) . '/_cleanup'; |
|
55 | + $method = 'POST'; |
|
56 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
57 | + $headers = ['Accept' => 'application/json']; |
|
58 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
59 | + } |
|
60 | + /** |
|
61 | + * Clones indices from one snapshot into another snapshot in the same repository. |
|
62 | + * |
|
63 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
64 | + * |
|
65 | + * @param array{ |
|
66 | + * repository: string, // (REQUIRED) A repository name |
|
67 | + * snapshot: string, // (REQUIRED) The name of the snapshot to clone from |
|
68 | + * target_snapshot: string, // (REQUIRED) The name of the cloned snapshot to create |
|
69 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
70 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
71 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
72 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
73 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
74 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
75 | + * body: array, // (REQUIRED) The snapshot clone definition |
|
76 | + * } $params |
|
77 | + * |
|
78 | + * @throws MissingParameterException if a required parameter is missing |
|
79 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
80 | + * @throws ClientResponseException if the status code of response is 4xx |
|
81 | + * @throws ServerResponseException if the status code of response is 5xx |
|
82 | + * |
|
83 | + * @return Elasticsearch|Promise |
|
84 | + */ |
|
85 | + public function clone(array $params = []) |
|
86 | + { |
|
87 | + $this->checkRequiredParameters(['repository', 'snapshot', 'target_snapshot', 'body'], $params); |
|
88 | + $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']) . '/_clone/' . $this->encode($params['target_snapshot']); |
|
89 | + $method = 'PUT'; |
|
90 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
91 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
92 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
93 | + } |
|
94 | + /** |
|
95 | + * Creates a snapshot in a repository. |
|
96 | + * |
|
97 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
98 | + * |
|
99 | + * @param array{ |
|
100 | + * repository: string, // (REQUIRED) A repository name |
|
101 | + * snapshot: string, // (REQUIRED) A snapshot name |
|
102 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
103 | + * wait_for_completion: boolean, // Should this request wait until the operation has completed before returning |
|
104 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
105 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
106 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
107 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
108 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
109 | + * body: array, // The snapshot definition |
|
110 | + * } $params |
|
111 | + * |
|
112 | + * @throws MissingParameterException if a required parameter is missing |
|
113 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
114 | + * @throws ClientResponseException if the status code of response is 4xx |
|
115 | + * @throws ServerResponseException if the status code of response is 5xx |
|
116 | + * |
|
117 | + * @return Elasticsearch|Promise |
|
118 | + */ |
|
119 | + public function create(array $params = []) |
|
120 | + { |
|
121 | + $this->checkRequiredParameters(['repository', 'snapshot'], $params); |
|
122 | + $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']); |
|
123 | + $method = 'PUT'; |
|
124 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'wait_for_completion', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
125 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
126 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
127 | + } |
|
128 | + /** |
|
129 | + * Creates a repository. |
|
130 | + * |
|
131 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
132 | + * |
|
133 | + * @param array{ |
|
134 | + * repository: string, // (REQUIRED) A repository name |
|
135 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
136 | + * timeout: time, // Explicit operation timeout |
|
137 | + * verify: boolean, // Whether to verify the repository after creation |
|
138 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
139 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
140 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
141 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
142 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
143 | + * body: array, // (REQUIRED) The repository definition |
|
144 | + * } $params |
|
145 | + * |
|
146 | + * @throws MissingParameterException if a required parameter is missing |
|
147 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
148 | + * @throws ClientResponseException if the status code of response is 4xx |
|
149 | + * @throws ServerResponseException if the status code of response is 5xx |
|
150 | + * |
|
151 | + * @return Elasticsearch|Promise |
|
152 | + */ |
|
153 | + public function createRepository(array $params = []) |
|
154 | + { |
|
155 | + $this->checkRequiredParameters(['repository', 'body'], $params); |
|
156 | + $url = '/_snapshot/' . $this->encode($params['repository']); |
|
157 | + $method = 'PUT'; |
|
158 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'verify', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
159 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
160 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
161 | + } |
|
162 | + /** |
|
163 | + * Deletes one or more snapshots. |
|
164 | + * |
|
165 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
166 | + * |
|
167 | + * @param array{ |
|
168 | + * repository: string, // (REQUIRED) A repository name |
|
169 | + * snapshot: list, // (REQUIRED) A comma-separated list of snapshot names |
|
170 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
171 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
172 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
173 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
174 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
175 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
176 | + * } $params |
|
177 | + * |
|
178 | + * @throws MissingParameterException if a required parameter is missing |
|
179 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
180 | + * @throws ClientResponseException if the status code of response is 4xx |
|
181 | + * @throws ServerResponseException if the status code of response is 5xx |
|
182 | + * |
|
183 | + * @return Elasticsearch|Promise |
|
184 | + */ |
|
185 | + public function delete(array $params = []) |
|
186 | + { |
|
187 | + $this->checkRequiredParameters(['repository', 'snapshot'], $params); |
|
188 | + $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']); |
|
189 | + $method = 'DELETE'; |
|
190 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
191 | + $headers = ['Accept' => 'application/json']; |
|
192 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
193 | + } |
|
194 | + /** |
|
195 | + * Deletes a repository. |
|
196 | + * |
|
197 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
198 | + * |
|
199 | + * @param array{ |
|
200 | + * repository: list, // (REQUIRED) Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported. |
|
201 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
202 | + * timeout: time, // Explicit operation timeout |
|
203 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
204 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
205 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
206 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
207 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
208 | + * } $params |
|
209 | + * |
|
210 | + * @throws MissingParameterException if a required parameter is missing |
|
211 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
212 | + * @throws ClientResponseException if the status code of response is 4xx |
|
213 | + * @throws ServerResponseException if the status code of response is 5xx |
|
214 | + * |
|
215 | + * @return Elasticsearch|Promise |
|
216 | + */ |
|
217 | + public function deleteRepository(array $params = []) |
|
218 | + { |
|
219 | + $this->checkRequiredParameters(['repository'], $params); |
|
220 | + $url = '/_snapshot/' . $this->encode($params['repository']); |
|
221 | + $method = 'DELETE'; |
|
222 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
223 | + $headers = ['Accept' => 'application/json']; |
|
224 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
225 | + } |
|
226 | + /** |
|
227 | + * Returns information about a snapshot. |
|
228 | + * |
|
229 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
230 | + * |
|
231 | + * @param array{ |
|
232 | + * repository: string, // (REQUIRED) A repository name |
|
233 | + * snapshot: list, // (REQUIRED) A comma-separated list of snapshot names |
|
234 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
235 | + * ignore_unavailable: boolean, // Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown |
|
236 | + * index_names: boolean, // Whether to include the name of each index in the snapshot. Defaults to true. |
|
237 | + * index_details: boolean, // Whether to include details of each index in the snapshot, if those details are available. Defaults to false. |
|
238 | + * include_repository: boolean, // Whether to include the repository name in the snapshot info. Defaults to true. |
|
239 | + * sort: enum, // Allows setting a sort order for the result. Defaults to start_time |
|
240 | + * size: integer, // Maximum number of snapshots to return. Defaults to 0 which means return all that match without limit. |
|
241 | + * order: enum, // Sort order |
|
242 | + * from_sort_value: string, // Value of the current sort column at which to start retrieval. |
|
243 | + * after: string, // Offset identifier to start pagination from as returned by the 'next' field in the response body. |
|
244 | + * offset: integer, // Numeric offset to start pagination based on the snapshots matching the request. Defaults to 0 |
|
245 | + * slm_policy_filter: string, // Filter snapshots by a comma-separated list of SLM policy names that snapshots belong to. Accepts wildcards. Use the special pattern '_none' to match snapshots without an SLM policy |
|
246 | + * verbose: boolean, // Whether to show verbose snapshot info or only show the basic info found in the repository index blob |
|
247 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
248 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
249 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
250 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
251 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
252 | + * } $params |
|
253 | + * |
|
254 | + * @throws MissingParameterException if a required parameter is missing |
|
255 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
256 | + * @throws ClientResponseException if the status code of response is 4xx |
|
257 | + * @throws ServerResponseException if the status code of response is 5xx |
|
258 | + * |
|
259 | + * @return Elasticsearch|Promise |
|
260 | + */ |
|
261 | + public function get(array $params = []) |
|
262 | + { |
|
263 | + $this->checkRequiredParameters(['repository', 'snapshot'], $params); |
|
264 | + $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']); |
|
265 | + $method = 'GET'; |
|
266 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'ignore_unavailable', 'index_names', 'index_details', 'include_repository', 'sort', 'size', 'order', 'from_sort_value', 'after', 'offset', 'slm_policy_filter', 'verbose', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
267 | + $headers = ['Accept' => 'application/json']; |
|
268 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
269 | + } |
|
270 | + /** |
|
271 | + * Returns information about a repository. |
|
272 | + * |
|
273 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
274 | + * |
|
275 | + * @param array{ |
|
276 | + * repository: list, // A comma-separated list of repository names |
|
277 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
278 | + * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
279 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
280 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
281 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
282 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
283 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
284 | + * } $params |
|
285 | + * |
|
286 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
287 | + * @throws ClientResponseException if the status code of response is 4xx |
|
288 | + * @throws ServerResponseException if the status code of response is 5xx |
|
289 | + * |
|
290 | + * @return Elasticsearch|Promise |
|
291 | + */ |
|
292 | + public function getRepository(array $params = []) |
|
293 | + { |
|
294 | + if (isset($params['repository'])) { |
|
295 | + $url = '/_snapshot/' . $this->encode($params['repository']); |
|
296 | + $method = 'GET'; |
|
297 | + } else { |
|
298 | + $url = '/_snapshot'; |
|
299 | + $method = 'GET'; |
|
300 | + } |
|
301 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
302 | + $headers = ['Accept' => 'application/json']; |
|
303 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
304 | + } |
|
305 | + /** |
|
306 | + * Analyzes a repository for correctness and performance |
|
307 | + * |
|
308 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
309 | + * |
|
310 | + * @param array{ |
|
311 | + * repository: string, // (REQUIRED) A repository name |
|
312 | + * blob_count: number, // Number of blobs to create during the test. Defaults to 100. |
|
313 | + * concurrency: number, // Number of operations to run concurrently during the test. Defaults to 10. |
|
314 | + * read_node_count: number, // Number of nodes on which to read a blob after writing. Defaults to 10. |
|
315 | + * early_read_node_count: number, // Number of nodes on which to perform an early read on a blob, i.e. before writing has completed. Early reads are rare actions so the 'rare_action_probability' parameter is also relevant. Defaults to 2. |
|
316 | + * seed: number, // Seed for the random number generator used to create the test workload. Defaults to a random value. |
|
317 | + * rare_action_probability: number, // Probability of taking a rare action such as an early read or an overwrite. Defaults to 0.02. |
|
318 | + * max_blob_size: string, // Maximum size of a blob to create during the test, e.g '1gb' or '100mb'. Defaults to '10mb'. |
|
319 | + * max_total_data_size: string, // Maximum total size of all blobs to create during the test, e.g '1tb' or '100gb'. Defaults to '1gb'. |
|
320 | + * timeout: time, // Explicit operation timeout. Defaults to '30s'. |
|
321 | + * detailed: boolean, // Whether to return detailed results or a summary. Defaults to 'false' so that only the summary is returned. |
|
322 | + * rarely_abort_writes: boolean, // Whether to rarely abort writes before they complete. Defaults to 'true'. |
|
323 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
324 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
325 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
326 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
327 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
328 | + * } $params |
|
329 | + * |
|
330 | + * @throws MissingParameterException if a required parameter is missing |
|
331 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
332 | + * @throws ClientResponseException if the status code of response is 4xx |
|
333 | + * @throws ServerResponseException if the status code of response is 5xx |
|
334 | + * |
|
335 | + * @return Elasticsearch|Promise |
|
336 | + */ |
|
337 | + public function repositoryAnalyze(array $params = []) |
|
338 | + { |
|
339 | + $this->checkRequiredParameters(['repository'], $params); |
|
340 | + $url = '/_snapshot/' . $this->encode($params['repository']) . '/_analyze'; |
|
341 | + $method = 'POST'; |
|
342 | + $url = $this->addQueryString($url, $params, ['blob_count', 'concurrency', 'read_node_count', 'early_read_node_count', 'seed', 'rare_action_probability', 'max_blob_size', 'max_total_data_size', 'timeout', 'detailed', 'rarely_abort_writes', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
343 | + $headers = ['Accept' => 'application/json']; |
|
344 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
345 | + } |
|
346 | + /** |
|
347 | + * Restores a snapshot. |
|
348 | + * |
|
349 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
350 | + * |
|
351 | + * @param array{ |
|
352 | + * repository: string, // (REQUIRED) A repository name |
|
353 | + * snapshot: string, // (REQUIRED) A snapshot name |
|
354 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
355 | + * wait_for_completion: boolean, // Should this request wait until the operation has completed before returning |
|
356 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
357 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
358 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
359 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
360 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
361 | + * body: array, // Details of what to restore |
|
362 | + * } $params |
|
363 | + * |
|
364 | + * @throws MissingParameterException if a required parameter is missing |
|
365 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
366 | + * @throws ClientResponseException if the status code of response is 4xx |
|
367 | + * @throws ServerResponseException if the status code of response is 5xx |
|
368 | + * |
|
369 | + * @return Elasticsearch|Promise |
|
370 | + */ |
|
371 | + public function restore(array $params = []) |
|
372 | + { |
|
373 | + $this->checkRequiredParameters(['repository', 'snapshot'], $params); |
|
374 | + $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']) . '/_restore'; |
|
375 | + $method = 'POST'; |
|
376 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'wait_for_completion', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
377 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
378 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
379 | + } |
|
380 | + /** |
|
381 | + * Returns information about the status of a snapshot. |
|
382 | + * |
|
383 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
384 | + * |
|
385 | + * @param array{ |
|
386 | + * repository: string, // A repository name |
|
387 | + * snapshot: list, // A comma-separated list of snapshot names |
|
388 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
389 | + * ignore_unavailable: boolean, // Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown |
|
390 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
391 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
392 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
393 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
394 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
395 | + * } $params |
|
396 | + * |
|
397 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
398 | + * @throws ClientResponseException if the status code of response is 4xx |
|
399 | + * @throws ServerResponseException if the status code of response is 5xx |
|
400 | + * |
|
401 | + * @return Elasticsearch|Promise |
|
402 | + */ |
|
403 | + public function status(array $params = []) |
|
404 | + { |
|
405 | + if (isset($params['repository']) && isset($params['snapshot'])) { |
|
406 | + $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']) . '/_status'; |
|
407 | + $method = 'GET'; |
|
408 | + } elseif (isset($params['repository'])) { |
|
409 | + $url = '/_snapshot/' . $this->encode($params['repository']) . '/_status'; |
|
410 | + $method = 'GET'; |
|
411 | + } else { |
|
412 | + $url = '/_snapshot/_status'; |
|
413 | + $method = 'GET'; |
|
414 | + } |
|
415 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'ignore_unavailable', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
416 | + $headers = ['Accept' => 'application/json']; |
|
417 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
418 | + } |
|
419 | + /** |
|
420 | + * Verifies a repository. |
|
421 | + * |
|
422 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html |
|
423 | + * |
|
424 | + * @param array{ |
|
425 | + * repository: string, // (REQUIRED) A repository name |
|
426 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
427 | + * timeout: time, // Explicit operation timeout |
|
428 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
429 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
430 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
431 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
432 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
433 | + * } $params |
|
434 | + * |
|
435 | + * @throws MissingParameterException if a required parameter is missing |
|
436 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
437 | + * @throws ClientResponseException if the status code of response is 4xx |
|
438 | + * @throws ServerResponseException if the status code of response is 5xx |
|
439 | + * |
|
440 | + * @return Elasticsearch|Promise |
|
441 | + */ |
|
442 | + public function verifyRepository(array $params = []) |
|
443 | + { |
|
444 | + $this->checkRequiredParameters(['repository'], $params); |
|
445 | + $url = '/_snapshot/' . $this->encode($params['repository']) . '/_verify'; |
|
446 | + $method = 'POST'; |
|
447 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
448 | + $headers = ['Accept' => 'application/json']; |
|
449 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
450 | + } |
|
451 | 451 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Endpoints; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Exception\ClientResponseException; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function cleanupRepository(array $params = []) |
52 | 52 | { |
53 | 53 | $this->checkRequiredParameters(['repository'], $params); |
54 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/_cleanup'; |
|
54 | + $url = '/_snapshot/'.$this->encode($params['repository']).'/_cleanup'; |
|
55 | 55 | $method = 'POST'; |
56 | 56 | $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
57 | 57 | $headers = ['Accept' => 'application/json']; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | public function clone(array $params = []) |
86 | 86 | { |
87 | 87 | $this->checkRequiredParameters(['repository', 'snapshot', 'target_snapshot', 'body'], $params); |
88 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']) . '/_clone/' . $this->encode($params['target_snapshot']); |
|
88 | + $url = '/_snapshot/'.$this->encode($params['repository']).'/'.$this->encode($params['snapshot']).'/_clone/'.$this->encode($params['target_snapshot']); |
|
89 | 89 | $method = 'PUT'; |
90 | 90 | $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
91 | 91 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function create(array $params = []) |
120 | 120 | { |
121 | 121 | $this->checkRequiredParameters(['repository', 'snapshot'], $params); |
122 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']); |
|
122 | + $url = '/_snapshot/'.$this->encode($params['repository']).'/'.$this->encode($params['snapshot']); |
|
123 | 123 | $method = 'PUT'; |
124 | 124 | $url = $this->addQueryString($url, $params, ['master_timeout', 'wait_for_completion', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
125 | 125 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | public function createRepository(array $params = []) |
154 | 154 | { |
155 | 155 | $this->checkRequiredParameters(['repository', 'body'], $params); |
156 | - $url = '/_snapshot/' . $this->encode($params['repository']); |
|
156 | + $url = '/_snapshot/'.$this->encode($params['repository']); |
|
157 | 157 | $method = 'PUT'; |
158 | 158 | $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'verify', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
159 | 159 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | public function delete(array $params = []) |
186 | 186 | { |
187 | 187 | $this->checkRequiredParameters(['repository', 'snapshot'], $params); |
188 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']); |
|
188 | + $url = '/_snapshot/'.$this->encode($params['repository']).'/'.$this->encode($params['snapshot']); |
|
189 | 189 | $method = 'DELETE'; |
190 | 190 | $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
191 | 191 | $headers = ['Accept' => 'application/json']; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | public function deleteRepository(array $params = []) |
218 | 218 | { |
219 | 219 | $this->checkRequiredParameters(['repository'], $params); |
220 | - $url = '/_snapshot/' . $this->encode($params['repository']); |
|
220 | + $url = '/_snapshot/'.$this->encode($params['repository']); |
|
221 | 221 | $method = 'DELETE'; |
222 | 222 | $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
223 | 223 | $headers = ['Accept' => 'application/json']; |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | public function get(array $params = []) |
262 | 262 | { |
263 | 263 | $this->checkRequiredParameters(['repository', 'snapshot'], $params); |
264 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']); |
|
264 | + $url = '/_snapshot/'.$this->encode($params['repository']).'/'.$this->encode($params['snapshot']); |
|
265 | 265 | $method = 'GET'; |
266 | 266 | $url = $this->addQueryString($url, $params, ['master_timeout', 'ignore_unavailable', 'index_names', 'index_details', 'include_repository', 'sort', 'size', 'order', 'from_sort_value', 'after', 'offset', 'slm_policy_filter', 'verbose', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
267 | 267 | $headers = ['Accept' => 'application/json']; |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | public function getRepository(array $params = []) |
293 | 293 | { |
294 | 294 | if (isset($params['repository'])) { |
295 | - $url = '/_snapshot/' . $this->encode($params['repository']); |
|
295 | + $url = '/_snapshot/'.$this->encode($params['repository']); |
|
296 | 296 | $method = 'GET'; |
297 | 297 | } else { |
298 | 298 | $url = '/_snapshot'; |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | public function repositoryAnalyze(array $params = []) |
338 | 338 | { |
339 | 339 | $this->checkRequiredParameters(['repository'], $params); |
340 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/_analyze'; |
|
340 | + $url = '/_snapshot/'.$this->encode($params['repository']).'/_analyze'; |
|
341 | 341 | $method = 'POST'; |
342 | 342 | $url = $this->addQueryString($url, $params, ['blob_count', 'concurrency', 'read_node_count', 'early_read_node_count', 'seed', 'rare_action_probability', 'max_blob_size', 'max_total_data_size', 'timeout', 'detailed', 'rarely_abort_writes', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
343 | 343 | $headers = ['Accept' => 'application/json']; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | public function restore(array $params = []) |
372 | 372 | { |
373 | 373 | $this->checkRequiredParameters(['repository', 'snapshot'], $params); |
374 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']) . '/_restore'; |
|
374 | + $url = '/_snapshot/'.$this->encode($params['repository']).'/'.$this->encode($params['snapshot']).'/_restore'; |
|
375 | 375 | $method = 'POST'; |
376 | 376 | $url = $this->addQueryString($url, $params, ['master_timeout', 'wait_for_completion', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
377 | 377 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -403,10 +403,10 @@ discard block |
||
403 | 403 | public function status(array $params = []) |
404 | 404 | { |
405 | 405 | if (isset($params['repository']) && isset($params['snapshot'])) { |
406 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']) . '/_status'; |
|
406 | + $url = '/_snapshot/'.$this->encode($params['repository']).'/'.$this->encode($params['snapshot']).'/_status'; |
|
407 | 407 | $method = 'GET'; |
408 | 408 | } elseif (isset($params['repository'])) { |
409 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/_status'; |
|
409 | + $url = '/_snapshot/'.$this->encode($params['repository']).'/_status'; |
|
410 | 410 | $method = 'GET'; |
411 | 411 | } else { |
412 | 412 | $url = '/_snapshot/_status'; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | public function verifyRepository(array $params = []) |
443 | 443 | { |
444 | 444 | $this->checkRequiredParameters(['repository'], $params); |
445 | - $url = '/_snapshot/' . $this->encode($params['repository']) . '/_verify'; |
|
445 | + $url = '/_snapshot/'.$this->encode($params['repository']).'/_verify'; |
|
446 | 446 | $method = 'POST'; |
447 | 447 | $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
448 | 448 | $headers = ['Accept' => 'application/json']; |
@@ -23,8 +23,7 @@ |
||
23 | 23 | /** |
24 | 24 | * @generated This file is generated, please do not edit |
25 | 25 | */ |
26 | -class Snapshot extends AbstractEndpoint |
|
27 | -{ |
|
26 | +class Snapshot extends AbstractEndpoint { |
|
28 | 27 | /** |
29 | 28 | * Removes stale data from repository. |
30 | 29 | * |