# Unable to Visualize (max/avg) a Long Value

**URL:** <https://discuss.elastic.co/t/unable-to-visualize-max-avg-a-long-value/203387>\
**Category:** Elasticsearch\
**Created:** [October 14, 2019, 6:54am UTC](https://discuss.elastic.co/t/unable-to-visualize-max-avg-a-long-value/203387 "2019-10-14T06:54:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [October 14, 2019, 6:54am UTC](https://discuss.elastic.co/t/unable-to-visualize-max-avg-a-long-value/203387/1 "2019-10-14T06:54:46Z")

</div>

I am unable to visualize a `long` value using any chart type (line, bar...) in Kibana. Only if I choose "Count" do I see my data: Max, Average all empty.

## Mapping

```
{
    "msaperf-all": {
        "mappings": {
            "dynamic": "false",
            "properties": {
                "env": {
                    "type": "keyword"
                },
                "name": {
                    "type": "keyword"
                },
                "port": {
                    "type": "keyword"
                },
                "timeTakenMS": {
                    "type": "long"
                },
                "timestamp": {
                    "type": "date",
                    "format": "date_time||epoch_millis"
                }
            }
        }
    }
}

```

Visualization totally empty:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/8/c8cbbd8350faac1837f23f0fc8864adceefda1ed.png)

## Request

```
{
  "aggs": {
    "2": {
      "date_histogram": {
        "field": "timestamp",
        "fixed_interval": "30m",
        "time_zone": "Europe/Zurich",
        "min_doc_count": 1
      },
      "aggs": {
        "1": {
          "avg": {
            "field": "timeTakenMS"
          }
        }
      }
    }
  },
  "size": 0,
  "_source": {
    "excludes": []
  },
  "stored_fields": [
    "*"
  ],
  "script_fields": {},
  "docvalue_fields": [
    {
      "field": "timestamp",
      "format": "date_time"
    }
  ],
  "query": {
    "bool": {
      "must": [
        {
          "match_all": {}
        },
        {
          "range": {
            "timestamp": {
              "format": "strict_date_optional_time",
              "gte": "2019-10-13T22:00:00.000Z",
              "lte": "2019-10-14T21:59:59.999Z"
            }
          }
        }
      ],
      "filter": [],
      "should": [],
      "must_not": []
    }
  }
}

```

## Response

```
{
  "took": 0,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 112,
    "max_score": null,
    "hits": []
  },
  "aggregations": {
    "2": {
      "buckets": [
        {
          "1": {
            "value": null
          },
          "key_as_string": "2019-10-14T06:30:00.000+02:00",
          "key": 1571027400000,
          "doc_count": 16
        },
        {
          "1": {
            "value": null
          },
          "key_as_string": "2019-10-14T07:00:00.000+02:00",
          "key": 1571029200000,
          "doc_count": 28
        },
        {
          "1": {
            "value": null
          },
          "key_as_string": "2019-10-14T07:30:00.000+02:00",
          "key": 1571031000000,
          "doc_count": 24
        },
        {
          "1": {
            "value": null
          },
          "key_as_string": "2019-10-14T08:00:00.000+02:00",
          "key": 1571032800000,
          "doc_count": 24
        },
        {
          "1": {
            "value": null
          },
          "key_as_string": "2019-10-14T08:30:00.000+02:00",
          "key": 1571034600000,
          "doc_count": 20
        }
      ]
    }
  },
  "status": 200
}

```

## Sample Data

```
{
    "took": 0,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 112,
            "relation": "eq"
        },
        "max_score": 1.0,
        "hits": [
            {
                "_index": "msaperf-all",
                "_type": "_doc",
                "_id": "32SfyG0B7cpF8onKBrWu",
                "_score": 1.0,
                "_source": {
                    "timeTaken": "785",
                    "type": "INFO",
                    "server": "app02",
                    "env": "dev",
                    "port": "8082",
                    "priority": "1",
                    "timestamp": "2019-10-14T04:55:22.000Z",
                    "source": "msaperf",
                    "name": "parts",
                    "app": "%{[fields][app]}"
                }
            },
            {
                "_index": "msaperf-all",
                "_type": "_doc",
                "_id": "JGSfyG0B7cpF8onKO8OP",
                "_score": 1.0,
                "_source": {
                    "timeTaken": "227",
                    "type": "INFO",
                    "server": "app02",
                    "env": "dev",
                    "port": "8083",
                    "priority": "1",
                    "timestamp": "2019-10-14T04:55:37.000Z",
                    "source": "msaperf",
                    "name": "salesdocs",
                    "app": "%{[fields][app]}"
                }
            },
            ...
```

---

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [October 15, 2019, 6:42am UTC](https://discuss.elastic.co/t/unable-to-visualize-max-avg-a-long-value/203387/2 "2019-10-15T06:42:27Z")

</div>

Any ideas anyone?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 15, 2019, 10:45am UTC](https://discuss.elastic.co/t/unable-to-visualize-max-avg-a-long-value/203387/3 "2019-10-15T10:45:36Z")

</div>

> [@cawoodm](#):
>
> Any ideas anyone?

Your doc has field `timeTaken` not `timeTakenMS` ?

---

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [October 16, 2019, 8:44am UTC](https://discuss.elastic.co/t/unable-to-visualize-max-avg-a-long-value/203387/4 "2019-10-16T08:44:27Z")

</div>

Who da man? YOU da man!

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 16, 2019, 8:46am UTC](https://discuss.elastic.co/t/unable-to-visualize-max-avg-a-long-value/203387/5 "2019-10-16T08:46:23Z")

</div>

I'm hoping to get a job as a compiler.

---

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [October 16, 2019, 9:32am UTC](https://discuss.elastic.co/t/unable-to-visualize-max-avg-a-long-value/203387/6 "2019-10-16T09:32:59Z")

</div>

I hear Rust is hiring!

---

<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:** [November 13, 2019, 9:33am UTC](https://discuss.elastic.co/t/unable-to-visualize-max-avg-a-long-value/203387/7 "2019-11-13T09:33:19Z")

</div>

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