# What Is The True Meaning Of IS NOT BETWEEN?

**URL:** https://discuss.elastic.co/t/what-is-the-true-meaning-of-is-not-between/237615
**Category:** Kibana
**Created:** [June 18, 2020, 10:40am UTC](https://discuss.elastic.co/t/what-is-the-true-meaning-of-is-not-between/237615 "2020-06-18T10:40:55Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Ethan777100](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ethan777100/32/70366_2.png) [@Ethan777100](https://discuss.elastic.co/u/Ethan777100)
#### Post date: [June 18, 2020, 10:40am UTC](https://discuss.elastic.co/t/what-is-the-true-meaning-of-is-not-between/237615/1 "2020-06-18T10:40:55Z")

</div>

i just implemented a filter to find the count of values that are not within -300 to 300

![image](https://us1.discourse-cdn.com/elastic/original/3X/4/e/4e5dab04102e243371600ff28b93cf0cce113cf6.png)

But in my results, why do i still see 3 rows of 300?

![image](https://us1.discourse-cdn.com/elastic/original/3X/e/5/e59f561d6cbcf8891ec9f9533f4ae46924ab2467.png)

I would interpret IS NOT BETWEEN to be inclusive of the range boundaries. I am indeed looking for the count of values starting frm +/-301

any advice?

---

<div class="post-metadata">

### Author: ![Ethan777100](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ethan777100/32/70366_2.png) [@Ethan777100](https://discuss.elastic.co/u/Ethan777100)
#### Post date: [June 18, 2020, 12:12pm UTC](https://discuss.elastic.co/t/what-is-the-true-meaning-of-is-not-between/237615/2 "2020-06-18T12:12:18Z")

</div>

i did a further check, i think there is smth wrong with IS NOT BETWEEN FILTER.

I experimented with NOT BETWEEN -301 to 301

![image](https://us1.discourse-cdn.com/elastic/original/3X/8/c/8c75acdad5321835693671c873ebfa9119474b3a.png)

And look at the result. The negative case is correctly addressed: "-301" values are excluded in the results.

But the positive case is incorrect because "+301" is still shown even tho I already defined it in my range.

![image](https://us1.discourse-cdn.com/elastic/original/3X/5/b/5b1c2676aad81291d634829f6e0ef574dff21971.png)

So what is the true essence of IS NOT BETWEEN then?

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [June 18, 2020, 12:17pm UTC](https://discuss.elastic.co/t/what-is-the-true-meaning-of-is-not-between/237615/3 "2020-06-18T12:17:48Z")

</div>

"IS NOT BETWEEN" is producing the following clause in the underlying ES query (example is "bytes is not between 5 and 10"):

```auto
must_not": [
        {
          "range": {
            "bytes": {
              "gte": 5,
              "lt": 10
            }
          }
        }
      ]

```

As you can see here, for the lower bound "gte" (greater than equal) is used, while for the upper bound "lt" (lower than) is used. This means "IS NOT BETWEEN" will filter out everything 5 to up to 9 bytes (inclusive lower bound, exclusive upper bound)

---

<div class="post-metadata">

### Author: ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)
#### Post date: [June 18, 2020, 12:17pm UTC](https://discuss.elastic.co/t/what-is-the-true-meaning-of-is-not-between/237615/4 "2020-06-18T12:17:49Z")

</div>

I know MySQL and MSSQL the NOT BETWEEN includes the boundaries. So if they follow the common interpretation it would be the same. It essentially says not between and including the min/max range.

I 100% agree the term is confusing.

---

<div class="post-metadata">

### Author: ![Ethan777100](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ethan777100/32/70366_2.png) [@Ethan777100](https://discuss.elastic.co/u/Ethan777100)
#### Post date: [June 18, 2020, 12:18pm UTC](https://discuss.elastic.co/t/what-is-the-true-meaning-of-is-not-between/237615/5 "2020-06-18T12:18:39Z")

</div>

thanks so much of ur responses!

So can i ascertain there is indeed an issue with the filter? 🙂

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [June 18, 2020, 12:19pm UTC](https://discuss.elastic.co/t/what-is-the-true-meaning-of-is-not-between/237615/6 "2020-06-18T12:19:43Z")

</div>

It's definitely worth creating an issue for this in the Github repo: [https://github.com/elastic/kibana/issues/new/choose](https://github.com/elastic/kibana/issues/new/choose)

It's not necessarily wrong, but I agree it's confusing behavior.

---

<div class="post-metadata">

### Author: ![Ethan777100](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ethan777100/32/70366_2.png) [@Ethan777100](https://discuss.elastic.co/u/Ethan777100)
#### Post date: [June 18, 2020, 12:20pm UTC](https://discuss.elastic.co/t/what-is-the-true-meaning-of-is-not-between/237615/7 "2020-06-18T12:20:26Z")

</div>

shld it be a Bug Report? ur advice pls

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [June 18, 2020, 12:23pm UTC](https://discuss.elastic.co/t/what-is-the-true-meaning-of-is-not-between/237615/8 "2020-06-18T12:23:04Z")

</div>

You can file it as a bug, if it's deemed expected behavior the team can change the labels afterwards.

---

<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: [July 16, 2020, 12:23pm UTC](https://discuss.elastic.co/t/what-is-the-true-meaning-of-is-not-between/237615/9 "2020-07-16T12:23:24Z")

</div>

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