在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" : "哈哈"
}
}
]
}
不知道是什么原因导致的 试了好几个版本和不同的环境,设置都没有生效
具体设计如下
"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" : "哈哈"
}
}
]
}
不知道是什么原因导致的 试了好几个版本和不同的环境,设置都没有生效
1 个回复
locatelli
赞同来自: qiye
在上面这个例子中”title"被从"_source"里排除了,但这是发生在"title"被index之后。也就是说"_source"里不储存"title"但本身"title"这个字段仍然可以搜索。