code: public List<Workflow> getWorkflowsByCorrelationId(String correlationId, boolean includeTasks) {
          if (!executionDAO.canSearchAcrossWorkflows()) {
              List<Workflow> workflows = new LinkedList<>();
              SearchResult<String> result = indexDAO.searchWorkflows("correlationId='" + correlationId + "'", "*", 0, 10000, null);
              result.getResults().forEach(workflowId -> {
                  try {
                      Workflow workflow = getWorkflowById(workflowId, includeTasks);
                      workflows.add(workflow);
                  } catch (ApplicationException e) {
                      //This might happen when the workflow archival failed and the workflow was removed from dynomite
                      LOGGER.error("Error getting the workflowId: {}  for correlationId: {} from Dynomite/Archival", workflowId, correlationId, e);
                  }
              });
              return workflows;
          }
          return executionDAO.getWorkflowsByCorrelationId(correlationId, includeTasks);
      }
docs: Retrieve all workflow executions with the given correlationId
  Uses the {@link IndexDAO} to search across workflows if the {@link ExecutionDAO} cannot perform searches across workflows.
  
  @param correlationId the correlation id to be queried
  @param includeTasks  if true, fetches the {@link Task} data within the workflows
  @return the list of {@link Workflow} executions matching the correlationId