This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Encapsulating ES query statements

v0.2 2017-09-14 08:29 UTC

This package is not auto-updated.

Last update: 2021-07-24 11:10:24 UTC


  • 1、composer require "xdm/elastic"
  • 2、调用方法:
use Xdm\Elastic\Elastic;

//construct set host
$elastic = new Elastic($host);

//set index

//set type

//add where conditon filter
$elastic->where(['key' => 'value']);

//add whereIn conditon filter
$elastic->whereIn('key', ['value1', 'value2']);

//add range condition filter
$elastic->range('key', ['gte' => 'value1', 'lte' => 'value2']);

//set size

//add Aggregation

//set order
$elastic->orderBy($field, 'desc');

//send query and get response
$response = $elastic->search();