我在 Elasticsearch 中具有以下数据。(由于数据有点长,因此将其附加在底部。)我试图弄清楚如何查询以便显示 Grafana 中图形上的内容。
我知道我在Elasticsearch中的数据不适合图形,但是我没有其他示例数据,我只想学习如何处理此查询。我已经使用 mysql和grafana 完成了类似的操作。 (数据不适用于图表,但我设法使其如下图所示)
我想对Elasticsearch进行上述操作。由于他们使用 Lucene 查询(与Mysql不同),因此我阅读了一些信息。但是我不知道该放在哪里。我想在图表上显示 metascore 或 votes (请查看底部的 Json )。
我用过邮递员。
这是JSON类型数据。 (我想使用“投票”或“元得分”显示在图表上)
{
"took": 113,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 8,
"relation": "eq"
},
"max_score": 1,
"hits": [
{
"_index": "movies",
"_type": "movie",
"_id": "dzb6AGoBnuCYnlTWZNmc",
"_score": 1,
"_source": {
"name": "Justice League",
"genre": "Action",
"summary": "Fueled by his restored faith in humanity and inspired by Superman's selfless act, Bruce Wayne enlists the help of his newfound ally, Diana Prince, to face an even greater enemy",
"yearofrelease": 201,
"metascore": 45,
"votes": 275122,
"rating": 6.6
}
},
{
"_index": "movies",
"_type": "movie",
"_id": "1",
"_score": 1,
"_source": {
"name": "Justice League1",
"genre": "Action1",
"summary": "Fueled by his restored faith in humanity and inspired by Superman's selfless act, Bruce Wayne enlists the help of his newfound ally, Diana Prince, to face an even greater enemy",
"yearofrelease": 201,
"metascore": 45,
"votes": 275122,
"rating": 6.6
}
},
{
"_index": "movies",
"_type": "movie",
"_id": "2",
"_score": 1,
"_source": {
"name": "Justice League",
"genre": "Action",
"summary": "Fueled by his restored faith in humanity and inspired by Superman's selfless act, Bruce Wayne enlists the help of his newfound ally, Diana Prince, to face an even greater enemy",
"yearofrelease": 2011,
"metascore": 45,
"votes": 275122,
"rating": 6.6
}
},
{
"_index": "movies",
"_type": "movie",
"_id": "hDYYAWoBnuCYnlTWyNmZ",
"_score": 1,
"_source": {
"name": "Thor Ragnarok",
"genre": "Action",
"summary": "Thor is imprisoned on the planet Sakaar, and must race against time to return to Asgard and stop Ragnarök, the destruction of his world, at the hands of the powerful and ruthless villain Hela",
"yearofrelease": 2017,
"metascore": 74,
"votes": 374270,
"rating": 7.9
}
},
{
"_index": "movies",
"_type": "movie",
"_id": "hTYYAWoBnuCYnlTWyNmZ",
"_score": 1,
"_source": {
"name": "Infinity War",
"genre": "Sci-Fi",
"summary": "The Avengers and their allies must be willing to sacrifice all in an attempt to defeat the powerful Thanos before his blitz of devastation and ruin puts an end to the universe",
"yearofrelease": 2018,
"metascore": 68,
"votes": 450856,
"rating": 8.6
}
},
{
"_index": "movies",
"_type": "movie",
"_id": "hzYYAWoBnuCYnlTW-9mV",
"_score": 1,
"_source": {
"name": "Thor Ragnarok",
"genre": "Action",
"summary": "Thor is imprisoned on the planet Sakaar, and must race against time to return to Asgard and stop Ragnarök, the destruction of his world, at the hands of the powerful and ruthless villain Hela",
"yearofrelease": 2017,
"metascore": 74,
"votes": 374270,
"rating": 7.9
}
},
{
"_index": "movies",
"_type": "movie",
"_id": "iDYYAWoBnuCYnlTW-9mV",
"_score": 1,
"_source": {
"name": "Infinity War",
"genre": "Sci-Fi",
"summary": "The Avengers and their allies must be willing to sacrifice all in an attempt to defeat the powerful Thanos before his blitz of devastation and ruin puts an end to the universe",
"yearofrelease": 2018,
"metascore": 68,
"votes": 450856,
"rating": 8.6
}
},
{
"_index": "movies",
"_type": "movie",
"_id": "iTYYAWoBnuCYnlTW-9mV",
"_score": 1,
"_source": {
"name": "Christopher Robin",
"genre": "Comedy",
"summary": "A working-class family man, Christopher Robin, encounters his childhood friend Winnie-the-Pooh, who helps him to rediscover the joys of life",
"yearofrelease": 2018,
"metascore": 60,
"votes": 9648,
"rating": 7.9
}
}
]
}
}
如果无法在图表上显示此数据,那么您能否给我一些提示,以说明如何在下面的查询和指标字段中添加内容,以便在有其他示例数据时可以使用此提示。我需要在该字段中输入“ metascore”之类的示例,并且您需要@或_并在此处放置索引,然后在其中键入,等等)