且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何获取当前时间作为Unix时间戳以供脚本使用

更新时间: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
                }
              }
            ]
          }
        }
      ]
    }
  }
}