Download the PHP package crowdskout/es-search-builder without Composer
On this page you can find all versions of the php package crowdskout/es-search-builder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download crowdskout/es-search-builder
More information about crowdskout/es-search-builder
Files in crowdskout/es-search-builder
Package es-search-builder
Short Description Simplified Elasticsearch search api and results parsing for queries and aggregations
License MIT
Informations about the package es-search-builder
es-search-builder
This package provides simplified api and results parsing for Elasticsearch search queries and aggregations. It builds upon the official elasticsearch-php library here: https://github.com/elastic/elasticsearch-php.
Quick example - Query api
The query api provides simpler, less verbose query generation.
Quick example - Agg builder api
Aggregations can be nested with each other
Use the agg object to parse the results from Elasticsearch as well
Installation using Composer
If you don't have composer, please install it - https://getcomposer.org/
Add this package to your project from the terminal.
If your project is not already setup to autoload composer libraries, you can put this at the top of your boostrap file or script
Usage with elasticsearch-php
This library creates simple arrays to pass into the body portion of Elasticsearch search queries. You can pass the aggregation portion of the search result into the generateQuery function of the aggregation.
This library does not currently support all queries and aggregations
The current supported queries are here: https://github.com/crowdskout/es-search-builder/blob/master/src/Query.php.
The current supported aggregations are here: https://github.com/crowdskout/es-search-builder/blob/master/src/AggQuery.php.
If there's a query or or aggregation that you would like to see supported, please open an issue. You can also take a stab at writing it and open a pull request :).
Additional examples
You can see other, more complex examples of queries and aggregations in the tests/ directory. You can also see an example of a custom agg results generator in tests/AggGeneratorTest.php/