How to fetch list of task details in Camunda?

We have a requirement to fetch 40-60 taskdetails. Is there any way to fetch all task details at once by passing all task IDs?
Currently we are using below query to fetch task details. but the problem here is we have to calling this query for 50-60 times in look by passing taskID one at a time.

private TaskService taskService;
TaskDetails taskDetails = (TaskDetails) taskService.getVariable(task.getId(), "taskDetails");

Also TaskDetails object has a property called “fileName”, can we form query to fetch list of TaskDetails where fileName is like ‘%ABCD%’? Is it possible to form the custom query?