Skip to content

Latest commit

 

History

History
97 lines (68 loc) · 2.67 KB

README.md

File metadata and controls

97 lines (68 loc) · 2.67 KB

PHPinnacle Elastics

Latest Version on Packagist Software License Coverage Status Quality Score Total Downloads

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.