# AppSearch inclusive upper bounds range query

**URL:** https://discuss.elastic.co/t/appsearch-inclusive-upper-bounds-range-query/243587
**Category:** Elastic Search
**Tags:** elastic-app-search
**Created:** [August 3, 2020, 2:19pm UTC](https://discuss.elastic.co/t/appsearch-inclusive-upper-bounds-range-query/243587 "2020-08-03T14:19:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mbrimmer83](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mbrimmer83/32/52975_2.png) [@mbrimmer83](https://discuss.elastic.co/u/mbrimmer83)
#### Post date: [August 3, 2020, 2:19pm UTC](https://discuss.elastic.co/t/appsearch-inclusive-upper-bounds-range-query/243587/1 "2020-08-03T14:19:18Z")

</div>

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.

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

```

returns

```auto
 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"

```auto
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.

---

<div class="post-metadata">

### Author: ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)
#### Post date: [August 13, 2020, 4:20pm UTC](https://discuss.elastic.co/t/appsearch-inclusive-upper-bounds-range-query/243587/2 "2020-08-13T16:20:21Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [September 10, 2020, 4:20pm UTC](https://discuss.elastic.co/t/appsearch-inclusive-upper-bounds-range-query/243587/3 "2020-09-10T16:20:29Z")

</div>

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