Answer the question
In order to leave comments, you need to log in
Easticsearch how to filter by business hours?
Good afternoon. Can't filter organizations by opening hours.
There are such objects:
{
{
id:10,
business_hours : [
{type:1,from:"0000", to:'0000'},
{type:2,from:"0900", to:'2000'},
{type:2,from:"0900", to:'2000'},
{type:3,from:"0900", to:'2000'},
.....
]
}
}
$filter = [
'bool' => [
'should' => [
[
['term' => ['business_hours.0.type' => '1']], // круглосуточно
[
'bool' => [
'must' => [
['range' => ['business_hours.0.from' => ['lte' => '1000']]],
['range' => ['business_hours.0.to' => ['gte' => '1200']]],
['term' => ['business_hours.0.type' => 2]], // активно
]
],
]
]
]
]
];
['term' => ['business_hours.0.type' => '1']], // круглосуточно
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question