# \[bool\] query does not support \[range\]

**URL:** <https://discuss.elastic.co/t/bool-query-does-not-support-range/169536>\
**Category:** Elasticsearch\
**Created:** [February 22, 2019, 8:56am UTC](https://discuss.elastic.co/t/bool-query-does-not-support-range/169536 "2019-02-22T08:56:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajkumar\_E1](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@rajkumar\_E1](https://discuss.elastic.co/u/rajkumar_E1)\
**Post date:** [February 22, 2019, 8:56am UTC](https://discuss.elastic.co/t/bool-query-does-not-support-range/169536/1 "2019-02-22T08:56:41Z")

</div>

Dear Team,

I am working on to filter record with match + range filter, but its throw following issue "[bool] query does not support [range]"

**What I did:**

```
    Array
    (
        [index] => index_name
        [type] => type_name
        [from] => 0
        [size] => 20
        [body] => Array
            (
                [query] => Array
                    (
                        [bool] => Array
                            (
                                [should] => Array
                                    (
                                        [0] => Array
                                            (
                                                [match] => Array
                                                    (
                                                        [field1.field2.keyword] => awdweqweqwe
                                                    )

                                            )

                                        [1] => Array
                                            (
                                                [match] => Array
                                                    (
                                                        [field3] => 
                                                    )

                                            )

                                        [2] => Array
                                            (
                                                [match] => Array
                                                    (
                                                        [field3] => data
                                                    )

                                            )

                                        [3] => Array
                                            (
                                                [match] => Array
                                                    (
                                                        [field4] => 201
                                                    )

                                            )

                                    )

                                [range] => Array
                                    (
                                        [status] => Array
                                            (
                                                [gte] => 201
                                                [lte] => 1000
                                            )

                                    )

                            )

                    )

                [sort] => Array
                    (
                        [0] => Array
                            (
                                [updated_date] => Array
                                    (
                                        [order] => desc
                                    )

                            )

                    )

            )

    )

```

Please suggest me, How to get range with match search data.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 22, 2019, 2:58pm UTC](https://discuss.elastic.co/t/bool-query-does-not-support-range/169536/2 "2019-02-22T14:58:20Z")

</div>

range should be in the `should` array or in a `must` array depending on what you want to do.  
Read more on Bool query here: [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html)

---

<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:** [March 22, 2019, 2:58pm UTC](https://discuss.elastic.co/t/bool-query-does-not-support-range/169536/3 "2019-03-22T14:58:27Z")

</div>

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