从数据存储执行GET时,我会在body.hits.hits
中返回_id
、_index_
、_type
和_score
,但只希望数据在_source
中
例如:
[
{
"_index": "first-entry",
"_type": "_doc",
"_id": "IRQf0nkBaWzRmI7XDody",
"_score": 0.2876821,
"_source": {
"Hello": "World!"
}
},
{
"_index": "first-entry",
"_type": "_doc",
"_id": "IhQr0nkBaWzRmI7XZIeC",
"_score": 0.2876821,
"_source": {
"Hello": "world!"
}
}
]
有没有一种方法可以过滤掉这些信息,或者只是将其排除在外?
您可以使用响应过滤来实现此目的:
GET index/_doc/123?filter_path=hits.hits._source