更新时间:2022-05-28 23:30:45
您可以使用源过滤(已在 v. 1.6 和 v. 1.7 中测试):https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering.html
You can use Source Filtering (Tested in v. 1.6 and v. 1.7): https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering.html
{
"_source": {
"include": [ "obj1.*", "obj2.*" ],
"exclude": [ "*.description" ]
},
"query" : {
"term" : { "user" : "kimchy" }
}
}
您也可以在 GET 请求中使用它:
You can also use it in GET request:
curl "localhost:9200/myindex/mytype/66a8f299870b4cab?_source_exclude=file._content&pretty"
前面的示例排除了附件字段中的文件内容.
The previous example exclude the file content in an attachment field.