我的弹性搜索数据库中有以下记录。
{
"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轴变为 tim 值。 Y轴变为 tpr 。行应按
有没有办法通过弹性搜索查询从弹性数据中获取图表数据集?
谢谢