Skip to content

ES Query Current & Ongoing EventSeries

JenDiamond edited this page Nov 22, 2024 · 2 revisions
GET apps-dev-jendiamond-current-ftv-website/_search
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "sectionHandle.keyword": "ftvaEventSeries"
          }
        },
        {
          "bool": {
            "should": [
              {
                "bool": {
                  "filter": [
                    {
                      "term": {
                        "ongoing": true
                      }
                    },
                    {
                      "range": {
                        "startDate": {
                          "time_zone": "-08:00",
                          "lte": "now/d-8h"
                        }
                      }
                    }
                  ]
                }
              },
              {
                "bool": {
                  "filter": [
                    {
                      "term": {
                        "ongoing": false
                      }
                    },
                    {
                      "range": {
                        "startDate": {
                          "time_zone": "-08:00",
                          "lte": "now/d-8h"
                        }
                      }
                    },
                    {
                      "range": {
                        "endDate": {
                          "time_zone": "-08:00",
                          "gte": "now/d-8h"
                        }
                      }
                    }
                  ]
                }
              }
            ],
            "minimum_should_match": 1
          }
        }
      ]
    }
  },
  "sort": [
    {
      "startDate": {
        "order": "asc"
      }
    },
    {
      "_score": {
        "order": "asc"
      }
    }
  ]
}
Clone this wiki locally