# Filter (RANGE) on different fields in elasticsearch

**URL:** <https://discuss.elastic.co/t/filter-range-on-different-fields-in-elasticsearch/228613>\
**Category:** Elasticsearch\
**Created:** [April 18, 2020, 4:52am UTC](https://discuss.elastic.co/t/filter-range-on-different-fields-in-elasticsearch/228613 "2020-04-18T04:52:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeanpjm](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@jeanpjm](https://discuss.elastic.co/u/jeanpjm)\
**Post date:** [April 18, 2020, 4:52am UTC](https://discuss.elastic.co/t/filter-range-on-different-fields-in-elasticsearch/228613/1 "2020-04-18T04:52:07Z")

</div>

Hello people,

I'm a beginner in elasticsarch and I wanted this query below to work with two RANGE filters in different fields, but only the first RANGE is working.

This filter below is working normally:

"range" : {"pgrk" : { "gte" : 1, "lte" : 10} }

Could someone tell me why this second filter below doesn't work?

"should" : {  
"range" : {"url\_length" : { "gte" : 50, "lte" : 100 } }

--------------------------Follow my query below with the two filters--------------------------

```auto
{

    "from" : 0, "size" : 10,

    "sort" : [
            { "pgrk" : {"order" : "desc"} },

             { "url_length" : {"order" : "asc"} }
        ],

        "query": {

    "bool": {
    "must": {

    "multi_match" : {
    "query": "netflix",

    "type": "cross_fields",
    "fields": ["titulo", "descricao", "url"],
    "operator": "and"
            }
         },
         "filter": {
         "range" : {"pgrk" : { "gte" : 1, "lte" : 10 } }
          },

    "should" : {
            "range" : {"url_length" : { "gte" : 50, "lte" : 100 } }
            }

            }
    }

          }

```

---

<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:** [May 16, 2020, 4:52am UTC](https://discuss.elastic.co/t/filter-range-on-different-fields-in-elasticsearch/228613/2 "2020-05-16T04:52:09Z")

</div>

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