【发布时间】:2020-03-27 14:07:02
【问题描述】:
我在使用 Elastic Search (ES) 检索 JSON 对象时遇到问题。现在,当我尝试使用下面的请求体从 ES 中查询一些数据时,
"_source": [
"data.id",
"data.completed",
"data.label",
"data.url",
"data.mobile"
],
"query": {
...
}
我总是以
的形式得到响应{
"took": 225,
"timed_out": false,
"_shards": {
...
},
"hits": {
"total": {
...
},
"max_score": null,
"hits": [
{
...
"_source": {
"data": {
"mobile": 1,
"label": "EU Mobile Test",
"completed": 1582990420,
"id": "2002",
"url": "http://www.example.com/"
}
},
...
},
...
]
}
}
有没有一种方法可以直接通过请求正文检索 JSON 子级信息?使响应类似于:
{
"took": 225,
"timed_out": false,
"_shards": {
...
},
"hits": {
"total": {
...
},
"max_score": null,
"hits": [
{
...
"_source": {
"mobile": 1,
"label": "EU Mobile Test",
"completed": 1582990420,
"id": "2002",
"url": "http://www.example.com/"
},
...
},
...
]
}
}
【问题讨论】:
-
请问您这样做的原因是什么?你要解决什么问题?
-
我正在尝试使用 Redash 可视化 Elastic Search 返回的数据。但是 Redash 似乎无法识别第一种数据格式。
-
Elasticsearch 响应如何输入到 Redash?
标签: elasticsearch elasticsearch-dsl