我试图在给定的时间内找到特定模式的出现。我没有得到Query 1
具有时间参数的那种模式的计数,但可以使用Query 2
. 如果有任何问题,你能请Query 1
。
GET/_count?pretty{
"query": {
"bool": {
"must": {
"query_string": {
"query": "Stopping PSB: start the yum-updateonboot deamon..."
}
},
"filter": {
"range": {
"@timestamp": {
"gt": "now-1d"
}
}
}
}
}
}' Result: { **"count" : 0,** "_shards" : { "total" : 2287, "successful" : 2287, "skipped" : 0, "failed" : 0 }
查询 2:
GET/_count?pretty{
"query": {
"bool": {
"must": {
"query_string": {
"query": "Stopping PSB: start the yum-updateonboot deamon..."
}
}
}
}
}Result: {
"count": 280483,
"_shards": {
"total": 2287,
"successful": 2287,
"skipped": 0,
"failed": 0
}
使用任一小时:
{
"range":{
"@timestamp":{
"gt":"now-24h"
}
}
}
或gte
代替gt
:
{
"range":{
"@timestamp":{
"gte":"now-1d"
}
}
}
更新
使用timestamp
代替@timestamp
{
"query": {
"bool": {
"must": {
"query_string": {
"query": "Stopping PSB: start the yum-updateonboot deamon..."
}
},
"filter": {
"range": {
"timestamp": {
"gt": "now-1d"
}
}
}
}
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句