Reputation: 769
I am new to ElasticSearch, and I am trying to solve a query the best way possible. I'm using PHP so it would be helpful to get to view it in that format, but I am ok to see it in any ElasticSearch DSL.
The query I need basically has to match Any or All words in multiple fields, say for example [title, description]
But I also want to only include any documents that can be filtered by any true case (example if the Document has "either" field1 = true OR field2 = true)
So example I search for "Nike boots that are green"
So for I would like to see results that would have Nike boots and Green so I could just do
'query' => [
'query_string' => [
'fields' => [ 'title^6', 'description^3' ],
'query' => 'Nike boots that are green'
],
],
And I get all content that has the best score. What I really want to add to my results are basically "filters" or "should " that if the Document either has field 'access' == 1 OR field 'permission' == 5, how will I do that. I know now that it needs to be a boolean.
Is it possible to have both query and boolean query in the same search?
Upvotes: 0
Views: 187
Reputation: 845
the query_string query supports OR
'query' => [
'query_string' => [
'query' => 'access:1 OR permission:5'
],
],
Upvotes: 1