PHP code example of mapado / elastica-query-bundle
1. Go to this page and download the library: Download mapado/elastica-query-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mapado / elastica-query-bundle example snippets
$client = $this->get('mapado.elastica.client.client_name'); // return a \Elastica\Client object
$index = $this->get('mapado.elastica.index.twitter'); // return a \Elastica\Index object
$type = $this->get('mapado.elastica.type.twitter.tweet'); // return a \Elastica\Type object
$documentManager = $this->get('mapado.elastica.document_manager.tweety'); // return a \Mapado\ElasticaQueryBundle\DocumentManager
$queryBuilder = $documentManager->createQueryBuilder();
$queryBuilder->addQuery(new \Elastica\Query\Term(['field' => 'value']))
->addFilter(new \Elastica\Filter\Term(['field' => 'value']));
->setMaxResults(20)
->setFirstResults(40);
$tweets = $queryBuilder->getResult(); // return a \Mapado\Elastica\Model\SearchResult