1 | <?php |
||
9 | class ElasticsearchCollection extends Collection |
||
10 | { |
||
11 | /** |
||
12 | * Elasticsearch response. |
||
13 | * |
||
14 | * @var array |
||
15 | */ |
||
16 | protected $response = []; |
||
17 | |||
18 | /** |
||
19 | * Put response. |
||
20 | * |
||
21 | * @param array $response |
||
22 | */ |
||
23 | 11 | public function response(array $response) |
|
24 | { |
||
25 | 11 | unset($response['hits']['hits']); |
|
26 | 11 | $this->response = $response; |
|
27 | 11 | } |
|
28 | |||
29 | /** |
||
30 | * @return int |
||
31 | */ |
||
32 | public function getTook() |
||
36 | |||
37 | /** |
||
38 | * @return bool |
||
39 | */ |
||
40 | public function isTimedOut() |
||
44 | |||
45 | /** |
||
46 | * @return int |
||
47 | */ |
||
48 | 4 | public function getTotal() |
|
49 | { |
||
50 | 4 | return $this->response['hits']['total']; |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return int |
||
55 | */ |
||
56 | public function getMaxScore() |
||
60 | |||
61 | /** |
||
62 | * @return array |
||
63 | */ |
||
64 | public function getShards() |
||
68 | |||
69 | /** |
||
70 | * @param string $name |
||
71 | * @return Bucket[] |
||
72 | */ |
||
73 | 1 | public function getAggregation($name) |
|
82 | } |
||
83 |