# Visualization based on two queries

**URL:** <https://discuss.elastic.co/t/visualization-based-on-two-queries/167131>\
**Category:** Kibana\
**Created:** [February 5, 2019, 1:32pm UTC](https://discuss.elastic.co/t/visualization-based-on-two-queries/167131 "2019-02-05T13:32:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![The](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@The](https://discuss.elastic.co/u/The)\
**Post date:** [February 5, 2019, 1:32pm UTC](https://discuss.elastic.co/t/visualization-based-on-two-queries/167131/1 "2019-02-05T13:32:39Z")

</div>

In my index I have entries like:  
entry 1:  
id: A, quantity: 70  
entry 2:  
id: A, cost: 23

entry 3:  
id: B, quantity: 50  
entry 4:  
id: B, cost: 24

Is there a way to make a cost vs quantity plot, where corresponding quantity and cost are linked by common ID? I don't need to do this directly in the Kibana. Could be some logstash/elastic/filebeat processing. I just couldn't find a solution.

---

<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:** [February 5, 2019, 8:25pm UTC](https://discuss.elastic.co/t/visualization-based-on-two-queries/167131/2 "2019-02-05T20:25:52Z")

</div>

This would best be solved external to Kibana. I would recommend writting a process in your favorite coding language that combines documents as needed and then inserts those into a new index.

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [February 5, 2019, 8:45pm UTC](https://discuss.elastic.co/t/visualization-based-on-two-queries/167131/3 "2019-02-05T20:45:19Z")

</div>

Nathan,  
how is it possible to have duplicate id in index? I thought ID is unique field in index

if I have entry like following then it is easy.

id:A, quantity:70, cost:23  
id:B, quantity:50,cost:24

---

<div class="post-metadata">

**Author:** ![The](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@The](https://discuss.elastic.co/u/The)\
**Post date:** [February 6, 2019, 8:21am UTC](https://discuss.elastic.co/t/visualization-based-on-two-queries/167131/4 "2019-02-06T08:21:02Z")

</div>

ID in this context is a Device ID and I have two processes requesting different data from the machine. So the first process asks device A for quantity and the second for cost. I guess it should be redesigned if there is no simple mechanism to handle it.

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [February 6, 2019, 2:26pm UTC](https://discuss.elastic.co/t/visualization-based-on-two-queries/167131/5 "2019-02-06T14:26:24Z")

</div>

if you can combine this from linux system level it will work and then it will be easy solution for you.

for example you run a linux bash script on host1, collect info from deviceA and B and combine them

Create a csv file and read that.  
you csv file should look like this  
A,70,23  
B,50,24

and you use csv input,  
filter {  
csv {  
separator =\> ","  
columns =\> ["device", "quantity","cost"]  
}

and that will give you desire output

---

<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 6, 2019, 2:26pm UTC](https://discuss.elastic.co/t/visualization-based-on-two-queries/167131/6 "2019-03-06T14:26:27Z")

</div>

Closed on March 6, 2019, 2:26pm UTC

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