更新时间:2023-01-22 12:15:22
感谢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
}
}
]
}
}
]
}
}
}