Skip to content

Latest commit

 

History

History
executable file
·
25 lines (22 loc) · 715 Bytes

File metadata and controls

executable file
·
25 lines (22 loc) · 715 Bytes

Named Queries

每个过滤和查询在顶层定义中接受一个_name参数。

curl -XGET 'localhost:9200/_search?pretty' -d'
{
    "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。查询和过滤器的标记只对bool查询有意义。