<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def es_json(self, **kwargs):
 """ Returns a JSON object of the property for insertion into es """

        rtn_list = []
        rng_defs = get_prop_range_defs(self.class_names, self.kds_rangeDef)
        # if self.__class__._prop_name == 'bf_partOf':
        #     pdb.set_trace()
        rng_def = get_prop_range_def(rng_defs)
        idx_types = rng_def.get('kds_esIndexType', []).copy()
        if 'es_Ignore' in idx_types:
            return rtn_list
        ranges = self.rdfs_range # pylint: disable=no-member
        # copy the current data into the es_values attribute then run
        # the es_processors to manipulate that data
        self.es_values = self.copy()
        # determine if using inverseOf object
        if rng_def.get('kds_esLookup'):
            self.es_values += self.dataset.json_qry("%s.$" % getattr(self,
                    rng_def['kds_esLookup'][0])[0].pyuri,
                    {'$':self.bound_class.subject})
            self.es_values = list(set(self.es_values))

        self._run_processors(self._es_processors)
        if not idx_types:
            nested = False
            for rng in ranges:
                if range_is_obj(rng, MODULE.rdfclass):
                    nested = True
                    break

            value_class = [value.__class__ for value in self.es_values
                           if isinstance(value, MODULE.rdfclass.RdfClassBase)]
            if value_class or nested:
                nested = True
            else:
                nested = False
            if nested:
                idx_types.append('es_Nested')
        rtn_obj = {}
        if 'es_Nested' in idx_types:
            if kwargs.get('depth', 0) > 6:
                return  [val.subject.sparql_uri for val in self]

            for value in self.es_values:
                try:
                    new_value = value.es_json('es_Nested', **kwargs)
                except AttributeError:
                    new_value = convert_value_to_es(value,
                                                    ranges,
                                                    self,
                                                    "missing_obj")
                rtn_list.append(new_value)
                if rng_def.get("kds_esField"):
                    es_value_fld = rng_def['kds_esValue'][0] \
                            if rng_def['kds_esValue'] else None
                    es_field = rng_def['kds_esField'][0]
                    for item in value.get(es_field):
                        if new_value.get(es_value_fld):
                            val = new_value.get(es_value_fld , [])
                            try:
                                rtn_obj[item.pyuri] += val
                            except KeyError:
                                rtn_obj[item.pyuri] = val
        else:
            for value in self.es_values:
                rtn_list.append(convert_value_to_es(value, ranges, self))
        if rtn_obj:
            return rtn_obj
        return rtn_list