def METHOD_NAME(app, load_default_data, identifiers, mocker):
    index = app.config.get('OPENSEARCH_INDEX')
    def _create_new_versions(version, expected_range):
        # Create new HEPSubmission and DataSubmissions for ins1283842
        new_hep_submission = HEPSubmission(
            publication_recid=1, inspire_id=identifiers[0]["inspire_id"],
            version=version, overall_status='finished'
        )
        db.session.add(new_hep_submission)
        db.session.commit()
        new_data_submissions = []
        for i in range(5):
            new_data_submission = DataSubmission(
                publication_recid=1,
                associated_recid=1,
                version=version
            )
            db.session.add(new_data_submission)
            new_data_submissions.append(new_data_submission)
        db.session.commit()
        assert [x.id for x in new_data_submissions] == expected_range
    _create_new_versions(2, list(range(55, 60)))
    # Mock methods called so we can check they're called with correct parameters
    from invenio_search import RecordsSearch
    mock_records_search = mocker.patch.object(RecordsSearch, 'filter')
    # Reindex submission id 1 (pub_recid=1)
    # New version means the original data submissions (2-16) are
    # superceded so can be cleaned up
    cleanup_index_batch([1], index)
    assert mock_records_search.has_calls([
        call('terms', _id=list(range(2,16)))
    ])
    mock_records_search.reset_mock()
    # Create more new versions
    _create_new_versions(3, list(range(60, 65)))
    cleanup_index_batch([1], index)
    assert mock_records_search.has_calls([
        call('terms', _id=list(range(2,16)) + list(range(55, 60)))
    ])
    mock_records_search.reset_mock()
    # Clean up with id 17, for which there are no old versions
    # - should mean that filter is not called.
    cleanup_index_batch([17], index)
    mock_records_search.assert_not_called()