Last value in Bar graph

I want to have a bar graph with current values, but so far the best I can do is to use Average. The data being graphed is disk usage vs size spanning several disks and hosts.

A colleague suggested to try to sort by timestamp and take the top 1, but I'm already Bucketing the X axis by mount point and splitting the chart by host, and for some reason I can't do that anymore.

{
  "title": "Disk Used vs Total",
  "type": "histogram",
  "params": {
    "addLegend": true,
    "addTimeMarker": false,
    "addTooltip": false,
    "categoryAxes": [
      {
        "id": "CategoryAxis-1",
        "labels": {
          "show": true,
          "truncate": 100
        },
        "position": "bottom",
        "scale": {
          "type": "linear"
        },
        "show": true,
        "style": {},
        "title": {},
        "type": "category"
      }
    ],
    "grid": {
      "categoryLines": false,
      "style": {
        "color": "#eee"
      }
    },
    "legendPosition": "top",
    "seriesParams": [
      {
        "data": {
          "id": "1",
          "label": "Used"
        },
        "drawLinesBetweenPoints": true,
        "mode": "stacked",
        "show": "true",
        "showCircles": true,
        "type": "histogram",
        "valueAxis": "ValueAxis-1"
      },
      {
        "data": {
          "id": "3",
          "label": "Total"
        },
        "drawLinesBetweenPoints": true,
        "mode": "stacked",
        "show": true,
        "showCircles": true,
        "type": "histogram",
        "valueAxis": "ValueAxis-1"
      }
    ],
    "times": [],
    "type": "histogram",
    "valueAxes": [
      {
        "id": "ValueAxis-1",
        "labels": {
          "filter": false,
          "rotate": 0,
          "show": true,
          "truncate": 100
        },
        "name": "LeftAxis-1",
        "position": "left",
        "scale": {
          "mode": "normal",
          "type": "linear",
          "defaultYExtents": false
        },
        "show": true,
        "style": {},
        "title": {
          "text": "Average system.filesystem.used.bytes"
        },
        "type": "value"
      }
    ]
  },
  "aggs": [
    {
      "id": "1",
      "enabled": true,
      "type": "avg",
      "schema": "metric",
      "params": {
        "field": "system.filesystem.used.bytes",
        "customLabel": "Used"
      }
    },
    {
      "id": "3",
      "enabled": true,
      "type": "avg",
      "schema": "metric",
      "params": {
        "field": "system.filesystem.available",
        "customLabel": "Total"
      }
    },
    {
      "id": "4",
      "enabled": true,
      "type": "terms",
      "schema": "segment",
      "params": {
        "field": "system.filesystem.mount_point",
        "otherBucket": false,
        "otherBucketLabel": "Other",
        "missingBucket": false,
        "missingBucketLabel": "Missing",
        "size": 4,
        "order": "asc",
        "orderBy": "1"
      }
    },
    {
      "id": "5",
      "enabled": true,
      "type": "terms",
      "schema": "split",
      "params": {
        "field": "beat.hostname",
        "otherBucket": false,
        "otherBucketLabel": "Other",
        "missingBucket": false,
        "missingBucketLabel": "Missing",
        "size": 3,
        "order": "asc",
        "orderBy": "1",
        "row": false
      }
    }
  ]
}

@timroes / @ppisljar can we please get some help?

Thanks,
Bhavya

You could try to use the Top hits aggregation as a metric. there you can sort by timestamp and just take the average of the last x (in your case 1) documents.

If that's not working, there is currently no way in classical visualizations to visualize "individual" documents, which sounds a lot like what you are trying. In this case Vega visualizations are the only solution for you right now.

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