Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

262 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

status ElasticSearchPredicate

is simple PHP API for ElasticSearch. It simulates Zend-Db predicates.

Please create issue while missing something or finding a bug

Install

composer: HERE OR

git clone https://github.com/myappin/ElasticSearchPredicate.git

Usage

Adding predicates addPredicate(PredicateInterface $predicate), andPredicate(PredicateInterface $predicate), orPredicate(PredicateInterface $predicate), and(PredicateInterface $predicate), or(PredicateInterface $predicate)

Basic predicates

$_client = new Client();
$_search = $_client->search();

$_search->limit(10)->order('_uid', 'asc')->predicate->Term('name', 'SomeName')->or->Term('price', 1000);

Nesting

$_client = new Client();
$_search = $_client->search();

$_search->limit(10)->order('_uid', 'asc')->predicate->nest()->Term('name', 'SomeName')->or->Term('name', 'SomeOtherName')->unnest()->Term('price', 1000);

Boosting

$_client = new Client();
$_search = $_client->search();

$_search->limit(10)->order('_uid', 'asc')->predicate->andPredicate((new Term('name', 'SomeName'))->boost(2))->or->Term('name', 'SomeOtherName');
//or
$_search->limit(10)->order('_uid', 'asc')->predicate->Term('name', 'SomeName', ['boost' => 2])->or->Term('name', 'SomeOtherName');

Nested objects, Ranges, Score Functions and more and more

About

ElasticSearch nested predicate generator

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages