💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# Source filtering 原文链接 : [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering.html) 译文链接 : [http://www.apache.wiki/pages/editpage.action?pageId=4883082](http://www.apache.wiki/pages/editpage.action?pageId=4883082) 贡献者 : [ping](/display/~wangyangting) 允许控制 _source 字段如何在每次命中返回。 默认操作返回 _source 字段的内容,除非您已使用 stored_fields 参数或禁用 _source 字段。 您可以使用 _source 参数关闭 _source 检索: 要禁用 _source 检索设置为 false: ``` GET /_search { "_source": false, "query" : { "term" : { "user" : "kimchy" } } } ``` _source 还接受一个或多个通配符模式来控制 _source 的哪些部分应该返回: 例如: ``` GET /_search { "_source": "obj.*", "query" : { "term" : { "user" : "kimchy" } } } ``` 或者 ``` GET /_search { "_source": [ "obj1.*", "obj2.*" ], "query" : { "term" : { "user" : "kimchy" } } } ``` 最后,为了完全控制,您可以指定包含和排除模式: ``` GET /_search { "_source": { "includes": [ "obj1.*", "obj2.*" ], "excludes": [ "*.description" ] }, "query" : { "term" : { "user" : "kimchy" } } } ```