WHERE clause on ElasticSearch

Hello people,

I'm starting to work on elasticsearch and I would like you to help me with the question below.

I have a query on elasticsearch that searches for a keyword in three fields, (title, description and url) and returns the docs that have the keyword in any of the fields. Follow the query below:

‘index’ => $this->index,
‘body’ => [
‘from’ => $pag - 1,
‘size’ => 11,
‘query’ => [
“multi_match” => [
“query” => $value,
“type” => “cross_fields”,
“fields” => [ “titulo”, “descricao”, "url ],
“operator” => “and”

However, I wanted to put the query WEHRE that we use in mysql for the query to find the docs that contain the keywords in the fields (title, description and url) and that the field (relevance) is = 9 or 10

It would look like this: Find all the docs that contain the keyword (car) in the field (title, description and url) WHERE field (relevance) is = 9 or 10)

Could someone help me like my query above, showing how my query should look so the docs found will only be returned if the field (relevance) is = 9 or 10


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.