how to calculate average query and fetch time on my elasticsearch server. http://mysearver.com:9200/_stats gives me query_time and fetch_time. But these values continue to increase with every search. I need avg request time and query fetch time and plot on a graph.
I tried query_time / query_total, this value also increases by each query, and then stays on that after the query is completed.
This is what I have tried so far
url = 'http://localhost:9200/_stats'
raw_data = urllib2.urlopen(url)
data = json.loads(raw_data.readline())
QueryTime = data['_all']['total']['search']['query_time_in_millis']
QueryTotal = data['_all']['total']['search']['query_total']
AvgQueryTime = QueryTime/flaot(QueryTotal)
source
share