Hi @cheiligers,
Thanks for your reply. You understood it correctly. Query should return results per hours for a day but that is no happening currently.
My version is 7.4.0.
I got below output i.e index not found after running your first GET query.
{
"error" : {
"root_cause" : [
{
"type" : "index_not_found_exception",
"reason" : "no such index [kibana_sample_data_logs]",
"resource.type" : "index_or_alias",
"resource.id" : "kibana_sample_data_logs",
"index_uuid" : "_na_",
"index" : "kibana_sample_data_logs"
}
],
"type" : "index_not_found_exception",
"reason" : "no such index [kibana_sample_data_logs]",
"resource.type" : "index_or_alias",
"resource.id" : "kibana_sample_data_logs",
"index_uuid" : "_na_",
"index" : "kibana_sample_data_logs"
},
"status" : 404
I have similar curl like you, i.e same calendar_interval
, same time stamp range.
GET access_server-2021*/_search?pretty
{
"aggs": {
"2": {
"date_histogram": {
"field": "@timestamp",
"calendar_interval": "1h",
"time_zone": "Asia/Calcutta",
"min_doc_count": 1
}
}
},
"size": 0,
"_source": {
"excludes": []
},
"stored_fields": [
"*"
],
"script_fields": {},
"docvalue_fields": [
{
"field": "@timestamp",
"format": "date_time"
}
],
"query": {
"bool": {
"must": [],
"filter": [
{
"bool": {
"should": [
{
"match_phrase": {
"log.file.path": "/opt/access/log/access.log"
}
}
],
"minimum_should_match": 1
}
},
{
"match_phrase": {
"Request_URI": {
"query": "\"/next2-isp/v1/\""
}
}
},
{
"range": {
"@timestamp": {
"format": "strict_date_optional_time",
"gt": "now-1d/d"
}
}
}
],
"should": [],
"must_not": []
}
}
}
which shows results as (i.e the same result what above visualisation showing)
.
.
},
"hits" : {
"total" : {
"value" : 82,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"2" : {
"buckets" : [
{
"key_as_string" : "2021-07-14T10:00:00.000+05:30",
"key" : 1626237000000,
"doc_count" : 82
}
above output is correct, as it matches with below output which we can retrieve directly from server
[root@ip-16-1-1-19 log]# cat access.log | grep '/next2-isp/v1/*' | wc -l
82
[root@ip-16-1-1-19 log]#
As I said this only gives me results for only that hour (i.e 10 AM here) which has logs in it but I want response showing all 24 hrs with their hits count.
Thanks,