Search code examples
amazon-cloudsearch

Amazon CloudSearch filter query on range of values


I am trying to filter a CloudSearch using the filterQuery property. I would like to pass a non-successive range of values, but can't seem to understand the correct syntax. I can pass a single value:

filterQuery = (and category_id:97)

and a range:

filterQuery = (or category_id:[97,98])

but not this:

filterQuery = (or category_id:[97,98,135,172])

The API docs are here: http://docs.aws.amazon.com/cloudsearch/latest/developerguide/search-api.html#structured-search-syntax

I think the long-hand way of using (or category_id:97) (or category_id:97) also works, but seems like I'm missing a trick.


Solution

  • That's not really the correct "long-hand" syntax, but it is the only way to do it:

    (or category_id:97 category_id 98 ...)