How is everyone querying GraphQL for multiple items? | Community
Skip to main content
Level 4
February 11, 2026
Question

How is everyone querying GraphQL for multiple items?

  • February 11, 2026
  • 0 replies
  • 2 views

We have need to query GraphQL in AEM for specific content fragments with a title (for example) of X or Y. That’s easy enough to do with a query like this. This is the most common example I see. 

 

query getAdventuresByActivity(
$activity1: String!
$activity2: String!
) {
adventureList(filter: {
adventureActivity: {
_logOp: OR
_expressions: [
{ value: $activity1 }
{ value: $activity2 }
]
}
}) {
items {
_path
adventureTitle
adventureActivity
adventurePrice
adventureTripLength
}
}
}

 

Then followed by a variable like this. 

{
"activity1": "Surfing",
"activity2": "Rock Climbing"
}

The issue is that we’d like to be able to query on n number of variables and there doesn’t seem to be a facility for this. You can pass in a dynamic filter expression to the persisted query, but this only works in Graphiql. I’m wondering what other folks out there are doing for a problem like this. Are you simply making multiple single filter calls to GraphQL if you need data like this?