使用以下查询:
GET feeds/_search
{
"query": {
"nested": {
"path": "comment",
"query": {
"multi_match": {
"query": "ali",
"fields": ["body","title","comment.c_text"]
}
}
}
}
}
我正在得到结果
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 0.8025915,
"hits" : [
{
"_index" : "feeds",
"_type" : "_doc",
"_id" : "NeoTNIUB1Qg_7rFp-8RV",
"_score" : 0.8025915,
"_source" : {
"feed_id" : "1",
"title" : "Mateen",
"body" : "This is mateen",
"comment" : [
{
"c_id" : "11",
"feed_id" : "1",
"c_text" : "get well soon mateen"
},
{
"c_id" : "12",
"feed_id" : "1",
"c_text" : " Ali here"
}
]
}
}
]
}
}
我不想看到我的第一条记录,因为它在body、title、comment_text中不包含“ali”。有人能帮忙吗?我想如果它搜索“ali”,那么它将返回提要id title body以及注解id feed id和c_text,但不显示不包含ali的数组的内容。隐藏它
{
"c_id" : "11",
"feed_id" : "1",
"c_text" : "get well soon mateen"
}
我不想看到这内容在我的输出
1条答案
按热度按时间lvmkulzt1#
首先,按如下方式更新Map:
然后运行此查询