Show different Metrics in one Visualization

Hi,

in my document I have a JSON metrics field like that:

{
  "task": "task1",
  "size": 2048
},
{
  "task": "task2",
  "size": 1000
}

As Buckets I have another field called number (lets say number: 1, 2)

A field number can have different tasks with a corresponding size.

Is it possible to Display that in one Visualization? I can not figure out the correct Metrics Aggregation for that.

I have already set the buckets correctly by metrics.task.keyword, but in the moment I am using the max Aggregation, which returns me just the highest size in the document.
What I actually need is the size for the task in the correct JSON block.

Thanks in advance.

Are you saying that your documents contain an array of tasks, such as:

{
  number: 1
  tasks: [{ ... }, { ... }]
}

If so, then you can't build this visualization using the standard tools in Kibana- it is only possible to build using Vega. This is because array types are not supported in Elasticsearch, and Kibana built-in tools don't support the nested mapping which would otherwise be a good workaround.

So you have two options here:

  1. Change the way your documents are organized. Instead of having an array of tasks, create a separate document for each task- this can be visualized.
  2. Use Vega, which is fully custom

Thanks for quick reply!

I have not an array of tasks, but something like this.

{
  "task": "task_1",
  "percent": 20,
  "size": 2048,
  "used": 604
},
{
  "task": "task2",
  "percent": 10,
  "size": 200,
  "used": 212
},
{
  "task": "task3",
  "percent": 6.8,
  "size": 4050,
  "used": 140
},
.....

This is how my metrics field looks like.
Is it even like that not possible? (Without Vega) :slight_smile:

Is each task a separate document? And what type of visualization would you want?

  1. The tasks are collected in one document.
  2. I would like to use a line Graph.

Above I just copied the fields ( metrics ) values (in JSON format)

Okay, so if they are collected in a single document then you must use Vega. If you split these tasks into separate documents, you could build this visualization using any of the line charts in Kibana.

1 Like

Okay great, thanks for help :pray:

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