# Create(Visualize) for below scenario

**URL:** <https://discuss.elastic.co/t/create-visualize-for-below-scenario/166440>\
**Category:** Kibana\
**Created:** [January 30, 2019, 10:38pm UTC](https://discuss.elastic.co/t/create-visualize-for-below-scenario/166440 "2019-01-30T22:38:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![manju134](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manju134/32/37791_2.png) [@manju134](https://discuss.elastic.co/u/manju134)\
**Post date:** [January 30, 2019, 10:38pm UTC](https://discuss.elastic.co/t/create-visualize-for-below-scenario/166440/1 "2019-01-30T22:38:36Z")

</div>

Hi,

I want create a visualize which displays the avg. duration for each client specific to a DB server.

ex : Database - 0065 it has approx 22 clients.  
ex column names - entity\_code , company\_name ,db and duration\_ms.

Please help on this.

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [January 31, 2019, 8:11pm UTC](https://discuss.elastic.co/t/create-visualize-for-below-scenario/166440/2 "2019-01-31T20:11:03Z")

</div>

If you are already logging the duration time, this should be pretty straightforward using the interface in Visualize.

Using the example fields you provided, the metric you want is the average of the `duration_ms` field. This will be at the top of the form on the left side, the aggregation you want is the average value, and the field is `duration_ms`.

Then you want to split that data into buckets to group the results by some dimensions. In this case, you want to split it up by `company_name` and `db` (I think, based on the field names you provided). The order of the buckets is important, as the data is split up in order. In your case, if you want to group the output by company (I think you may), then start with that one. Create a terms aggregation on the `company_name` field, and then create another terms aggregation ont he `db` field. If the resulting order is wrong, you can swap them in the interface by dragging the second one to the top.

I hope that explanation helps.

---

<div class="post-metadata">

**Author:** ![manju134](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manju134/32/37791_2.png) [@manju134](https://discuss.elastic.co/u/manju134)\
**Post date:** [February 1, 2019, 1:31pm UTC](https://discuss.elastic.co/t/create-visualize-for-below-scenario/166440/3 "2019-02-01T13:31:58Z")

</div>

@Joe_Fleming thank you so much.  
 ![Capture1](https://us1.discourse-cdn.com/elastic/original/3X/5/1/51bb6c1ea1bc59fd054a224af19f8d19177b06a6.jpeg)

I was able to pull the data which has columns like db,entity\_code, count and duration\_ms.  
but i am unable to add the company name to visualize as i am no result found  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/5/c55c6eb3e09e77c5f6ac57ad2a170c935f57a403.png)

Please help on this.🙂

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [February 11, 2019, 7:47pm UTC](https://discuss.elastic.co/t/create-visualize-for-below-scenario/166440/4 "2019-02-11T19:47:14Z")

</div>

Is the company name being stored in the document as well, or do you need to map it back from some other data (like `entiry_code` maybe)? If you need to map the name to some identifier, you'll have to do that enrichment as ingest time, since Elasticsearch is a document store and there's no way to do "joins" to other documents. What I mean by enrichment is that you'll need to do that ID to NAME lookup first, and add it to the document you write to Elasticsearch.

---

<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:** [March 11, 2019, 7:47pm UTC](https://discuss.elastic.co/t/create-visualize-for-below-scenario/166440/5 "2019-03-11T19:47:17Z")

</div>

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