Display a simple ratio

Hello there,

Driving me crazy, I'm trying to show a small indicator with all the data I've in my dataset. logically, it seems extremely easy to produce, but I can't figure how it can be done in Kibana.

{
  "_index": "metrics-2023.02.23",
  "_id": "cZ5FfoYBMdkA3QKs5YJC",
  "_version": 1,
  "_score": null,
  "_source": {
    "@timestamp": "2023-02-23T12:35:55.169019280Z",
    "datetime_utc": "2023-02-23T13:35:54.690229+0100",
    "id": "india",
    "option_1": "alpha",
    "option_2": "bravo",
    "option_3": "charlie",
  },
  "fields": {
    "@timestamp": ["2023-02-23T12:35:55.169Z"],
    "datetime_utc": ["2023-02-23T12:35:54.690Z"]
  },
}
{
  "_index": "metrics-2023.02.23",
  "_id": "ds5ZFD8SDFvsd3SDF78f",
  "_version": 1,
  "_score": null,
  "_source": {
    "@timestamp": "2023-02-23T12:35:55.169019280Z",
    "datetime_utc": "2023-02-23T13:35:54.690229+0100",
    "id": "juliet",
    "option_1": "alpha",
    "option_2": "delta",
    "option_3": "echo",
  },
  "fields": {
    "@timestamp": ["2023-02-23T12:35:55.169Z"],
    "datetime_utc": ["2023-02-23T12:35:54.690Z"]
  },
}
{
  "_index": "metrics-2023.02.23",
  "_id": "DSQDndqs230sd9ddS6dD",
  "_version": 1,
  "_score": null,
  "_source": {
    "@timestamp": "2023-02-23T12:35:55.169019280Z",
    "datetime_utc": "2023-02-23T13:35:54.690229+0100",
    "id": "kilo",
    "option_1": "bravo",
    "option_2": "hotel",
    "option_3": "golf",
  },
  "fields": {
    "@timestamp": ["2023-02-23T12:35:55.169Z"],
    "datetime_utc": ["2023-02-23T12:35:54.690Z"]
  },
}
{
  "_index": "metrics-2023.02.23",
  "_id": "feDFj7FDSlofds2jo34s",
  "_version": 1,
  "_score": null,
  "_source": {
    "@timestamp": "2023-02-23T12:35:55.169019280Z",
    "datetime_utc": "2023-02-23T13:35:54.690229+0100",
    "id": "mike",
    "option_1": "foxtrot",
    "option_2": "alpha",
    "option_3": "bravo",
  },
  "fields": {
    "@timestamp": ["2023-02-23T12:35:55.169Z"],
    "datetime_utc": ["2023-02-23T12:35:54.690Z"]
  },
}

In my anonymized data sample here, you will find in the "id" and "option_x" the different datas I can have at end. In the data I have here the options between 'alpha' and 'mike' (12 different).
For each 'id' I can have 3 different 'option'

The metric I would like to show is simple really, I would like to show :

count of distinct options available (12), divided by count of distinct options shown as 'option_1' (3)

Thus I would simply like to see : 25% as result.
I even though I should go with a gauge or donut, but can't figure what I'm missing here.

I'm afraid it's the way my data are collected.

Hi @lamdba

I guess you could create a metric visualization in Lens with this formula:

count(kql="option_1: *") / (count(kql="option*: *")

and format the result as Percentage

Hey @Marco_Liberati

Cheers for the tip, it seems Lens could get me that done quite easily.
However we're on OpenSearch (AWS platform) and thus, if I'm not mistken, we don't have access to it. I'm trying to find out if Lens is going to make it over, but not sure all the info I'm reading.

Should you have any other idea of a solution, I'll take it!

OpenSearch/OpenDistro are AWS run products and differ from the original Elasticsearch and Kibana products that Elastic builds and maintains. You may need to contact them directly for further assistance.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

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