# Combining Documents for test result comparison in Kibana

**URL:** <https://discuss.elastic.co/t/combining-documents-for-test-result-comparison-in-kibana/300829>\
**Category:** Kibana\
**Created:** [March 28, 2022, 10:55am UTC](https://discuss.elastic.co/t/combining-documents-for-test-result-comparison-in-kibana/300829 "2022-03-28T10:55:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JBufton](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@JBufton](https://discuss.elastic.co/u/JBufton)\
**Post date:** [March 28, 2022, 10:55am UTC](https://discuss.elastic.co/t/combining-documents-for-test-result-comparison-in-kibana/300829/1 "2022-03-28T10:55:17Z")

</div>

Hi, I'm new here so I apologise if this turns out to be a noob question. I have a large set of documents in elastic containing test result data including timestamps, runtimes, results, branch tests were ran on and test run ids. I am struggling to setup a view in kibana which could compare results in a data table where the columns are different results. I figure the way to do this would be with a transform and some fancy field scripting but I am hitting a wall with how to do this. For clarity here is an example of what I'd like to do:

Convert:

```auto
doc1 {
    name: test1
    result: Pass
    branch: branch1
    runid: 1
}

doc2 {
    name: test1
    result: Fail
    branch: branch2
    runid: 2
}

docn {
    name: test1
    result: Resultn
    branch: branchn
    runid: n
}

```

into something like:

```auto
comparisonDoc {
    name: test1
    result_branch1: Pass
    result_branch2: Fail
    result_branchn: Resultn
    runid_branch1: 1
    runid_branch2: 2
    runid_branchn: n
}

```

So this way I could display data in a table in kibana with a test for each row and the results of each branch in the columns. e.g.

```auto
Test result_branch1 result_branch2 result_branchn
test1 Pass Fail Resultn

```

Am I on the right track about making a transform with some dynamic runtime fields? Is there a better way of doing this? How could I go about doing this?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Hendrik\_Muhs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hendrik_muhs/32/25802_2.png) [@Hendrik\_Muhs](https://discuss.elastic.co/u/Hendrik_Muhs)\
**Post date:** [March 29, 2022, 9:23am UTC](https://discuss.elastic.co/t/combining-documents-for-test-result-comparison-in-kibana/300829/2 "2022-03-29T09:23:48Z")

</div>

We have [this example](https://www.elastic.co/guide/en/elasticsearch/reference/current/transform-painless-examples.html#painless-compare) in the docs which might help.

I think you need some scripting, however I suggest to look into `scripted_metric` not runtime fields.

---

<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 26, 2022, 9:24am UTC](https://discuss.elastic.co/t/combining-documents-for-test-result-comparison-in-kibana/300829/3 "2022-04-26T09:24:25Z")

</div>

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