# Combine different log events in one data table

**URL:** <https://discuss.elastic.co/t/combine-different-log-events-in-one-data-table/272403>\
**Category:** Kibana\
**Created:** [May 7, 2021, 10:14am UTC](https://discuss.elastic.co/t/combine-different-log-events-in-one-data-table/272403 "2021-05-07T10:14:40Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)\
**Post date:** [May 11, 2021, 2:04pm UTC](https://discuss.elastic.co/t/combine-different-log-events-in-one-data-table/272403/2 "2021-05-11T14:04:40Z")

</div>

@bab

This would requires support for a bucket script in Kibana data-tables, which there is not now [https://github.com/elastic/kibana/issues/4707](https://github.com/elastic/kibana/issues/4707)

You could run this query manually too in dev-tools.

This would be an example of how to do it:

> [@Elasticsearch bucket\_script to subtract two timestamps](https://discuss.elastic.co/t/elasticsearch-bucket-script-to-subtract-two-timestamps/125309/2):
>
> Do you need those firstUrl and lastUrl aggregations to be terms aggregations? Because if you change those to min and max aggregations the solution is simple: { "query": { "bool": { "filter": { "range": { "page.time": { "gte": "now-w", "lte": "now" } } } } }, "aggs": { "sessionLengthData": { "terms": { "field": "sId.keyword", "size": 10 }, "aggs": { "firstUrl": { …

- top-level term-aggregation on `tradeReference`
- min sub aggregation to get minimum date
- max sub-aggregation to get maximum date
- bucket sub-aggregation to subtract max from min

---

_[View the full topic](https://discuss.elastic.co/t/combine-different-log-events-in-one-data-table/272403)._
