找到问题的解决办法了么?

设置_source的enbaled为false,查询时仍然返回了所有的元数据

Elasticsearch | 作者 pansen | 发布于2020年01月13日 | 阅读数:1994

在es 7.1.1中,设置_source的enbaled为false,查询时仍然返回了所有的元数据.
具体设计如下
"mappings": {

"_source":{
"excludes":["title"]
},
"properties": {
"title": {
"type": "text"
},
"name": {
"type": "text"
},
"age": {
"type": "integer"
},
"created": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
}
}

}

返回结果如下
},
{
"_index" : "rettt",
"_type" : "_doc",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"name" : "张三",
"title" : "哈哈"
}
}
]
}

不知道是什么原因导致的 试了好几个版本和不同的环境,设置都没有生效
已邀请:

locatelli

赞同来自: qiye

你对_source的用法可能有误解。
在上面这个例子中”title"被从"_source"里排除了,但这是发生在"title"被index之后。也就是说"_source"里不储存"title"但本身"title"这个字段仍然可以搜索。

要回复问题请先登录注册