单IP查询
GET /logstash-nginx-*/_search
{
"query": {
"match": {
"client_ip.keyword": {
"query": "ip",
"type": "phrase"
}
}
}
}
查询ip和时间
GET /logstash-nginx-*/_search
{
"query": {
"bool":{
"must":[
{
"term": {
"client_ip.keyword": {
"value": "ip"
}
}
}
],
"filter": {
"range": {
"@timestamp": {
"gte": "2021-11-04T01:10:38.941Z",
"lte": "2021-11-04T01:13:27.335Z"
}
}
}
}
}
}
查询时间
GET /logstash-nginx-*/_search
{
"query": {
"range": {
"@timestamp": {
"gte": "2021-11-08T10:10:00.000Z",
"lte": "2021-11-09T10:20:00.000Z"
}
}
}
}
查询并计数
GET /logstash-nginx-*/_count
{
"query": {
"bool":{
"must":[
{
"term": {
"client_ip.keyword": {
"value": "ip"
}
}
}
],
"filter": {
"range": {
"@timestamp": {
"gte": "2021-11-08T10:10:00.000Z",
"lte": "2021-11-09T10:20:00.000Z"
}
}
}
}
}
}
查询去重
GET /logstash-nginx-*/_search
{
"query": {
"range": {
"@timestamp": {
"gte": "2021-11-08T10:10:00.000Z",
"lte": "2021-11-09T10:20:00.000Z"
}
}
},
"collapse": {
"field": "client_ip.keyword"
}
}