2016-12-14 52 views
0

我正在使用Grafana和Elasticsearchas数据源。 在我的每一份文件上,我都有一个字段“id”和“lastmodifiedDate”。 我想显示表的ID相应的最后修改日期的计数。无法在Grafana 2.x中绘制来自Elasticsearch Lucene查询的图表

这里是我的文档:

{ 
     "_index": "global_search", 
     "_type": "News_Item", 
     "_id": "48", 
     "_score": 1, 
     "_source": { 
      "id": "48", 
      "dueDate": 1478802600000, 
      "lastModifiedDate": 1478802600000, 
      "whenCreatedDate": 1477506600000, 
      "ownerEmail": "[email protected]", 
      "owner": { 
      "firstname": "ABC", 
      "lastname": "Kumar", 
      "email": "[email protected]" 
      }, 
      "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": "[email protected]", 
      "owner": { 
      "firstname": "XYZ", 
      "lastname": "Kumar", 
      "email": "[email protected]" 
      }, 
      "subject": "Flash Floods Hit Parts of Southern France", 
      "status": "MONITORING", 
      "updatedby": "XYZ", 
      "content": "Text2 data" 
     } 
     } 

问题:如何用ID的日期根据计数绘制表格什么是确切的Lucene的查询来绘制表格?

回答

0

你可以用下面的查询参数得到它:

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

查询字段可以留为空白。