How can I fetch linked subtasks for a specific Jira issue type using filters?

I’m using a Jira query that looks similar to the example below:

project = DEV-456 AND classification IN (OPS) ORDER BY Priority DESC

Within my project, I first create an epic and then add an issue of a certain classification. After that, I attach subtasks to this issue. I’m looking for advice on how to adjust my filter so that it retrieves both the chosen issue type and all its associated subtasks. Any guidance would be greatly appreciated.

In my experience managing similar setups in Jira, a method that worked well to retrieve both the parent issues and their subtasks was to craft a compound query that explicitly includes both sets of issues. One approach I have used is to first filter the parent issues with your criteria and then include subtasks by referencing their parent issues. For example, you can write a query that combines your original filter with an additional clause checking if the parent is in the set returned by that filter. This may not be available out of the box in all Jira instances, so using an add-on like ScriptRunner might be necessary for more advanced functionality.

In addressing a similar challenge, I determined that the solution involved leveraging advanced JQL functions to establish a connection between parent issues and their subtasks. The process began by isolating the parent issues that satisfied the necessary filter conditions. I then employed an add-on, which provided additional JQL functions, to reference these parent issues while fetching related subtasks. This approach allowed me to successfully obtain a complete view of task relationships despite native JQL limitations. Experimenting with and refining this method over time proved effective and significantly streamlined my workflow.