Rebuild all indexes tied to this field

        Parameters
        ----------
        chunk_size: int
            Default to 1000, it's the number of instances to load at once.
        aggressive_clear: bool
            Will be passed to the `aggressive` argument of the `clear_indexes` method.
            If `False`, all values will be normally deindexed. If `True`, the work
            will be done at low level, scanning for keys that may match the ones used by the indexes
        index_class: type
            Allow to build only index(es) for this index class instead of all indexes.

        Raises
        ------
        AssertionError
            If called from an instance field. It must be called from the model field
            Also raised if the field is not indexable

        Examples
        --------

        >>> MyModel.get_field('myfield').rebuild_indexes()
        >>> MyModel.get_field('myfield').clear_indexes(index_class=MyIndex)

def rebuild_indexes(self, chunk_size=1000, aggressive_clear=False, index_class=None):
        """Rebuild all indexes tied to this field

        Parameters
        ----------
        chunk_size: int
            Default to 1000, it's the number of instances to load at once.
        aggressive_clear: bool
            Will be passed to the `aggressive` argument of the `clear_indexes` method.
            If `False`, all values will be normally deindexed. If `True`, the work
            will be done at low level, scanning for keys that may match the ones used by the indexes
        index_class: type
            Allow to build only index(es) for this index class instead of all indexes.

        Raises
        ------
        AssertionError
            If called from an instance field. It must be called from the model field
            Also raised if the field is not indexable

        Examples
        --------

        >>> MyModel.get_field('myfield').rebuild_indexes()
        >>> MyModel.get_field('myfield').clear_indexes(index_class=MyIndex)


        """
        assert self.indexable, "Field not indexable"
        assert self.attached_to_model, \
            '`rebuild_indexes` can only be called on a field attached to the model'

        for index in self._indexes:
            if index_class and not isinstance(index, index_class):
                continue
            index.rebuild(chunk_size=chunk_size, aggressive_clear=aggressive_clear)