0

I have a nested query like this

{  
"fields" : ["title","wordCount"],
"query":{
    "bool":{

            "should":[
        {
            "match":{
                "title":{
                    "query": searchTerm,
                    "operator": "and"    
                }
            }
        },
                {
                    "match_phrase" :{

                        "postHtml":{

                        "query" : searchTerm,
                        "slop" : 1    
                     }

                    }        
                },
                {
                    "match":{
                        "caption" : searchTerm
                    }
                }
            ]
        }
    }
}

Is there a way know if there is a match on caption or postHtml?

4

1 回答 1

1

您可以将每个查询包装到一个命名过滤器中;elasticsearch 将返回匹配的过滤器的名称。

看看这个例子。

于 2013-06-11T07:27:27.537 回答