ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# Named Queries 原文链接 : [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-named-queries-and-filters.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-named-queries-and-filters.html) 译文链接 : [http://www.apache.wiki/pages/editpage.action?pageId=4883114](http://www.apache.wiki/pages/editpage.action?pageId=4883051) 贡献者 : [ping](/display/~wangyangting) 每个过滤器和查询可以在其顶级定义中接受一个 _name。 ``` GET /_search { "query": { "bool" : { "should" : [ {"match" : { "name.first" : {"query" : "shay", "_name" : "first"} }}, {"match" : { "name.last" : {"query" : "banon", "_name" : "last"} }} ], "filter" : { "terms" : { "name.last" : ["banon", "kimchy"], "_name" : "test" } } } } } ``` 搜索响应将为每个匹配包括其匹配的 matched_queries。 查询和过滤器的标记仅对布尔查询有意义。