phpfluent / elastic-query-builder
A fluent query builder for Elastic Search.
Installs: 24 561
Dependents: 0
Suggesters: 0
Security: 0
Stars: 25
Watchers: 3
Forks: 5
Open Issues: 3
Requires (Dev)
- phpunit/phpunit: 3.7.x-dev
This package is auto-updated.
Last update: 2024-10-27 02:16:08 UTC
README
A fluent query builder for Elastic Search.
Installation
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.
Usage
$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"}}]}}}}