# Vega Boxplot

**URL:** <https://discuss.elastic.co/t/vega-boxplot/123065>\
**Category:** Kibana\
**Created:** [March 8, 2018, 12:43pm UTC](https://discuss.elastic.co/t/vega-boxplot/123065 "2018-03-08T12:43:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlosvega](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carlosvega/32/28433_2.png) [@carlosvega](https://discuss.elastic.co/u/carlosvega)\
**Post date:** [March 8, 2018, 12:43pm UTC](https://discuss.elastic.co/t/vega-boxplot/123065/1 "2018-03-08T12:43:01Z")

</div>

Hi,

I'm trying to make this example work with elasticsearch data but I can't manage to do it.  
[https://vega.github.io/editor/#/examples/vega/box-plot](https://vega.github.io/editor/#/examples/vega/box-plot)

My documents are of the form:

```auto
"properties" : {
	"timestamp" : "date",
	"geo" : "geopoint",
	"ip" : "ip",
	"name" : "keyword",
	"description" : "text",
	"age" : "integer",
	"size" : "float"
},

```

and I would like to have a boxplot of age and size variables. Any help? Is there any documentation about how to adapt the vega syntax to kibana/elasticsearch.

---

<div class="post-metadata">

**Author:** ![nyuriks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nyuriks/32/26171_2.png) [@nyuriks](https://discuss.elastic.co/u/nyuriks)\
**Post date:** [March 9, 2018, 2:50am UTC](https://discuss.elastic.co/t/vega-boxplot/123065/2 "2018-03-09T02:50:38Z")

</div>

@carlosvega hi, I assume you want to draw two bars - one for the age variable, and one for the size? To do this, you need to calculate 5 values for each of the variables: "min", "q1", "median", "q3", "max". All of them can be computed by ElasticSearch, e.g. by using [percentile aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-percentile-aggregation.html), [min aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-min-aggregation.html), etc. Basically construct a query that will give you all 10 values back, and you can draw them directly with Vega. I would recommend starting with the dev console to construct the query. There are some blog posts I have written, e.g. [this one](https://www.elastic.co/blog/custom-vega-visualizations-in-kibana) that explain how to approach such problems (you need Vega, not Vega Lite, because you need full control of your drawing surface)

---

<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:** [April 6, 2018, 2:51am UTC](https://discuss.elastic.co/t/vega-boxplot/123065/3 "2018-04-06T02:51:00Z")

</div>

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