Unable to graph Elasticsearch Histogram data

  • What Grafana version and what operating system are you using?
    Grafana v7.3.3 - Amazon Instance

  • What are you trying to achieve?
    We’re looking to graph an area chart with data coming from Elasticsearch. The x axis should be a group by of an integer field and the y axis an average of another numeric field.

  • How are you trying to achieve it?
    Using the Graph vizualisation. The query is using a “Group By” “Histogram” using the desired field. We’ve also tried changing the X Axis mode from “Time series” to “Histogram” to no avail.

  • What happened?
    When changing the group by on the queries from data histogram to histogram the graph shows “Unable to graph data”.

  • What did you expect to happen?
    The x axis to become the histogram value or able to be mapped to the value and the y value become the average metric.

  • Can you copy/paste the configuration(s) that you are having problems with?
    A
    Query
    Lucene query
    Alias
    Frame Time
    Metric
    Average
    data.FrameTime
    Options
    Group by
    Histogram
    data.iterator
    Interval: 1, Min Doc Count: 1

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    “Unable to graph data”. And a button to “Switch to table view”.

  • Did you follow any online instructions? If so, what is the URL?
    N/A

Welcome,

Please provide a sample es document minus with obfuscated sensitive data points?
for example.

{
  "_index": "edwards_the_great",
  "_id": "uNU7xoEBhCIrnBmPJwlr",
  "_version": 1,
  "_score": 1,
  "_source": {
    "start": 1656603585607,
    "end": 1656613809357,
    "result": false,
    "testRuns": [
      {
        "testEnvironment": null,
        "totalSkipped": 0,
        "totalFailed": 0,
        "totalCount": 172,
        "totalPassed": 172,
        "totalFlaky": 0,
        "flakyTests": {},
        "failingTests": [],
        "passed": true,
        "stopOnFail": true,
        "name": "Smoke Tests"
      },
      {
        "testEnvironment": "SDK Environment",
        "totalSkipped": 7,
        "totalFailed": 2,
        "totalCount": 47,
        "totalPassed": 40,
        "totalFlaky": 3,
        "flakyTests": {
          "flaky1/": 1,
          "flaky2/": 1,
          "flaky3/": 1
        },
        "failingTests": [
          "failed1/",
          "failed2/"
        ],
        "passed": false,
        "stopOnFail": true,
        "name": "Sanity"
      }
    ]
  }
}

Hello yosiasz,

Thank you for your assistance. Unfortunately I don’t have access to the ES instance directly so I’m unable to provide an example of a document.

I have however provided an example of the query/response I’m running below:

{
  "request": {
    "url": "api/datasources/proxy/135/_msearch?max_concurrent_shard_requests=5",
    "method": "POST",
    "data": "{\"search_type\":\"query_then_fetch\",\"ignore_unavailable\":true,\"index\":[\"2022-07-04-data\",\"2022-07-05-data\"]}\n{\"size\":0,\"query\":{\"bool\":{\"filter\":[{\"range\":{\"timestamp\":{\"gte\":1656925423740,\"lte\":1657011823740,\"format\":\"epoch_millis\"}}},{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"data.iterator:<=10\"}}],\"must\":[{\"match_phrase\":{\"data.event_type\":{\"query\":\"event_type_name\"}}}]}},\"aggs\":{\"2\":{\"histogram\":{\"interval\":1,\"field\":\"data.iterator\",\"min_doc_count\":1},\"aggs\":{\"1\":{\"avg\":{\"field\":\"data.FrameTime\"}}}}}}\n",
    "hideFromInspector": false
  },
  "response": {
    "took": 3402,
    "responses": [
      {
        "took": 3402,
        "timed_out": false,
        "_shards": {
          "total": 2,
          "successful": 2,
          "skipped": 0,
          "failed": 0
        },
        "hits": {
          "total": {
            "value": 66,
            "relation": "eq"
          },
          "max_score": null,
          "hits": []
        },
        "aggregations": {
          "2": {
            "buckets": [
              {
                "1": {
                  "value": 10.75475001335144
                },
                "key": 0,
                "doc_count": 6
              },
              {
                "1": {
                  "value": 74.81934833526611
                },
                "key": 1,
                "doc_count": 6
              },
              {
                "1": {
                  "value": 21.918816248575848
                },
                "key": 2,
                "doc_count": 6
              },
              {
                "1": {
                  "value": 21.583483060201008
                },
                "key": 3,
                "doc_count": 6
              },
              {
                "1": {
                  "value": 18.708183606465656
                },
                "key": 4,
                "doc_count": 6
              },
              {
                "1": {
                  "value": 17.885199864705402
                },
                "key": 5,
                "doc_count": 6
              },
              {
                "1": {
                  "value": 18.15591637293498
                },
                "key": 6,
                "doc_count": 6
              },
              {
                "1": {
                  "value": 18.47748343149821
                },
                "key": 7,
                "doc_count": 6
              },
              {
                "1": {
                  "value": 18.19325002034505
                },
                "key": 8,
                "doc_count": 6
              },
              {
                "1": {
                  "value": 24.496050357818604
                },
                "key": 9,
                "doc_count": 6
              },
              {
                "1": {
                  "value": 22.333066781361897
                },
                "key": 10,
                "doc_count": 6
              }
            ]
          }
        },
        "status": 200
      }
    ],
    "$$config": {
      "url": "api/datasources/proxy/135/_msearch?max_concurrent_shard_requests=5",
      "method": "POST",
      "data": "{\"search_type\":\"query_then_fetch\",\"ignore_unavailable\":true,\"index\":[\"2022-07-04-data\",\"2022-07-05-data\"]}\n{\"size\":0,\"query\":{\"bool\":{\"filter\":[{\"range\":{\"timestamp\":{\"gte\":1656925423740,\"lte\":1657011823740,\"format\":\"epoch_millis\"}}},{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"data.iterator:<=10\"}}],\"must\":[{\"match_phrase\":{\"data.event_type\":{\"query\":\"event_type_name\"}}}]}},\"aggs\":{\"2\":{\"histogram\":{\"interval\":1,\"field\":\"data.iterator\",\"min_doc_count\":1},\"aggs\":{\"1\":{\"avg\":{\"field\":\"data.FrameTime\"}}}}}}\n",
      "hideFromInspector": false
    }
  }
}

which part do you want to extract and plot on a graph?