微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

用于 Elasticsearch 查询的查询 DSL Builder

用于 Elasticsearch 查询查询 DSL Builder

Install

composer require whereof/elastic-builder

//需要自行安装 https://github.com/elastic/elasticsearch-PHP
composer require elasticsearch/elasticsearch version 

elasticsearch Version Requirement


Version 7.0 of this library requires at least PHP version 7.1. In addition, it requires the native JSON extension to be
version 1.3.7 or higher.

Elasticsearch-PHP BranchPHP Version
7.0> = 7.1.0
6.0> = 7.0.0
5.0> = 5.6.6
2.0> = 5.4.0
0.4, 1.0> = 5.3.9

Examples

$host   = [
    "127.0.0.1:9200",
];
$client = ClientBuilder::create()->setHosts($host)->setSSLVerification(false)->build();
$build  = Elastic::getInstance($client)->index('table');

// select id,name form table where (name="whereof" or title="whereof") and password="whereof" and status BETWEEN 1 AND 2 order by id desc 
$rest    = $build->field(['id', 'name'])->where('name|title', 'whereof')->where('password', "whereof")->whereBetween('status', 1, 2)->order('id', 'desc')->search();
更多examples可以查看 https://github.com/whereof/el...

About Me

https://github.com/whereof/wh...

copyright

elastic-builder © wangzhiqiang 2022

License

MIT 开源许可

elasticsearch

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐