更新时间:2023-01-22 12:19:27
感谢 joe 的回答.我没有设法正确实现它,但我认为这是脚本解决方案的一个很好的起点.
Thanks joe for your answer. I did not manage to implement it correctly but I think this is a good starting point for a script solution.
但是,我找到了另一种方法来使用 range 和 bool/should 的组合来做我想做的事情.
However, I find another way to do what I wanted using combination of range and bool/should.
这里是:
{
"query": {
"bool": {
"filter": [
{
"range": {
"date_start": {
"lte": "now"
}
}
},
{
"bool": {
"should": [
{
"range": {
"date_end": {
"gte": "now"
}
}
},
{
"term": {
"permanent": true
}
}
]
}
}
]
}
}
}