Returns the es mapping for the class

        args:
        -----
            base_class: The root class being indexed
            role: the role states how the class should be mapped depending
                  upon whether it is used as a subject of an object. options
                  are es_Nested or rdf_class

def es_mapping(cls, base_class=None, role='rdf_class', **kwargs):
        """ Returns the es mapping for the class

        args:
        -----
            base_class: The root class being indexed
            role: the role states how the class should be mapped depending
                  upon whether it is used as a subject of an object. options
                  are es_Nested or rdf_class
        """

        def _prop_filter(prop, value, **kwargs):
            """ filters out props that should not be used for es_mappings:
            These include props that of the owl:inverseOf the parent_props.
            Use of these props will cause a recursion depth error

            Args:
                prop: the name of the prop
                value: the prop value(an instance of the prop's class)

            Returns:
                bool: whether the prop should be used
            """

            try:
                use_prop = len(set(value.owl_inverseOf) - parent_props) > 0
            except AttributeError:
                use_prop = True
            # if not use_prop:
            #     print(prop)
            if prop in nested_props and use_prop:
                return True
            return False
        if not base_class:
            base_class = cls
        es_map = {}
        # pdb.set_trace()
        if kwargs.get("depth"): # and kwargs.get('class') == cls.__name__:
            kwargs['depth'] += 1
            initial = False
        else:
            initial = True
            kwargs['depth'] = 1
            kwargs['class'] = cls.__name__
            kwargs['class_obj'] = cls
        if kwargs.get('class_obj'):
            parent_props = set(cls.properties)
        else:
            parent_props = set()
        if role == 'rdf_class':
            es_map = {}
            es_map = {prop: value.es_mapping(base_class) \
                      for prop, value in cls.properties.items()}

        elif role == 'es_Nested':
            # print(locals())
            # pdb.set_trace()
            if cls == base_class:
                nested_props = LABEL_FIELDS
            else:
                nested_props = cls.es_defs.get('kds_esNestedProps',
                                               list(cls.properties.keys()))
            es_map = {prop: value.es_mapping(base_class, **kwargs) \
                      for prop, value in cls.properties.items() \
                      if _prop_filter(prop, value, **kwargs)}
        ref_map = {
            "type" : "keyword"
        }
        lower_map = {
            "type": "text",
            "fields": {
                "lower": es_idx_types['es_Lower']['lower'],
                'keyword': {'type': 'keyword'}
            }
        }
        ignore_map = {
            "index": False,
            "type": "text"
        }
        if cls == base_class:
            es_map['label'] = ref_map
            es_map['value'] = lower_map

        if cls.cls_defs.get('kds_storageType',[None])[0] != "blanknode" \
                and cls == base_class:
            es_map['id'] = ref_map
            es_map['uri'] = ref_map
        rml_procs = cls.es_defs.get("kds_esRmlProcessor", [])
        rml_procs = [proc for proc in rml_procs
                     if role == 'rdf_class' or
                     proc['force']]
        if rml_procs:
            rml_maps = {}
            for rml in rml_procs:
                rml_maps[rml['name']] = ignore_map
            if rml_maps:
                es_map['rml_map'] = {"properties": rml_maps}
                # es_map['turtle'] = ignore_map
        return es_map