@classmethod
def get_key(cls, oid=None):
    """
        This function creates a key in which Elasticsearch will save the instance with given id.

        :param oid: id of object for which a key should be created.
        :returns: Elasticsearch key (index, document and id).
        """
    key = {'index': cls.__module__.replace('__', ''), 'doc_type': cls.__name__}
    if oid:
        key['id'] = oid
    return key
