# Pipeline aggregations in kibana visualization

**URL:** https://discuss.elastic.co/t/pipeline-aggregations-in-kibana-visualization/107380
**Category:** Kibana
**Created:** [November 13, 2017, 11:56am UTC](https://discuss.elastic.co/t/pipeline-aggregations-in-kibana-visualization/107380 "2017-11-13T11:56:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![misomij](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/misomij/32/10700_2.png) [@misomij](https://discuss.elastic.co/u/misomij)
#### Post date: [November 13, 2017, 11:56am UTC](https://discuss.elastic.co/t/pipeline-aggregations-in-kibana-visualization/107380/1 "2017-11-13T11:56:18Z")

</div>

Hi, I have documents like the following in the same index pattern:

```
{
    "timestamp": ...
    "user_id": "LUCA",
    "dealer": 123456789,
    "method": "search",
    "ip": 1.1.1.1,
    "search": "number='123456789'"
}
{
    "timestamp": ...
    "user_id": "LUCA",
    "dealer": 123456789,
    "method": "orderEntry",
    "ip": 1.1.1.1
}

```

I need to calculate these 2 values:

ratio = number of searches per dealer / number of orderEntry per dealer  
gap = number of searches per dealer - number of orderEntry per dealer

I can do this in dev tools with this query:

```
{
  "size":0,
  "aggs":{
    "datehistogram":{
      "date_histogram":{
        "field":"timestamp",
        "interval":"day"
      },
      "aggs":{
        "User":{
          "terms":{
            "field":"user_id.keyword",
            "size":10
          },
          "aggs":{
            "search":{
              "value_count":{
                "field":"search.keyword"
              }
            },
            "termorder":{
              "filter":{
                "term":{
                  "method.keyword":"orderEntry"
                }
              }
            },
            "ratio":{
              "bucket_script":{
                "buckets_path":{
                  "searchcount":"search.value",
                  "termordercount":"termorder._count"
                },
                "script":"params.searchcount/params.termordercount"
              }
            },
            "gap":{
              "bucket_script":{
                "buckets_path":{
                  "searchcount":"search.value",
                  "termordercount":"termorder._count"
                },
                "script":"params.searchcount-params.termordercount"
              }
            }
          }
        }
      }
    }
  }
}

```

I can't find a way to display this in kibana, I tryed to play with the data table with no success ☹  
Can anyone help me with this?

Thanks in advance

---

<div class="post-metadata">

### Author: ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)
#### Post date: [November 13, 2017, 3:36pm UTC](https://discuss.elastic.co/t/pipeline-aggregations-in-kibana-visualization/107380/2 "2017-11-13T15:36:31Z")

</div>

Hey @misomij you mentioned that you played around with the DataTable to do so, ideally, what format would you like the data reported in?

The Time Series Visual Builder allows you to do calculations like these on time series data, but they don't support the table based output, similar to the data table.

---

<div class="post-metadata">

### Author: ![misomij](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/misomij/32/10700_2.png) [@misomij](https://discuss.elastic.co/u/misomij)
#### Post date: [November 14, 2017, 8:36am UTC](https://discuss.elastic.co/t/pipeline-aggregations-in-kibana-visualization/107380/3 "2017-11-14T08:36:18Z")

</div>

Thank you for responding. I would like to see something like this, in a table:

```
user_id gap ratio
LUCA ... ...
BRANDON ... ...

```

with the gap and ratio values calculated over the time span selected for the dashboard.  
I would like to see fast the number, result of the operation, in a time series visualization I can't 😕

---

<div class="post-metadata">

### Author: ![rubenvillar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rubenvillar/32/24255_2.png) [@rubenvillar](https://discuss.elastic.co/u/rubenvillar)
#### Post date: [November 15, 2017, 9:14am UTC](https://discuss.elastic.co/t/pipeline-aggregations-in-kibana-visualization/107380/4 "2017-11-15T09:14:55Z")

</div>

Hi,  
I really miss Pipeline Bucket Script Aggregrations in Kibana.

I would like to show % over total in a Data Table.

 ![percentkibana](https://us1.discourse-cdn.com/elastic/original/3X/e/b/eb560dfa8a4589d0d3434ae8fdb4703b50fe5588.PNG)

> {  
> "query": {  
> "bool": {  
> "must": [  
> {  
> "query\_string": {  
> "analyze\_wildcard": true,  
> "query": "\*"  
> }  
> },  
> {  
> "range": {  
> "DATE\_REGISTRATION": {  
> "gte": 1352967660235,  
> "lte": 1510734060235,  
> "format": "epoch\_millis"  
> }  
> }  
> }  
> ],  
> "must\_not":   
> }  
> },  
> "size": 0,  
> "\_source": {  
> "excludes":   
> },  
> "aggs": {  
> "6": {  
> "terms": {  
> "field": "GROUP.keyword",  
> "size": 5,  
> "order": {  
> "\_count": "desc"  
> }  
> },  
> "aggs": {  
> "5": {  
> "date\_histogram": {  
> "field": "DATE\_REGISTRATION",  
> "interval": "1y",  
> "time\_zone": "Europe/Berlin",  
> "min\_doc\_count": 0  
> },  
> "aggs": {  
> "7": {  
> "cumulative\_sum": {  
> "buckets\_path": "\_count"  
> }  
> },  
> "percentage\_new\_users": {  
> "bucket\_script": {  
> "buckets\_path": {  
> "my\_var1": "\_count",  
> "my\_var2": "7"  
> },  
> "script": "params.my\_var1 / params.my\_var2"  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }

---

<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: [December 13, 2017, 9:14am UTC](https://discuss.elastic.co/t/pipeline-aggregations-in-kibana-visualization/107380/5 "2017-12-13T09:14:55Z")

</div>

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