Query for end date greater than now or doesn't exist not working

My 'must' query works fine but the should returns the following error:
"No query registered for [exists]"

I want to find documents that either do not have a stopPublishDate or if they do have one the date must be in the future/ greater than 'now'.


 requestBody = {
    "size": 1000,
    "query": {
      "bool": {

        "must": [
          {
            "match": {
              "_TypeShortName": "AlertPage"
            }
          },
          {
            "term": {
              'IsDeleted$$bool': false
            }
          },
          {
            "range": {
              'StartPublish$$date': {
                'lte': 'now'
              }
            }
          }
        ],

        "should": [
          {
            "range": {
              "StopPublish$$date": {
                "gte": 'now'
              }
            }
          },
          {
            "bool": {
              "must_not": [
                {
                  "exists": {
                    "field": "StopPublish$$date"
                  }
                }
              ]
            }
          }

        ]



      }

    }
  }

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.