AppSearch inclusive upper bounds range query

Is there any way to perform an inclusive upper bounds range query on a date(lte in ES)? I tried to use an all with an array on the date, but AS doesn't like this.

all: [
    {
      primary_date: [
        date,
        {
          to: date
        }
      ]
    }
  ]

returns

 App Search Error:  [
  'Filters contains invalid value for field: ' +
  'primary_date; must be a date (RFC 3339), an ' +
  'array of dates, or a range object with `to` and/or ' +
  '`from` keys'
]

Is there anyway I can achieve this behavior in AppSearch? Since it using ES under the hood, I would expect this to be available. This becomes even more important when you consider AppSearch date precision limits.

Update:
The only way I have been able to get this working is to nest an "any" in an "all"

all: [{
    any: [
      { primary_date: { to: date } },
      { primary_date: date }
    ]
}]

I am still interested to see if there is another or better way to do this.

That's not currently possible, to my knowledge. Your workaround may be the only solution.

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