Horde_ElasticSearch_Type::count PHP Method

count() public method

curl -X GET {SERVER}/{INDEX}/{TYPE}/_count -d {matchAll:{}}
public count ( )
    public function count()
    {
        return $this->_index->count($this->_type);
    }

Usage Example

Example #1
0
<?php

/**
 * Basic example for counting an ElasticSearch type
 *
 * Copyright 2011-2016 Horde LLC (http://www.horde.org/)
 *
 * @author   Chuck Hagenbuch <*****@*****.**>
 * @license  http://www.horde.org/licenses/bsd BSD
 * @category Horde
 * @package  ElasticSearch
 */
require 'Horde/Autoloader/Default.php';
$client = new Horde_ElasticSearch_Client('http://localhost:9200/', new Horde_Http_Client());
$twitter = new Horde_ElasticSearch_Index('twitter', $client);
$tweet = new Horde_ElasticSearch_Type('tweet', $twitter);
var_dump($tweet->count());