A fluent query builder for Elastic Search.
Package is available on Packagist, you can install it using Composer.
composer require phpfluent/elastic-query-builder
PHP 5.5+ or HHVM 3.5+ are required.
$builder = new Query();
$builder->query()->filtered()->query()->matchAll(new stdClass());
$builder->query()->filtered()->filter()->and(
[
new Term('my.nested.label', 'my_value'),
new Term('my_label', 'other_value'),
]
);
echo $builder.PHP_EOL;
The result of the code above is:
{"query":{"filtered":{"query":{"match_all":{}},"filter":{"and":[{"term":{"my.nested.label":"my_value"}},{"term":{"my_label":"other_value"}}]}}}}