Skip to main content

FT.DROPINDEX

Syntax

FT.DROPINDEX index [DD]

Time complexity: O(1) or O(N) if DD is used, where N is the number of documents in the index.

Description

Delete an index.

By default, FT.DROPINDEX only removes the index definition and associated metadata while keeping the actual documents (HASH or JSON keys) intact.

Required arguments

index

is index name. You must first create the index using FT.CREATE.

Optional arguments

DD

If set, the operation will delete the actual documents (HASH or JSON keys) that were indexed, in addition to dropping the index itself.

Without this option, only the index structure is removed while all the indexed documents remain in the database.

danger

Using DD will permanently delete all documents that were indexed. This operation cannot be undone.

Return

FT.DROPINDEX returns a simple string reply OK if executed correctly, or an error reply otherwise.

Examples

Delete an index (keep documents)

Delete the index but keep all the indexed documents in the database.

dragonfly> FT.DROPINDEX idx
OK
Delete an index and all its documents

Delete the index and all documents that were indexed by it.

dragonfly> FT.DROPINDEX idx DD
OK
danger

This will permanently delete all HASH or JSON keys that were indexed by idx.

See also

FT.CREATE | FT.INFO