# Response Time Report

**URL:** <https://discuss.elastic.co/t/response-time-report/284806>\
**Category:** Kibana\
**Created:** [September 22, 2021, 6:18am UTC](https://discuss.elastic.co/t/response-time-report/284806 "2021-09-22T06:18:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chivas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chivas/32/58800_2.png) [@chivas](https://discuss.elastic.co/u/chivas)\
**Post date:** [September 22, 2021, 6:18am UTC](https://discuss.elastic.co/t/response-time-report/284806/1 "2021-09-22T06:18:34Z")

</div>

Hello,  
I need to generate a Visual/Report which shows the response time taken by an API/function call to my webserver from the client. Below is my data in Elasticsearch.

 ![Firefox_Screenshot_2021-09-22T06-10-10.138Z](https://us1.discourse-cdn.com/elastic/original/3X/8/5/85a81abecbf3adc2896e9b99fdef3f4e740930c3.png)

So my question is what is the best way to generate a report which shows the time between the REQ and RES for the same id, for a function/API call. My requirement is that I should be able to see visually if the Response time for a particular API call (function in the snapshot) is increasing, or staying the same?  
Can I do it with existing data structure? Any pointers will also be helpful.

Thanks!

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [September 22, 2021, 6:02pm UTC](https://discuss.elastic.co/t/response-time-report/284806/2 "2021-09-22T18:02:29Z")

</div>

> Can I do it with existing data structure? Any pointers will also be helpful.

You will need both the request and response times in the same document. One way to do this is to set up an [enrichment processor](https://www.elastic.co/guide/en/elasticsearch/reference/7.15/ingest-enriching-data.html#enrich-policy) to add the request to a response document.

---

<div class="post-metadata">

**Author:** ![chivas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chivas/32/58800_2.png) [@chivas](https://discuss.elastic.co/u/chivas)\
**Post date:** [September 23, 2021, 2:05pm UTC](https://discuss.elastic.co/t/response-time-report/284806/3 "2021-09-23T14:05:08Z")

</div>

Thanks for your response, I managed to get the Request and Response time in same document, not my document looks like below

 ![Firefox_Screenshot_2021-09-23T14-02-59.887Z](https://us1.discourse-cdn.com/elastic/original/3X/1/1/11e0157d9ce7ba05600546378b496b2772810592.png)

Time is the Response time and reqTime is the time of Request for this particular response.

So, now my question is should I subtract these two timings in logstash or use Kibana Painful Script variable?

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [September 23, 2021, 2:38pm UTC](https://discuss.elastic.co/t/response-time-report/284806/4 "2021-09-23T14:38:42Z")

</div>

scripted fields and runtime fields have a performance penalty since they are calculated at read time. If possible, it's best to add fields at ingest time, so if you can, it makes sense to add to logstash configuration.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 21, 2021, 2:38pm UTC](https://discuss.elastic.co/t/response-time-report/284806/5 "2021-10-21T14:38:48Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
