1 | <?php |
||
12 | class Index |
||
13 | { |
||
14 | /** |
||
15 | * The actual index name used for querying elasticsearch. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | private $name; |
||
20 | |||
21 | /** |
||
22 | * @var Client |
||
23 | */ |
||
24 | private $client; |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | private $settings; |
||
30 | |||
31 | /** |
||
32 | * @var Type[] |
||
33 | */ |
||
34 | private $types = []; |
||
35 | |||
36 | /** |
||
37 | * Internal index id. |
||
38 | * Used for naming services and internal identification. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | private $id; |
||
43 | |||
44 | /** |
||
45 | * @param string $id Internal index name. |
||
46 | * @param string $name |
||
47 | * @param Client $client |
||
48 | * @param array $settings |
||
49 | * @param array $types |
||
50 | */ |
||
51 | public function __construct($id, $name = null, Client $client, array $settings, array $types) |
||
60 | |||
61 | /** |
||
62 | * @param array $types |
||
63 | */ |
||
64 | protected function buildTypes(array $types) |
||
77 | |||
78 | /** |
||
79 | * @return Client |
||
80 | */ |
||
81 | public function getClient() |
||
85 | |||
86 | /** |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getName() |
||
93 | |||
94 | /** |
||
95 | * @return string |
||
96 | */ |
||
97 | public function getId() |
||
101 | |||
102 | /** |
||
103 | * @return bool |
||
104 | */ |
||
105 | public function isAliased() |
||
109 | |||
110 | /** |
||
111 | * Checks if the index exists in ES. |
||
112 | * |
||
113 | * @return bool |
||
114 | */ |
||
115 | public function exists() |
||
119 | |||
120 | /** |
||
121 | * Deletes the index. |
||
122 | */ |
||
123 | public function delete() |
||
127 | |||
128 | /** |
||
129 | * Resets the index. |
||
130 | */ |
||
131 | public function reset() |
||
139 | |||
140 | /** |
||
141 | * Creates the index in ES. |
||
142 | */ |
||
143 | public function create() |
||
161 | |||
162 | /** |
||
163 | * @return array |
||
164 | */ |
||
165 | public function getMappings() |
||
177 | |||
178 | /** |
||
179 | * @param string $name |
||
180 | * @return bool |
||
181 | */ |
||
182 | public function hasType($name) |
||
186 | |||
187 | /** |
||
188 | * @param string $name |
||
189 | * @return Type |
||
190 | */ |
||
191 | public function getType($name) |
||
199 | |||
200 | /** |
||
201 | * @return Type[] |
||
202 | */ |
||
203 | public function getTypes() |
||
207 | |||
208 | /** |
||
209 | * @param string $type |
||
210 | * @param Document $document |
||
211 | */ |
||
212 | public function putDocument($type, Document $document) |
||
226 | |||
227 | /** |
||
228 | * @param string $type |
||
229 | * @param string|int $id |
||
230 | * @return bool Returns false if document didn't exist. |
||
231 | */ |
||
232 | public function deleteDocument($type, $id) |
||
247 | |||
248 | /** |
||
249 | * @param string $type |
||
250 | * @param array $documents |
||
251 | */ |
||
252 | public function putDocuments($type, array $documents) |
||
258 | |||
259 | /** |
||
260 | * @param string $type |
||
261 | * @param array $ids |
||
262 | */ |
||
263 | public function deleteDocuments($type, array $ids) |
||
269 | |||
270 | /** |
||
271 | * @param array|string $body |
||
272 | * @param array $options |
||
273 | * @param string $type |
||
274 | * @return array |
||
275 | */ |
||
276 | protected function buildParams($body, array $options, $type = null) |
||
289 | |||
290 | /** |
||
291 | * @param array|string $query Array that will be serialized or raw JSON. |
||
292 | * @param array $options |
||
293 | * @param string $type |
||
294 | * @return SearchResults |
||
295 | */ |
||
296 | public function search($query, array $options = [], $type = null) |
||
302 | |||
303 | /** |
||
304 | * @param array|string $query Array that will be serialized or raw JSON. |
||
305 | * @param array $options |
||
306 | * @param string $type |
||
307 | * @return int|null |
||
308 | */ |
||
309 | public function count($query, array $options = [], $type = null) |
||
317 | |||
318 | /** |
||
319 | * @param array|string $query |
||
320 | * @param array $options |
||
321 | * @param string $type |
||
322 | */ |
||
323 | public function deleteByQuery($query, array $options = [], $type) |
||
329 | } |
||
330 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: