# Custom Metric For Drilldown Documents

**URL:** <https://discuss.elastic.co/t/custom-metric-for-drilldown-documents/295535>\
**Category:** Metrics\
**Created:** [January 27, 2022, 4:21am UTC](https://discuss.elastic.co/t/custom-metric-for-drilldown-documents/295535 "2022-01-27T04:21:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![heshan](https://avatars.discourse-cdn.com/v4/letter/h/b38774/32.png) [@heshan](https://discuss.elastic.co/u/heshan)\
**Post date:** [January 27, 2022, 4:21am UTC](https://discuss.elastic.co/t/custom-metric-for-drilldown-documents/295535/1 "2022-01-27T04:21:13Z")

</div>

```auto
{ "index" : { } }

{"BATCH_ID": "2021-08-19 08:27:16", "ENV":"DEV","TEST_CASE": "test_case2", "COMPARISON": "POL", "OLD_PURCHASE_ORDER_NUMBER": "ADDQYU5B", "NEW_PURCHASE_ORDER_NUMBER":"100018718", "OLD_OC_NUMBER":"U0056A", "NEW_OC_NUMBER":"GIMEDN", "SEQUENCE":"1000", "JSON_ATTRIBUTE":"transmissionStatus", "IS_MATCHED":"TRUE", "OLD_VALUE":"000000", "NEW_VALUE":"000000" }

{ "index" : { } }

{"BATCH_ID": "2021-08-19 08:27:16", "ENV":"PROD","TEST_CASE": "test_case1", "COMPARISON": "POL", "OLD_PURCHASE_ORDER_NUMBER": "ADDQYU5B", "NEW_PURCHASE_ORDER_NUMBER":"100018718", "OLD_OC_NUMBER":"U0056A", "NEW_OC_NUMBER":"GIMEDN", "SEQUENCE":"1000", "JSON_ATTRIBUTE":"transmissionStatus", "IS_MATCHED":"FALSE", "OLD_VALUE":"", "NEW_VALUE":"654635" }

{ "index" : { } }

{"BATCH_ID": "2021-08-19 08:27:16", "ENV":"PROD","TEST_CASE": "test_case3", "COMPARISON": "POL", "OLD_PURCHASE_ORDER_NUMBER": "ADDQYU5B", "NEW_PURCHASE_ORDER_NUMBER":"100018718", "OLD_OC_NUMBER":"U0056A", "NEW_OC_NUMBER":"GIMEDN", "SEQUENCE":"1000", "JSON_ATTRIBUTE":"transmissionStatus", "IS_MATCHED":"FALSE", "OLD_VALUE":"21341", "NEW_VALUE":"21341" }

```

////////////////////////////////////data set////////////////////////////////////

Im using ES v7.10.2 and I would like to get a custom metric(value) for below scenario.  
As per above dataset I need to find whether a specific test case of a specific batch has atleast 1 IS\_MATCHED = FALSE. If then to display "FAIL" or else to display "PASS".

Is it possible to do above scenario in this version?

Thank you

---

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [January 27, 2022, 6:04am UTC](https://discuss.elastic.co/t/custom-metric-for-drilldown-documents/295535/2 "2022-01-27T06:04:03Z")

</div>

Filtering `IS_MATCHED = FALSE` within query clause and using multi-terms aggregation on `TEST_CASE` and `BATCH_ID` is enough for you? If the result of just single test case and batch id is necessary, use boolean query to filter documents match the all three condition and check `doc_count`. Sorry if I don't understand what you are doing.

---

<div class="post-metadata">

**Author:** ![heshan](https://avatars.discourse-cdn.com/v4/letter/h/b38774/32.png) [@heshan](https://discuss.elastic.co/u/heshan)\
**Post date:** [January 27, 2022, 6:24am UTC](https://discuss.elastic.co/t/custom-metric-for-drilldown-documents/295535/3 "2022-01-27T06:24:16Z")

</div>

Drilldown from Batch Id -\> Test Case -\> IS\_MATCHED  
and if IS\_MATCHED = FALSE count is greater and equal to 1 need to display "FAIL" or else if the count is 0 then display "PASS"

OR  
If IS\_MATCHED = TRUE percentage is 100% needs to display "PASS" else "FAIL"

 ![elasticQ](https://us1.discourse-cdn.com/elastic/original/3X/b/a/ba44d5c3e3da01602f4b6ec5e5c34e4400e5917b.png)  
Kind of achieved the percentage option, rather than showing the percentage is it possible to display like "PASS" or "FAIL". Used TSVB metric for visualization

Thank you for helping and replying

---

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [January 27, 2022, 7:40am UTC](https://discuss.elastic.co/t/custom-metric-for-drilldown-documents/295535/4 "2022-01-27T07:40:10Z")

</div>

it is a problem of kibana?

I have no idea about exact panel with words.  
How about Aggregation \> Metric with background alert color as an alternative? It will help to recognize if FAILURE exists.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/7/17993b2f39ae62705e3524a65c30dc033c24bed4.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/f/3f6b369330d72747f4152eee1e2b9b7db722ccc4.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/0/8026a904a0dbf6ca635af3e2c553223418562c2f.png)

---

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [January 27, 2022, 7:49am UTC](https://discuss.elastic.co/t/custom-metric-for-drilldown-documents/295535/5 "2022-01-27T07:49:41Z")

</div>

Now I realized that I missed your tag "Observability". The previous post was about Kibana's general Dashboard and I'm not sure it is posible in Observability.

---

<div class="post-metadata">

**Author:** ![heshan](https://avatars.discourse-cdn.com/v4/letter/h/b38774/32.png) [@heshan](https://discuss.elastic.co/u/heshan)\
**Post date:** [January 27, 2022, 6:50pm UTC](https://discuss.elastic.co/t/custom-metric-for-drilldown-documents/295535/6 "2022-01-27T18:50:56Z")

</div>

I've been using kibana 7.10.2, not sure that kind of feature is available at that version

---

<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:** [February 24, 2022, 6:51pm UTC](https://discuss.elastic.co/t/custom-metric-for-drilldown-documents/295535/7 "2022-02-24T18:51:39Z")

</div>

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