我有以下查询:
GET /networkcollection/branch_routers/_search/
{
"query": {
"nested": {
"path": "queries",
"query": {
"bool": {
"must": [
{ "match":
{ "queries.dateQuery": "20160101T200000.000Z" }
}
]
}
},
"inner_hits" : {}
}
}
}
这将返回"命中"对象(整个文档),以及" inner_hits"对象(嵌套在命中内)。
有没有办法让我只返回匹配的"查询"元素出现在" inner_hits"结果,没有得到整个文件?
答案 0 :(得分:16)
应该可以通过指定"_source" : false
POST /networkcollection/branch_routers/_search/
{
"_source" : false,
"query": {
"nested": {
"path": "queries",
"query": {
"bool": {
"must": [
{ "match":
{ "queries.dateQuery": "20160101T200000.000Z" }
}
]
}
},
"inner_hits" : {}
}
}
}