diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2016-11-11 21:13:56 +0100 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2016-11-11 21:13:56 +0100 |
| commit | cb577b3170e2d6e5c44aa29c37ab5d9751a66636 (patch) | |
| tree | 0d733a20274bda284bacc38b5b5c0f2b7af50b2c /src | |
| parent | 08fc60226f224de87d665aa7c55b6eaa9f66d768 (diff) | |
| download | phinde-cb577b3170e2d6e5c44aa29c37ab5d9751a66636.tar.gz phinde-cb577b3170e2d6e5c44aa29c37ab5d9751a66636.zip | |
improve status page
Diffstat (limited to 'src')
| -rw-r--r-- | src/phinde/Elasticsearch.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/phinde/Elasticsearch.php b/src/phinde/Elasticsearch.php index 069cf1f..6c90480 100644 --- a/src/phinde/Elasticsearch.php +++ b/src/phinde/Elasticsearch.php @@ -58,14 +58,18 @@ class Elasticsearch $r->send(); } - public function countDocuments() + public function getIndexStatus() { $r = new Elasticsearch_Request( - $this->baseUrl . 'document/_count', + $this->baseUrl . '_stats/docs,store', \HTTP_Request2::METHOD_GET ); $res = $r->send(); - return json_decode($res->getBody())->count; + $data = json_decode($res->getBody()); + return array( + 'documents' => $data->_all->total->docs->count, + 'size' => $data->_all->total->store->size_in_bytes, + ); } public function search($query, $filters, $site, $page, $perPage, $sort) |
