Jin*_*Lee 3 database lucene elasticsearch grafana
我在Elasticsearch中有以下数据。(由于数据有点长,我将其附加在底部。)我试图弄清楚如何查询以便在 Grafana 的图表上显示某些内容。
\n\n我知道我在elasticsearch中的数据不适合图形,但我没有任何其他示例数据,我只是想学习如何处理这个查询。我已经用mysql 和 grafana做了类似的事情。(数据不适合图表,但我设法使其如下图所示)\n
我想用 Elasticsearch 来完成上述操作。由于他们使用Lucene查询(与 Mysql 不同),我阅读了一些相关信息。但我不知道该把什么放在哪里。我想在图表上显示metascore或投票(请查看底部的Json )。
\n\n\n\n我用的是邮递员。
\n
\n这里是JSON类型数据。(我想使用“投票”或“元分数”出现在图表上)
{\n "took": 113,\n "timed_out": false,\n "_shards": {\n "total": 1,\n "successful": 1,\n "skipped": 0,\n "failed": 0\n },\n "hits": {\n "total": {\n "value": 8,\n "relation": "eq"\n },\n "max_score": 1,\n "hits": [\n {\n "_index": "movies",\n "_type": "movie",\n "_id": "dzb6AGoBnuCYnlTWZNmc",\n "_score": 1,\n "_source": {\n "name": "Justice League",\n "genre": "Action",\n "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",\n "yearofrelease": 201,\n "metascore": 45,\n "votes": 275122,\n "rating": 6.6\n }\n },\n {\n "_index": "movies",\n "_type": "movie",\n "_id": "1",\n "_score": 1,\n "_source": {\n "name": "Justice League1",\n "genre": "Action1",\n "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",\n "yearofrelease": 201,\n "metascore": 45,\n "votes": 275122,\n "rating": 6.6\n }\n },\n {\n "_index": "movies",\n "_type": "movie",\n "_id": "2",\n "_score": 1,\n "_source": {\n "name": "Justice League",\n "genre": "Action",\n "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",\n "yearofrelease": 2011,\n "metascore": 45,\n "votes": 275122,\n "rating": 6.6\n }\n },\n {\n "_index": "movies",\n "_type": "movie",\n "_id": "hDYYAWoBnuCYnlTWyNmZ",\n "_score": 1,\n "_source": {\n "name": "Thor Ragnarok",\n "genre": "Action",\n "summary": "Thor is imprisoned on the planet Sakaar, and must race against time to return to Asgard and stop Ragnar\xc3\xb6k, the destruction of his world, at the hands of the powerful and ruthless villain Hela",\n "yearofrelease": 2017,\n "metascore": 74,\n "votes": 374270,\n "rating": 7.9\n }\n },\n {\n "_index": "movies",\n "_type": "movie",\n "_id": "hTYYAWoBnuCYnlTWyNmZ",\n "_score": 1,\n "_source": {\n "name": "Infinity War",\n "genre": "Sci-Fi",\n "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",\n "yearofrelease": 2018,\n "metascore": 68,\n "votes": 450856,\n "rating": 8.6\n }\n },\n {\n "_index": "movies",\n "_type": "movie",\n "_id": "hzYYAWoBnuCYnlTW-9mV",\n "_score": 1,\n "_source": {\n "name": "Thor Ragnarok",\n "genre": "Action",\n "summary": "Thor is imprisoned on the planet Sakaar, and must race against time to return to Asgard and stop Ragnar\xc3\xb6k, the destruction of his world, at the hands of the powerful and ruthless villain Hela",\n "yearofrelease": 2017,\n "metascore": 74,\n "votes": 374270,\n "rating": 7.9\n }\n },\n {\n "_index": "movies",\n "_type": "movie",\n "_id": "iDYYAWoBnuCYnlTW-9mV",\n "_score": 1,\n "_source": {\n "name": "Infinity War",\n "genre": "Sci-Fi",\n "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",\n "yearofrelease": 2018,\n "metascore": 68,\n "votes": 450856,\n "rating": 8.6\n }\n },\n {\n "_index": "movies",\n "_type": "movie",\n "_id": "iTYYAWoBnuCYnlTW-9mV",\n "_score": 1,\n "_source": {\n "name": "Christopher Robin",\n "genre": "Comedy",\n "summary": "A working-class family man, Christopher Robin, encounters his childhood friend Winnie-the-Pooh, who helps him to rediscover the joys of life",\n "yearofrelease": 2018,\n "metascore": 60,\n "votes": 9648,\n "rating": 7.9\n }\n }\n ]\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n如果这些数据无法显示在图表上,那么您能否给我一些关于可以在下面的查询和指标字段中放入哪些内容的提示,以便我在有其他示例数据时可以进行此操作。我需要一个像“metascore”这样的例子应该放在这个字段中,你需要@或_并在此处放置索引,然后在此处键入,等等)
\n\n\n