diff options
Diffstat (limited to 'src/phinde/Elasticsearch.php')
| -rw-r--r-- | src/phinde/Elasticsearch.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/phinde/Elasticsearch.php b/src/phinde/Elasticsearch.php index 9babfee..069cf1f 100644 --- a/src/phinde/Elasticsearch.php +++ b/src/phinde/Elasticsearch.php @@ -58,6 +58,16 @@ class Elasticsearch $r->send(); } + public function countDocuments() + { + $r = new Elasticsearch_Request( + $this->baseUrl . 'document/_count', + \HTTP_Request2::METHOD_GET + ); + $res = $r->send(); + return json_decode($res->getBody())->count; + } + public function search($query, $filters, $site, $page, $perPage, $sort) { if (preg_match_all('#nick:([^ ]*)#', $query, $matches)) { |
