How can I add documents to the index?

Last updated 29, Apr 2024

Question

How can I add hash or JSON documents to the index?

Answer

RediSearch versions previous to RediSearch 2.0 used the FT.ADD command, which connected the document and the index. Starting with RediSearch 2.0, instead of writing data through the index (using the FT.ADD command), Redis follows the data written in hashes or JSON documents and synchronously indexes it.

  • You can insert, update, and delete hash and JSON documents; the index will be updated transparently and synchronously.
  • The FT.ADD command is deprecated and should not be used. Manage your documents normally with HSET, JSON.SET etc.
  • RediSearch 2.0 and later versions are included in all the Redis Stack releases and the commercial versions of Redis.

References

Read the RediSearch 2.0 release notes