2016-12-14 53 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 

查詢字段可以留爲空白。