phpinnacle / elastics
PHPinnacle ElasticSearch Query Builder
dev-master / 1.0.x-dev
2018-03-27 16:00 UTC
Requires
- php: ^7.0
Requires (Dev)
- phpunit/phpunit: ^6.0
- squizlabs/php_codesniffer: ^2.3
This package is auto-updated.
Last update: 2024-10-27 21:02:28 UTC
README
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.
Install
Via Composer
$ composer require phpinnacle/elastics
Basic Usage
<?php use PHPinnacle\Elastics\Search; use PHPinnacle\Elastics\Query; require __DIR__ . '/vendor/autoload.php'; $query = new Query\Boolean(); $query ->must(new Query\Match('name', 'Alex')) ->mustNot( new Query\Term('gender', 'male'), new Query\Terms('eye_color', ['blue', 'green']) ) ->filter(new Query\Range('age', 21)) ; $search = Search::match($query); $search ->order('name', 'asc') ->limit(50) ; $client = curl_init('127.0.0.1:9200/users/_search?pretty'); curl_setopt_array($client, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => (string) $search, CURLOPT_HTTPHEADER => ['Content-Type: application/json'], ]); $result = curl_exec($client); echo $result;
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email dev@phpinnacle.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.