// DeleteField removes the named field from the named index. If the index is not
// found, an error is returned. If the field is not found, it is ignored and no
// action is taken.
DeleteField removes the named field from the named index. If the index is not
found, an error is returned. If the field is not found, it is ignored and no
action is taken.
// DeleteField removes the named field from the named index . If the index is not // found an error is returned . If the field is not found it is ignored and no // action is taken .
func (api *API) DeleteField(ctx context.Context, indexName string, fieldName string) error {
	span, _ := tracing.StartSpanFromContext(ctx, "API.DeleteField")
	defer span.Finish()
	if err := api.validate(apiDeleteField); err != nil {
		return errors.Wrap(err, "validating api method")
	}
	index := api.holder.Index(indexName)
	if index == nil {
		return newNotFoundError(ErrIndexNotFound)
	}
	if err := index.DeleteField(fieldName); err != nil {
		return errors.Wrap(err, "deleting field")
	}
	err := api.server.SendSync(
		&DeleteFieldMessage{
			Index: indexName,
			Field: fieldName,
		})
	if err != nil {
		api.server.logger.Printf("problem sending DeleteField message: %s", err)
		return errors.Wrap(err, "sending DeleteField message")
	}
	api.holder.Stats.CountWithCustomTags("deleteField", 1, 1.0, []string{fmt.Sprintf("index:%s", indexName)})
	return nil
}
func ( api * API ) DeleteField ( ctx context . Context , indexName string , fieldName string ) error { span , _ := tracing . StartSpanFromContext ( ctx , " " ) defer span . Finish ( ) if err := api . validate ( apiDeleteField ) ; err != nil { return errors . Wrap ( err , " " ) } index := api . holder . Index ( indexName ) if index == nil { return newNotFoundError ( ErrIndexNotFound ) } if err := index . DeleteField ( fieldName ) ; err != nil { return errors . Wrap ( err , " " ) } err := api . server . SendSync ( & DeleteFieldMessage { Index : indexName , Field : fieldName , } ) if err != nil { api . server . logger . Printf ( " " , err ) return errors . Wrap ( err , " " ) } api . holder . Stats . CountWithCustomTags ( " " , 1 , 1.0 , [ ] string { fmt . Sprintf ( " " , indexName ) } ) return nil }
DeleteField removes the named field from the named index.
DeleteField removes the named field from the named index .
// Find index. // Delete field from the index. // Send the delete field message to all nodes.