(info, cname=None)
return cname
Register an Elasticsearch index info object.

    :param info: index info object
    :param cname: (optional) register index info as canonical name `cname`
                  instead of default (`info.alias`)
    :raises: ESRegistryError
Register an Elasticsearch index info object.
Register an Elasticsearch index info object .
def register(info, cname=None):
    """Register an Elasticsearch index info object.

    :param info: index info object
    :param cname: (optional) register index info as canonical name `cname`
                  instead of default (`info.alias`)
    :raises: ESRegistryError
    """
    alias = info.alias
    if cname is None:
        cname = alias
    if cname in _ES_INFO_REGISTRY:
        raise ESRegistryError(f"name {cname!r} is already registered")
    _ES_INFO_REGISTRY[cname] = info
    if alias in _ALIAS_REF_COUNTS:
        _ALIAS_REF_COUNTS[alias] += 1
    else:
        _ALIAS_REF_COUNTS[alias] = 1
    return cname
def register ( info , cname = None ) : alias = info . alias if cname is None : cname = alias if cname in _ES_INFO_REGISTRY : raise ESRegistryError ( f"name {cname!r} is already registered" ) _ES_INFO_REGISTRY [ cname ] = info if alias in _ALIAS_REF_COUNTS : _ALIAS_REF_COUNTS [ alias ] += 1 else : _ALIAS_REF_COUNTS [ alias ] = 1 return cname