PHP code example of mitru / elasticsearch-bundle
1. Go to this page and download the library: Download mitru/elasticsearch-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/ */
mitru / elasticsearch-bundle example snippets
// config/bundles.php
return [
// ...
ONGR\ElasticsearchBundle\ONGRElasticsearchBundle::class => ['all' => true],
];
// src/Document/Product.php
namespace App\Document;
use ONGR\ElasticsearchBundle\Annotation as ES;
/**
* //alias and default parameters in the annotation are optional.
* @ES\Index(alias="products", default=true)
*/
class Product
{
/**
* @ES\Id()
*/
public $id;
/**
* @ES\Property(type="text", analyzer="eNgramAnalyzer")
*/
public $title;
/**
* @ES\Property(type="float")
*/
public $price;
}
bash
php composer.phar