Process Variables for HistoryInstance is giving empty list

I am trying to query historic process instances by Process Variable. I am using the following snippet to query historic process instances by variable:

public List<HistoricVariableInstance> getProcessVariables(String tenantID, String instanceID) {
        List<HistoricVariableInstance> processVariables =
                historyService.createHistoricVariableInstanceQuery()
                        .processInstanceIdIn(instanceID).tenantIdIn(tenantID).list();
        log.info("processVariables: {}", processVariables );
        return processVariables;
    }

I have already created process instances with variables.
But the output I am getting is processVariables: []

Looking at Camunda’s JavaDoc has the following criteria:

The result of the query is empty in the following cases:

The user has no Permissions.READ_HISTORY permission on Resources.PROCESS_DEFINITION OR
The user has no HistoricTaskPermissions.READ permission on Resources.HISTORIC_TASK (enableHistoricInstancePermissions in ProcessEngineConfigurationImpl must be set to true) OR
The user has no HistoricProcessInstancePermissions.READ permission on Resources.HISTORIC_PROCESS_INSTANCE (enableHistoricInstancePermissions in ProcessEngineConfigurationImpl must be set to true) OR
The user has no ProcessDefinitionPermissions.READ_HISTORY_VARIABLE permission on Resources.PROCESS_DEFINITION (ProcessEngineConfiguration.enforceSpecificVariablePermission must be set to true) OR
The user has no HistoricTaskPermissions.READ_VARIABLE permission on Resources.HISTORIC_TASK (enforceSpecificVariablePermission and enableHistoricInstancePermissions in ProcessEngineConfigurationImpl must be set to true)

Is my code snippet following the case of empty response? If so, what is required to be done at HistoryService level to get variables of process instance with variables?