1 | <?php |
||
25 | class Client extends BaseClient |
||
26 | { |
||
27 | /** |
||
28 | * Stores created indexes to avoid recreation. |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | private $indexCache = []; |
||
33 | |||
34 | /** |
||
35 | * Stores created index template to avoid recreation. |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | private $indexTemplateCache = array(); |
||
40 | |||
41 | /** |
||
42 | * Symfony's debugging Stopwatch. |
||
43 | * |
||
44 | * @var Stopwatch|null |
||
45 | */ |
||
46 | private $stopwatch; |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | 14 | public function request($path, $method = Request::GET, $data = [], array $query = [], $contentType = Request::DEFAULT_CONTENT_TYPE) |
|
72 | |||
73 | /** |
||
74 | * @param string $name |
||
75 | * |
||
76 | * @return Index|mixed |
||
77 | */ |
||
78 | 15 | public function getIndex($name) |
|
86 | |||
87 | 6 | public function getIndexTemplate($name) |
|
88 | { |
||
89 | 6 | if (isset($this->indexTemplateCache[$name])) { |
|
90 | 1 | return $this->indexTemplateCache[$name]; |
|
91 | } |
||
92 | |||
93 | 6 | return $this->indexTemplateCache[$name] = new IndexTemplate($this, $name); |
|
94 | } |
||
95 | |||
96 | /** |
||
97 | * Sets a stopwatch instance for debugging purposes. |
||
98 | * |
||
99 | * @param Stopwatch $stopwatch |
||
100 | */ |
||
101 | 17 | public function setStopwatch(Stopwatch $stopwatch = null) |
|
105 | |||
106 | /** |
||
107 | * Log the query if we have an instance of ElasticaLogger. |
||
108 | * |
||
109 | * @param string $path |
||
110 | * @param string $method |
||
111 | * @param array|string $data |
||
112 | * @param array $query |
||
113 | * @param int $queryTime |
||
114 | * @param int $engineMS |
||
115 | * @param int $itemCount |
||
116 | */ |
||
117 | 14 | private function logQuery($path, $method, $data, array $query, $queryTime, $engineMS = 0, $itemCount = 0) |
|
136 | } |
||
137 |