xm cloud – GraphQL Authoring API: How to do nested OR criteria within an AND

I know how to do a query where each criteria defaults to OR

searchStatement: {
  criteria: [
    { criteriaType: SEARCH, field: "_template", value: "455a3e98a6274b408035e683a0331ac7" }, 
    { criteriaType: SEARCH, field: "_path", value: "f46b5e68ca11426e96de443cd08d8efe" },     
    { criteriaType: SEARCH, field: "_language", value: "en" }
  ]
 }

And I can make it so that all criteria are required:

searchStatement: {
  criteria: [
    { criteriaType: SEARCH, field: "_template", value: "455a3e98a6274b408035e683a0331ac7", operator:MUST }, 
    { criteriaType: SEARCH, field: "_path", value: "f46b5e68ca11426e96de443cd08d8efe", operator:MUST }, 
    { criteriaType: SEARCH, field: "_language", value: "en", operator:MUST }
  ]
}

But the issue is that I’m trying to do a search for multiple possible path filters and multiple possible template filters. In other words, it should be template = (a OR b) AND path contains (c OR d)

I tried formatting it as nested subSearchStatements as shown below, but this still gives results that have match of the paths OR one of the templates. I need all results to match one (or more) path AND one template

  searchStatement: {
      criteria: [
        { criteriaType: SEARCH, field: "_language", value: "en", operator:MUST }
      ]
      subStatements: {
        criteria: [
          { criteriaType: SEARCH, field: "_path", value: "f46b5e68ca11426e96de443cd08d8efe" }
          { criteriaType: SEARCH, field: "_path", value: "dfed4457d760457abec1c0dccdc44381" }
        ]
        subStatements:{
          criteria:[
            { criteriaType: SEARCH, field: "_template", value: "455a3e98a6274b408035e683a0331ac7"}, 
            { criteriaType:SEARCH, field:"_template", value:"e269fbb53750427a91497aa950b49301"}
          ]
        }
      }
    }

Read more here: Source link