Json 从输出中隐藏超时、\u碎片、最大分数和其他默认字段
当我在弹性搜索中执行任何搜索查询时,我会得到自动添加这些字段的输出Json 从输出中隐藏超时、\u碎片、最大分数和其他默认字段,json,api,
elasticsearch,Json,Api,
elasticsearch,当我在弹性搜索中执行任何搜索查询时,我会得到自动添加这些字段的输出 { "took": 3, "timed_out": false, "_shards": { "total": 17, "successful": 17, "failed": 0 }, "hits": { "total": 122, "max_score": 10.268, "hits": [
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 17,
"successful": 17,
"failed": 0
},
"hits": {
"total": 122,
"max_score": 10.268,
"hits": [
{
"_index": "imdb",
"_type": "txt",
"_id": "f4c8929735ad",
"_score": 11.775636,
我想要的字段是源代码下的所有内容
如何从输出中过滤掉除elasticsearch中的_source之外的所有内容?您可以使用过滤路径功能仅过滤您想要的内容。类似这样的事情应该会有所帮助:
host:port/_search?pretty&filter_path=hits.hits._source
在这种情况下,您会得到如下响应:
{
"hits": {
"hits": [
{
"_source": {
"type": "type",
"date": "2018-05-10T16:54:54.162Z"
}
},
{
"_source": {
"type": "type",
"date": "2018-05-14T10:39:15.903Z"
}
}
]
}
}
有关筛选器路径的详细信息-
{
"hits": {
"hits": [
{
"_source": {
"type": "type",
"date": "2018-05-10T16:54:54.162Z"
}
},
{
"_source": {
"type": "type",
"date": "2018-05-14T10:39:15.903Z"
}
}
]
}
}