Well yes. You can create filtered quesry based on match_all query with filters that interest you, combine and / or filter. Here you want to return documents containing one of three phrases. I guess you donโt want โI like my cake and I have an iphoneโ to return.
So, something like this (I donโt know if this is enough, tough).
{ "filtered" : { "query" : { "match_all" : {} }, "filter" : { "or" : { "filters" : [{ "fquery" : { "query" : { "query_string" : { "query" : "\"I love my iphone\"", "default_field" : "searchContent", "default_operator" : "and" } } } },{ "fquery" : { "query" : { "query_string" : { "query" : "\"I love my htc\"", "default_field" : "searchContent", "default_operator" : "and" } } } }, { "fquery" : { "query" : { "query_string" : { "query" : "\"I love my samsung\"", "default_field" : "searchContent", "default_operator" : "and" } } } } ] } } }
}
source share