<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def clear(self, chunk_size=1000, aggressive=False):
 """Will deindex all the value for the current field Parameters chunk_size: int Default to 1000, it's the number of instances to load at once if not in aggressive mode. aggressive: bool Default to ``False``. When ``False``, the actual collection of instances will be ran through to deindex all the values. But when ``True``, the database keys will be scanned to find keys that matches the pattern of the keys used by the index. This is a lot faster and may find forsgotten keys. But may also find keys not related to the index. Should be set to ``True`` if you are not sure about the already indexed values. Raises ------ AssertionError If called from an index tied to an instance field. It must be called from the model field Examples -------- """

        assert self.attached_to_model, \
            '`clear` can only be called on an index attached to the model field'

        if aggressive:
            keys = self.get_all_storage_keys()
            with self.model.database.pipeline(transaction=False) as pipe:
                for key in keys:
                    pipe.delete(key)
                pipe.execute()

        else:
            start = 0
            while True:
                instances = self.model.collection().sort().instances(skip_exist_test=True)[start:start + chunk_size]
                for instance in instances:
                    field = instance.get_instance_field(self.field.name)
                    value = field.proxy_get()
                    if value is not None:
                        field.deindex(value, only_index=self)

                if len(instances) < chunk_size:  # not enough data, it means we are done
                    break

                start += chunk_size