Hello
My data:
- shops
- working hours
- shops with each of their working hours
I have a query which returns shops from first day of the month to last day of the month including working hours.
For example:
January 1st
between 9-11 hours - shop1 - shop2 and shop 3 is available
between 11-13 hours - shop4 - shop2 - shop 5 available
January 2st
between 9-11 hours - shop4 - shop3 and shop 1 is available
between 11-13 hours - shop2 - shop1 - shop 5 available
and etc....
The problem:
How I can filter those shops that for example:
Shop 1 and 5 always won't be visible between 9-11 hours but will be visible during 11-13 hours.
I tried (I am pasting only a part of my code. Query and etc... stuff is fine. ):
However, this gives me either only range from 11 hours or range lower than 11 hours.
"filter" : {
"should": [
{
"bool": {
"must_not": [
{
"range": {
"shopStartHour": {
"lt": 11
}
}
},
{
"term": {
"shop.number": "1"
}
},
{
"term": {
"shop.number": "5"
}
}
]
}
},
{
"bool": {
"must": [
{
"range": {
"shopStartHour": {
"gt": 11
}
}
},
{
"term": {
"shop.number": "1"
}
},
{
"term": {
"shop.number": "5"
}
}
]
}
}
]
}