phpfluent/elastic-query-builder

A fluent query builder for Elastic Search.

1.0 2013-02-24 21:00 UTC

This package is auto-updated.

Last update: 2024-10-27 02:16:08 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version Total Downloads License

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"}}]}}}}