Answer the question
In order to leave comments, you need to log in
Yii & elasticsearch match on multiple parameters?
Good afternoon!
How to execute query by name (name) and exact match to parameter (parent_id) with null? Right now I'm trying to run the following queries:
query(
[
'bool' => [
'should' => [
['match' => ['name' => '{ИМЯ}']],
],
'must' => [
['term' => ['type' => '{ТИП}']]
]
]
]
)
//Выводит значения которые совпадают или по "name" или "type"
query(
[
'bool' => [
'should' => [
['match' => ['name' => '{ИМЯ}']],
],
'must' => [
['term' => ['parent_id' => null]]
]
]
]
)
//Выдает ошибку поиска, но нужно чтобы искал по совпадению "name" и точному "parent_id == null"
Answer the question
In order to leave comments, you need to log in
Vod so: codepen.io/thetwistedtaste/pen/GgrWLp
codepen.io/MarcoGuglielmelli/pen/lLCxy
http://ru.stackoverflow.com/questions/456861/Anima...
+ To the same opera stackoverflow.com/questions/ 30965226/meteor-js-load...
Understood, the request will be like this:
query(
[
'bool' => [
'must' => [
'query_string' => ['default_field' => 'name', 'query' => "*$text*"]
],
'must_not' => [
'exists' => [
'field' => 'parent_id',
]
]
]
]
)
//Для поиска "нечеткому" значению "name" и нулевого "parent_id"
query(
[
'bool' => [
'must' => [
['query_string' => ['default_field' => 'name', 'query' => "*$text*"]],
['term' => ['parent_id' => $parentId]],
]
]
]
)
//Для поиска "нечеткому" значению "name" и значению "parent_id"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question