def _environment_by_version(version: int) -> dict[str, str]:
    """Returns environment variables required for each major version to work."""
    if version == 6:
        # This setting is needed to avoid the check for the kernel parameter
        # vm.max_map_count in the BootstrapChecks
        return {"discovery.zen.minimum_master_nodes": "1"}
    elif version == 7:
        return {}
    elif version == 8:
        # Elasticsearch uses https now by default. However, our readiness
        # check uses http, which does not work. Hence we disable security
        # which should not be an issue for our context
        return {"xpack.security.enabled": "false"}
    else:
        raise ValueError(f"Unknown elasticsearch version given: {version}")
Returns environment variables required for each major version to work.
modules/elasticsearch/testcontainers/elasticsearch/__init__.py