Hello!
I look at "Elasticsearch Do's, Don'ts and Pro-Tips - Itamar Syn Hershko" video tutorial at
https://www.youtube.com/watch?v=c9O5_a50aOQ I see condition on several
fiedls https://imgur.com/a/17zAZ4w and try to make it in my Laravel 5.7 app(with elasticsearch/elasticsearch plugin) as :
$elasticQuery = [
"bool" => [
"must" => [
"multi_match" => [
"query" => $text,
"fields" => ["name^4", "description"]
],
],
"should" => [
"term" => [
"category_id" => 1,
]
]
]
];
But I got error :
{"error":{"root_cause":[{"type":"parsing_exception","reason":"[bool] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":133}],"type":"parsing_exception","reason":"[bool] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":133},"status":400}
Can you say why error and which syntax is valid?
When I use simple condition:
$elasticQuery = [
'multi_match' => [
'query' => $text,
'fields' => ['name^4', 'description'],
],
];
I got valid results as I expected...
Thanks!