Search code examples
amazon-web-servicesamazon-cloudsearch

AWs Cloudsearch Complex filtering


When filtering data in Cloudsearch, I am using:

&fq=(and type:1 sub_type:0)

What I want to do is add more to this but instead of being AND it needs to be OR

So that the query is like:

filter: 
      type=1
   and
      sub_type=0
   and
      color=red or color = blue

How would I construct the filter to do this?


Solution

  • It would look like this (the boolean operators can take any number of args):

    fq=(and type:1 sub_type:0 (or color:'red' color:'blue'))
    

    See http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-compound-queries.html