2017-02-15 77 views
1

我在彈性搜索數據庫中有以下記錄。Elastic Search中的複雜搜索查詢5

{ 
    "frd": "2017-06-30", 
    "tim": "2017-01-19T11:02:21.847", 
    "tpr": 2276.5 
    }, 
    { 
    "frd": "2017-06-29", 
    "tim": "2017-01-19T11:02:21.847", 
    "tpr": 2408.5 
    }, 
    { 
    "frd": "2017-06-28", 
    "tim": "2017-01-20T12:01:08.358", 
    "tpr": 2408.5 
    }, 
    { 
    "frd": "2017-06-30", 
    "tim": "2017-01-20T12:01:08.358", 
    "tpr": 2276.5 
    }, 
    { 
    "frd": "2017-06-30", 
    "tim": "2017-01-20T17:35:17.495", 
    "tpr": 2408.5 
    }, 
    { 
    "frd": "2017-06-30", 
    "tim": "2017-01-19T10:04:44.586", 
    "tpr": 2276.5 
    }, 
    { 
    "frd": "2017-06-30", 
    "tim": "2017-01-19T10:15:46.051", 
    "tpr": 2276.5 
    } 

彈性版本5.我要創建從上面的數據集多系列折線圖,所以我想從下面上述數據新json

[ 
    { 
    "tim": "2017-01-19T11:02:21.847", 
    "2017-06-28": null, 
    "2017-06-29": 2408.5, 
    "2017-06-30": 2276.5 
    }, 
    { 
    "tim": "2017-01-20T12:01:08.358", 
    "2017-06-28": 2408.5, 
    "2017-06-29": null, 
    "2017-06-30": 2276.5 
    }, 
    { 
    "tim": "2017-01-20T17:35:17.495", 
    "2017-06-28": null, 
    "2017-06-29": null, 
    "2017-06-30": 2408.5 
    }, 
    { 
    "tim": "2017-01-19T10:04:44.586", 
    "2017-06-28": null, 
    "2017-06-29": null, 
    "2017-06-30": 2276.5 
    }, 
    { 
    "tim": "2017-01-19T10:15:46.051", 
    "2017-06-28": null, 
    "2017-06-29": null, 
    "2017-06-30": 2276.5 
    } 
] 

X軸變爲值。 Y軸變爲tpr。行應該由frd組成。

有沒有辦法使用彈性搜索查詢從彈性數據中獲取以上圖表數據集?

謝謝

+0

如果你不能肯定,但不會爲這個解析器更容易編寫/維持相當比複雜的查詢? – nafas

+0

我可以使用彈性搜索聚合來做到這一點嗎? – Rose18

回答

0

對於可視化,你可以直接使用Kibana(v5)。在這裏,你可以直接選擇要

這裏任何領域做出折線圖是鏈接到User guide of Kibana 5.1