/**
  * Checks for number documents in all indices/types
  *
  * @param string $host
  * @param int $port
  * @param int $numberOfIndices
  * @return IndexTypeStats
  * @throws \Exception
  * @author Daniel Wendlandt
  */
 public function getDocCountByIndexType($host, $port = 9200, $numberOfIndices = 10000)
 {
     $this->checkServerInfo($host, $port);
     $queryClassName = $this->getQueryClass('DocsInIndexTypeQuery');
     /** @var QueryInterface $query */
     $query = new $queryClassName();
     /** @var SearchRequest $request */
     $request = $this->requestFactory->create('SearchRequest', $this->serverInfo->version, null, null, $this->getSerializer());
     $request->setBody($query->getBody(array('size' => $numberOfIndices)));
     $client = $this->getClient($host, $port);
     $response = $client->send($request);
     $indexTypeStats = new IndexTypeStats();
     foreach ($response->getData()['aggregations']['count_docs_in_index']['buckets'] as $indexBucket) {
         $index = new IndexTypeStats\Index();
         $index->setName($indexBucket['key']);
         $index->setDocsInIndex($indexBucket['doc_count']);
         foreach ($indexBucket['count_docs_in_types']['buckets'] as $typeBucket) {
             $type = new IndexTypeStats\Type();
             $type->setName($typeBucket['key']);
             $type->setDocsInType($typeBucket['doc_count']);
             $index->addType($type);
         }
         $indexTypeStats->addIndex($index);
     }
     return $indexTypeStats;
 }
 public function testGetSetDocsInType()
 {
     $docsInType = 555;
     $this->assertSame(0, $this->type->getDocsInType());
     $this->type->setDocsInType($docsInType);
     $this->assertSame($docsInType, $this->type->getDocsInType());
 }