コード例 #1
0
 /**
  * Build and execute the query.
  *
  * @return AbstractResultParser
  */
 public function run()
 {
     $query = $this->buildQuery();
     // Execute the query.
     $rawResults = $this->searcher->getClient()->search($query);
     // Pass response to the class that will do something with it.
     $resultParser = $this->getResultParser();
     $resultParser->setRawResults($rawResults);
     return $resultParser;
 }
コード例 #2
0
<?php

require '../tests/bootstrap.php';
use ElasticSearcher\Environment;
use ElasticSearcher\ElasticSearcher;
$env = new Environment(['hosts' => [ELASTICSEARCH_HOST]]);
$searcher = new ElasticSearcher($env);
// Register indexes.
$moviesIndex = new MoviesIndex();
$searcher->indicesManager()->register($moviesIndex);