makinacorpus/elasticsearch-query
最新稳定版本:1.0.0-alpha3
Composer 安装命令:
composer require makinacorpus/elasticsearch-query
包简介
ElasticSearch/OpenSearch query builder
README 文档
README
This is very small query builder for ElasticSearch and OpenSearch, mostly opiniated around building bool queries.
A simple example:
// Create a query. $query = new RootBoolQuery(); // Add some filters. $query->must()->term('statut', 20); // Create a nested bool query, for nested objects. $nested = $query->must()->createNestedBool('statut_histo'); $nested->must()->term('statut_histo.statut', 23); // Set some query options. $query->size(100); $query->from(0); $query->trackTotalHits(); // Add some sorts. $query->sort('pushed_at'); $query->sort('created_at'); \json_encode($query->build(), JSON_PRETTY_PRINT);
Which will generated the follwoing JSON:
{
"query": {
"bool": {
"must": [
{
"term": {
"statut": 20
}
},
{
"nested": {
"path": "statut_histo",
"query": {
"bool": {
"must": {
"term": {
"statut_histo.statut": 23
}
}
}
}
}
}
]
}
},
"from": 0,
"size": 100,
"track_total_hits": true,
"sort": {
"pushed_at": {
"order": "asc"
},
"created_at": {
"order": "asc"
}
}
}
More documentation may come later.
统计信息
- 总下载量: 832
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2023-03-14