无法在Grafana 2.x中绘制Elasticsearch Lucene查询中的图表

时间:2016-12-14 06:14:32

标签: elasticsearch lucene grafana

我正在使用Grafana和Elasticsearchas数据源。 在我的每一份文件中,我都有一个字段" id"和" lastmodifiedDate"。 我希望在表格中显示相应的上次修改日期的ID。

这是我的文件:

{
        "_index": "global_search",
        "_type": "News_Item",
        "_id": "48",
        "_score": 1,
        "_source": {
          "id": "48",
          "dueDate": 1478802600000,
          "lastModifiedDate": 1478802600000,
          "whenCreatedDate": 1477506600000,
          "ownerEmail": "abc@gmail.com",
          "owner": {
            "firstname": "ABC",
            "lastname": "Kumar",
            "email": "abc@gmail.com"
          },
          "subject": "USA','According to NBCDFW.com, an explosion at a silicon plant ",
          "status": "NEW",
          "updatedby": "ABC Kumar",
          "content": "Text data"
        }
      },
      {
        "_index": "global_search",
        "_type": "News_Item",
        "_id": "26",
        "_score": 1,
        "_source": {
          "id": "26",
          "dueDate": 1477679400000,
          "lastModifiedDate": 1477679400000,
          "whenCreatedDate": 1477506600000,
          "researchTitle": "Flash Floods Hit Parts of Southern France",
          "ownerEmail": "xyz@gmail.com",
          "owner": {
            "firstname": "XYZ",
            "lastname": "Kumar",
            "email": "xyz@gmail.com"
          },
          "subject": "Flash Floods Hit Parts of Southern France",
          "status": "MONITORING",
          "updatedby": "XYZ",
          "content": "Text2 data"
        }
      }

问题:如何根据日期的id计数表绘制表格?绘制表格的Lucene查询是什么?

1 个答案:

答案 0 :(得分:0)

您可以使用以下查询参数获取它:

Metric:
  Count
Group by:
  type: Date Histogram
  field: lastModifiedDate

查询字段可以留空。