1. Go to this page and download the library: Download itvisionsy/es-orm 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/ */
itvisionsy / es-orm example snippets
$result = TypeQuery::builder()
->where('key1','some value')
->where('key2',$intValue,'>')
->where('key3','value','!=')
->where('key4', ['value1','value2'])
->execute();
//$result is a \ItvisionSy\EsMapper\Result instance
//init a builder object
$builder = \ItvisionSy\EsMapper\QueryBuilder::make();
//build the query using different methods
$query = $builder
->where('key1','some value') //term clause
->where('key2',$intValue,'>') //range clause
->where('key3','value','!=') //must_not term clause
->where('key4', ['value1','value2']) //terms clause
->where('email', '@hotmail.com', '*=') //wildcard search for all @hotmail.com emails
->sort('key1','asc') //first sort option
->sort('key2',['order'=>'asc','mode'=>'avg']) //second sort option
->from(20)->size(20) //results from 20 to 39
->toArray();
//modify the query as you need
$query['aggs']=['company'=>['terms'=>['field'=>'company']]];
//then execute it against a type query
$result = TypeQuery::query($query);
//$result is a \ItvisionSy\EsMapper\Result instance
\
|
+-- TestsIndexQuery (TestsIndexQuery.php) Main index query class.
| | Maps results to \Models\ namespace.
| |
| +-- \FooTypeQuery (FooTypeQuery.php) Type index query class.
| |
| +-- \BarTypeQuery (BarTypeQuery.php) Type index query class.
|
|-- Models\
|
+-- Foo (FooMode.php) Foo model class
|
+-- Bar (BarModel.php) Bar model class
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.