Elasticsearch Datasource not working

I have Grafana working with Prometheus as default datasource. Want to add Elasticsearch as a secondary data source. My environment is running in kubernetes with Elasticsearch : 7.2.0 , Grafana : 6.4.4

But getting error No date field named undefined found

I am able to curl ‘http://elasticsearch:9200/_cat/indices?v&pretty’ from Grafana pod

Indices
root@shell-545fcb88cc-grn9t:/# curl -XGET 'http://elasticsearch:9200/_cat/indices?v&pretty'
health status index                              uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   .monitoring-es-7-2019.11.08        ULAdvIYIRxCEGewgc3IA3g   1   1     314892       240982    732.5mb        361.3mb
green  open   syslog-2019.11.03                  hfPuNniuTaKiKm6LZYazCg   1   1        277            0    386.9kb        193.4kb
green  open   apm-7.2.0-2019.11.06               LtLGo-2aTjGlSIzhlfkoZw   1   1      39783         7578     12.3mb          6.1mb
green  open   .monitoring-kibana-7-2019.11.07    FeFhr8-5QRO6VzYu-c1s7w   1   1      17278            0      6.3mb          3.1mb
green  open   .monitoring-kibana-7-2019.11.02    CVlb1_0yQEaV-V92hIvspg   1   1      17278            0      5.7mb          2.8mb
green  open   syslog-2019.11.05                  JutF5UINTJaencoQ2TDllg   1   1        636            0    664.5kb        332.2kb
green  open   .monitoring-kibana-7-2019.11.03    kTwQsBCOTtK2l04dQ9Ox_g   1   1      17280            0      5.7mb          2.8mb
green  open   syslog-2019.10.31                  PynRH8ZMT0OwwpEKOvJgwg   1   1         42            0    164.1kb           82kb
green  open   .monitoring-logstash-7-2019.11.02  5a1shQN6SQaPMyETlEWI6w   1   1     129555            0     13.8mb          6.9mb
green  open   filebeat-7.2.0-2019.10.03-000002   hhi_PGsaRWu9W2Lb565cyg   1   1   24963987            0     20.2gb         10.1gb
green  open   metricbeat-7.2.1-2019.10.03-000002 2ek3X0h-R5ONjD51sVcOCg   1   1    2757322            0        1gb        552.9mb
green  open   .monitoring-es-7-2019.11.07        Mzgl3oj6Rv6ruPs-suqN-w   1   1     459545       181138    608.5mb        304.6mb
green  open   .monitoring-kibana-7-2019.11.05    36IX0HsWR5SLZttFv2Dc2g   1   1      17278            0      6.5mb          3.2mb
green  open   apm-7.2.0-2019.11.07               2I50pf3pRoGzMWkBvnR8zg   1   1     307629            0     56.7mb         28.3mb
green  open   .monitoring-logstash-7-2019.11.08  zCClqPcRSG-nVjOACuRUPA   1   1      85350            0      9.4mb          4.7mb
green  open   .monitoring-logstash-7-2019.11.03  jSwDSoyMQD25Hl3dH2kvZQ   1   1     129555            0     13.7mb          6.8mb
green  open   syslog-2019.11.02                  e9mcQ3KYS3yfegO7i6pn9g   1   1        319            0    475.4kb        237.7kb
green  open   metricbeat-7.2.0-2019.10.22-000003 ssCSFuT0QaikLW8OiKP1Kw   1   1  120115580            0     79.2gb         39.6gb
green  open   .monitoring-es-7-2019.11.02        uqxh6Dv2QyK5u75MpiRFNg   1   1     379582        33600    477.6mb          239mb
green  open   .kibana_1                          qDMwS82NShi-ZCgj2ZNnaw   1   1         33           10      453kb        226.5kb
green  open   .monitoring-kibana-7-2019.11.04    J5CQ71GzTgiiWXu-Ih22XA   1   1      17278            0      6.4mb          3.2mb
green  open   .monitoring-logstash-7-2019.11.04  9gtK9qK0RQOjt12mtVlpyA   1   1     129555            0     14.9mb          7.3mb
green  open   syslog-2019.11.07                  PcdvTxMRTnqS0ZUBlyK1rA   1   1       8538            0        5mb          2.5mb
green  open   filebeat-7.2.0-2019.11.02-000003   4MIsjbyKQ52DVxOUxeM9AQ   1   1    6350545            0      4.7gb          2.3gb
green  open   filebeat-7.2.0-2019.09.03-000001   eYZWZhv0RjybEkkUImJIiQ   1   1   25802336            0     21.3gb         10.6gb
green  open   syslog-2019.10.30                  e6m-tWt2S7S5fx739HIvCA   1   1       1143            0    823.7kb          419kb
green  open   metricbeat-7.2.1-2019.11.02-000003 iVEXirNxTJWbz8aCmpDENA   1   1          0            0       566b           283b
green  open   .monitoring-es-7-2019.11.06        LUG3w4KGRyiuEId4qAlFNA   1   1     435635       136350      574mb        286.5mb
green  open   .monitoring-es-7-2019.11.05        -EWrrs-STd2lOWor_3NSow   1   1     425016       116530    581.7mb          282mb
green  open   .kibana_task_manager               h6Esmg1eQBSaCNlQKljl9w   1   1          2            0     42.9kb         21.4kb
green  open   .monitoring-kibana-7-2019.11.06    80-uL-omQIKUHo2okewPSQ   1   1      17280            0      6.4mb          3.2mb
green  open   .monitoring-logstash-7-2019.11.06  VlDIxdShTGyU4xaZsvqVpw   1   1     129555            0     14.3mb          7.1mb
green  open   syslog-2019.11.08                  jPJuTD7SRQqaTcmVuzlNBA   1   1       2914            0      1.7mb          1.2mb
green  open   .monitoring-es-7-2019.11.03        UdEsVrDmR762mzxhUl2fGw   1   1     407665        84050    503.9mb        253.9mb
green  open   apm-7.2.0-2019.09.16               xnXXNE1pSmGClsYKrSJuHg   1   1          2            0       13kb          6.5kb
green  open   filebeat-7.2.1-2019.09.03-000001   I8vRGDnrR-6Cl5oPwCzjuw   1   1    4651714            0      3.4gb          1.7gb
green  open   metricbeat-7.2.0-2019.09.03-000001 abOCdQ4WTS62M75gpG6qkA   1   1  149807959            0      100gb           50gb
green  open   .monitoring-logstash-7-2019.11.05  VlbH_i3nRNCBO5VYW8VxoA   1   1     129540            0     14.4mb          7.3mb
green  open   metricbeat-7.2.0-2019.09.28-000002 uYvCxqH7SpSKDYDdF1z_Rg   1   1  151770825            0      100gb           50gb
green  open   syslog-2019.11.06                  9onA0R_qTTKeroZvGlKCIg   1   1       3098            0      2.6mb          1.3mb
green  open   metricbeat-7.2.1-2019.09.03-000001 ZQ3-urydTn2kMhYDPtRqYQ   1   1    8700321            0      3.7gb          1.8gb
green  open   filebeat-7.2.1-2019.10.03-000002   Xkwv7LQVSm6yVqBSZKVKCg   1   1     389496            0    285.6mb        143.2mb
green  open   .monitoring-logstash-7-2019.11.07  nKLFM9HxSLGEwAvnu48p_w   1   1     129555            0     14.8mb          7.4mb
green  open   filebeat-7.2.1-2019.11.02-000003   5PwPy8jRQEC3bmW9hFctxg   1   1          0            0       566b           283b
green  open   .monitoring-es-7-2019.11.04        vxoKsjlZSTGq3WzTeHbr7Q   1   1     416188        99708    539.7mb        270.6mb
green  open   syslog-2019.11.01                  wFgiLIxgQ9m4R8c1plR6UQ   1   1        943            0      933kb        457.6kb
green  open   apm-7.2.0-2019.11.08               rfwNhFJyR1mRdssXNRp73A   1   1     205015            0     37.7mb         18.8mb
green  open   syslog-2019.11.04                  OoaAXVTwRhiJfMlCFqI27Q   1   1       1469            0      1.3mb        713.4kb
green  open   .monitoring-kibana-7-2019.11.08    npniaHZzR4SFW4OxTjzldQ   1   1      11374            0      4.2mb          2.1mb

Data Sources / Elasticsearch

HTTP
URL : http://elasticsearch:9200
Access : Server (Default)

Auth
No auth is selected.

Elasticsearch details
Index name : metricbeat-7.2.0-2019.10.22-000003
Pattern : No pattern
Time field name : @timestamp
Version : 7.0+
Max concurrent Shard Requests : 5
Min time interval : 10s

Logs
Message field name : (Blank)
Level field name : (Blank)

For now I just want to get metricbeat logs. How can I get this working , Also can I specify wildcard index name ?

Hi,

We are also facing same issue .
Any update on this?

Thanks & Regards,
Jalpesh

Had the same issue-ish:

  • when configuring via the UI: I could add the datasource all good
  • when configuring via datasource.yaml, I would always get that error, until I set those params:
  datasources.yaml: |
    apiVersion: 1
    datasources:
    - jsonData:
        esVersion: 70
        timeField: "@timestamp"
      name: Elasticsearch
      type: elasticsearch
      url: http://MY_HOST

ie: when adding the datasource without timeField: “@timestamp”, the UI would display that timeField is set to “@timestamp”, but in the backend, timeField would be “undefined”, thus the error " No date field named undefined found"

it’s both a UI issue (it shouldn’t something that is not set), and a backend issue: timeField should default to @timestamp

Hope this helps

note: “esVersion: 70” will set the datasource to “version 7.+”

Try to fill the index with:
metricbeat-*

Fill the pattern with no pattern.
If you use security, pelase fill the user and password accordingly.