// DeleteView removes the given view.
DeleteView removes the given view.
// DeleteView removes the given view .
func (api *API) DeleteView(ctx context.Context, indexName string, fieldName string, viewName string) error {
	span, _ := tracing.StartSpanFromContext(ctx, "API.DeleteView")
	defer span.Finish()
	if err := api.validate(apiDeleteView); err != nil {
		return errors.Wrap(err, "validating api method")
	}
	f := api.holder.Field(indexName, fieldName)
	if f == nil {
		return ErrFieldNotFound
	}
	if err := f.deleteView(viewName); err != nil {
		if err != ErrInvalidView {
			return errors.Wrap(err, "deleting view")
		}
	}
	err := api.server.SendSync(
		&DeleteViewMessage{
			Index: indexName,
			Field: fieldName,
			View:  viewName,
		})
	if err != nil {
		api.server.logger.Printf("problem sending DeleteView message: %s", err)
	}
	return errors.Wrap(err, "sending DeleteView message")
}
func ( api * API ) DeleteView ( ctx context . Context , indexName string , fieldName string , viewName string ) error { span , _ := tracing . StartSpanFromContext ( ctx , " " ) defer span . Finish ( ) if err := api . validate ( apiDeleteView ) ; err != nil { return errors . Wrap ( err , " " ) } f := api . holder . Field ( indexName , fieldName ) if f == nil { return ErrFieldNotFound } if err := f . deleteView ( viewName ) ; err != nil { if err != ErrInvalidView { return errors . Wrap ( err , " " ) } } err := api . server . SendSync ( & DeleteViewMessage { Index : indexName , Field : fieldName , View : viewName , } ) if err != nil { api . server . logger . Printf ( " " , err ) } return errors . Wrap ( err , " " ) }
DeleteView removes the given view.
DeleteView removes the given view .
// Retrieve field. // Delete the view. // Ignore this error because views do not exist on all nodes due to shard distribution. // Send the delete view message to all nodes.