ElasticSearch 精确查询统计
ElasticSearch 精确查询统计
match_phrase:短语匹配,不分词
GET logback-2022-08/_search
{
"size": 1, //显示1条记录
"query": {
"bool": {
"must": [
{
"match_phrase": {
"app": "xxx" //按app精确查询
}
},
{
"match_phrase": {
"data_source": "xxx" //按data_source精确查询
}
},
{
"match_phrase": {
"proc_status": "suc" //按proc_status精确查询
}
},
{
"match_phrase": {
"proc_phase": "collect" //按proc_phase精确查询
}
},
{
"range": {
"@timestamp": { //按时间范围查询
"gte": "2022-08-29T00:00:00.000+0800",
"lte": "2022-08-29T23:59:59.999+0800"
}
}
},
{
"range": {
"aggCount": { //按aggCount值的范围查询
"gte": 0,
"lte": 1000000
}
}
}
]
}
},
"sort": {
"@timestamp": "asc" //按@timestamp排序
},
"aggs": {
"sumAggCount": {
"sum": { //求和
"field": "aggCount" //统计aggCount
}
}
}
}
时间范围 指定format
{
"range": {
"@timestamp": {
"gte": "2022-08-28 16:00:00", //开始时间2022-08-29 00:00:00(设置的时间加8小时)
"lte": "2022-08-29 15:59:59", //结束时间2022-08-29 23:59:59(设置的时间加8小时)
"format": "yyyy-MM-dd HH:mm:ss"
}
}
}
分类:
大数据
标签:
ElasticSearch
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!