ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
# Fields 原文链接 : [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-stored-fields.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-stored-fields.html) 译文链接 : [http://www.apache.wiki/pages/editpage.action?pageId=4883086](http://www.apache.wiki/pages/editpage.action?pageId=488308) 贡献者 : [ping](/display/~wangyangting) Warning: stored_fields 参数是关于显式标记为存储在映射中的字段,默认情况下关闭,通常不推荐。 使用源过滤来选择要返回的原始源文档的子集。 允许有选择地加载搜索匹配所表示的每个文档的特定存储字段。 ``` GET /_search { "stored_fields" : ["user", "postDate"], "query" : { "term" : { "user" : "kimchy" } } } ``` * 可用于从文档加载所有存储的字段。 空数组只会为每个匹配返回 _id 和 _type,例如: ``` GET /_search { "stored_fields" : [], "query" : { "term" : { "user" : "kimchy" } } } ``` 如果请求的字段未存储(存储映射设置为 false ),它们将被忽略。 从文档本身获取的存储字段值总是作为数组返回。 相反,诸如 _routing 和 _parent 字段的元数据字段从不作为数组返回。 此外,只有叶子字段(leaf field)可以通过字段选项返回。 因此,无法返回对象字段,并且此类请求将失败。 脚本字段也可以自动检测并用作字段,所以像 _source.obj1.field1 这样的东西可以使用,虽然不推荐,因为 obj1.field1 也会工作。 Disable stored fields entirely 要禁用存储的字段(和元数据字段),请完全使用:\ _none_: ``` GET /_search { "stored_fields": "_none_", "query" : { "term" : { "user" : "kimchy" } } } ``` Note: 如果使用 _none_ ,  _source 和 version 参数不能激活 。