elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.62k stars 8.22k forks source link

[Inspector] Request total time for terms agg + other filters is wrong for the first request #157833

Open dej611 opened 1 year ago

dej611 commented 1 year ago

Describe the bug:

The Inspector reports the request time on the right hand side of the panel and the ES query time in the description table below. When using a terms aggregation the first number can be quite high, in the order of multiples of the ES query time, when the Other filters request has been enabled. I've measured the request time and that does not adds up to the actual value displayed on the panel, rather it's a sum of both terms and other filters request time. Note that the other filters request has its own reporting as well.

Here's an example:

Screenshot 2023-05-16 at 09 24 26 Screenshot 2023-05-16 at 09 26 22

ES is taking 345ms to serve the request but the Kibana reported time is 10x higher: as it is possible to see from the logs on the right hand side the actual terms request is taking half of that time. The other filters value is pretty close to the one reported in the Inspector (some delta ms difference given from the different place I've put the measuring code). To obtain the reported Kibana time it is required to diff the very final response time from the other query from the initial request time of the terms one.

Expected behaviour

In the example above I think it would make more sense to report as terms request time half of that value (1751ms)

elasticmachine commented 1 year ago

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)