# Use elasticsearch requests in kibana (with double/tripple aggregation)

**URL:** <https://discuss.elastic.co/t/use-elasticsearch-requests-in-kibana-with-double-tripple-aggregation/299648>\
**Category:** Kibana\
**Created:** [March 14, 2022, 4:45pm UTC](https://discuss.elastic.co/t/use-elasticsearch-requests-in-kibana-with-double-tripple-aggregation/299648 "2022-03-14T16:45:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebneu](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@sebneu](https://discuss.elastic.co/u/sebneu)\
**Post date:** [March 14, 2022, 4:45pm UTC](https://discuss.elastic.co/t/use-elasticsearch-requests-in-kibana-with-double-tripple-aggregation/299648/1 "2022-03-14T16:45:43Z")

</div>

Hi

given:  
documents with a timestamp

try:  
I have a working requests which first rounds the timestamps to 10 minutes (date\_histogram) and than sums up six 10 minute windows. (Rolling hour).

here is the request:

```auto
POST /xxx/_search?size=0
{
  "aggs": {
    "myDateHisto": {
      "date_histogram": {
        "field": "STutc",
        "fixed_interval": "10m"
      },
      "aggs": {
        "moving_count": {
          "moving_fn": {
            "buckets_path": "_count",
            "window": 6,
            "script": "MovingFunctions.sum(values)"
          }
        }
      }
    }
  }
}

```

The request produces the correct result but I have no idea how to use the result in a graph within kibana. As far as I am aware there is nothing like this in KQL or lucene, nor can I find a way to use this request for a graph directly. Even when using TVSB there is only one level of aggregation.

Any ideas?

In a next step I have to get the maximum per day (now there are 144 values for each 10 minutes). So there will be another level of aggregation.

Regards  
Seb

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [March 15, 2022, 1:49pm UTC](https://discuss.elastic.co/t/use-elasticsearch-requests-in-kibana-with-double-tripple-aggregation/299648/2 "2022-03-15T13:49:57Z")

</div>

HI @sebneu. I believe there is currently no way to accomplish this in our Kibana visualizations. However, you might be able to create your own visualization using [Vega in Kibana](https://www.elastic.co/guide/en/kibana/current/vega.html). Vega can be challenging if you haven't used it before, but it accepts almost any Elasticsearch query for input.

---

<div class="post-metadata">

**Author:** ![sebneu](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@sebneu](https://discuss.elastic.co/u/sebneu)\
**Post date:** [March 15, 2022, 4:10pm UTC](https://discuss.elastic.co/t/use-elasticsearch-requests-in-kibana-with-double-tripple-aggregation/299648/3 "2022-03-15T16:10:09Z")

</div>

wow, a complete new world is opening up! great

Thank you for the hint!

---

<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 12, 2022, 4:10pm UTC](https://discuss.elastic.co/t/use-elasticsearch-requests-in-kibana-with-double-tripple-aggregation/299648/4 "2022-04-12T16:10:42Z")

</div>

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