# Ruby - Not able to apply range filter

**URL:** <https://community.swiftype.com/t/ruby-not-able-to-apply-range-filter/925>\
**Category:** General\
**Created:** [November 5, 2018, 10:45am UTC](https://community.swiftype.com/t/ruby-not-able-to-apply-range-filter/925 "2018-11-05T10:45:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinothinibj\_3](https://avatars.discourse-cdn.com/v4/letter/v/dbc845/32.png) [@vinothinibj\_3](https://community.swiftype.com/u/vinothinibj_3)\
**Post date:** [November 5, 2018, 10:45am UTC](https://community.swiftype.com/t/ruby-not-able-to-apply-range-filter/925/1 "2018-11-05T10:45:56Z")

</div>

Referred range filter and combine filter section at [Filters | Swiftype Documentation](https://swiftype.com/documentation/app-search/api/search/filters)

```auto
def talent_search
  client = SwiftypeAppSearch::Client.new(host_identifier: ENV["SWIFTYPE_HOST_IDENDIFIER"], api_key: ENV["SWIFTYPE_SEARCH_KEY"])
  engine_name = ENV["SWIFTYPE_ENGINE_NAME"]
    query = ""
  options = {
    filters: {
      all: [
        {"profile_active": "true"},
        {"desired_compensation": { from: 4000, to: 8000 } }
      ]
    },
    result_fields: { id: {raw: {}}, email: {raw: {}} }
  }

  begin
    response = client.search(engine_name, query, options)
    p response["results"], '----- SWIFTYPE RESPONSE -----'
  rescue SwiftypeAppSearch::ClientException => e
    puts e
    p '==================='
  end    
end  

```

Getting  
`Error: Filters contains invalid value for field: desired_compensation; must be a string, or an array of strings`

Please let me know what I am missing here.

---

<div class="post-metadata">

**Author:** ![jason.stoltzfus](https://sea1.discourse-cdn.com/flex019/user_avatar/community.swiftype.com/jason.stoltzfus/32/171_2.png) [@jason.stoltzfus](https://community.swiftype.com/u/jason.stoltzfus)\
**Post date:** [November 6, 2018, 3:00pm UTC](https://community.swiftype.com/t/ruby-not-able-to-apply-range-filter/925/2 "2018-11-06T15:00:27Z")

</div>

Responded here: [Not able to apply range filter · Issue #39 · swiftype/swiftype-app-search-ruby · GitHub](https://github.com/swiftype/swiftype-app-search-ruby/issues/39)
