Unable to Visualize (max/avg) a Long Value

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:

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]}"
                }
            },
            ...

Any ideas anyone?

Your doc has field timeTaken not timeTakenMS ?

Who da man? YOU da man!

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

I hear Rust is hiring!

1 Like

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