How to reduce the memory used by indexes?

Last updated 22, Mar 2024

Question

How to reduce the memory used by indexes created with FT.CREATE?

Answer

Find a few tips to understand how to reduce the memory consumption of indexes.

  • When declaring an index, NOINDEX indicates that the field is not indexed. This is useful for storing text that you don't want to search for, but you still want to retrieve in search results.
  • Audit your TEXT indexes. TEXT creates an inverted index that may be large when the frequency of the terms is high. If the data stored is a simple string, TAG may be a more convenient option. Not everything should be considered TEXT.
  • By disabling highlighting with NOHL you can conserve storage space and memory
  • If you don't need to sort by frequency of a given term within a document, you can use the NOFREQS argument for a given field at index creation time
  • If you don't need to sort results, you may omit the SORTABLE argument. The ability to sort the results adds memory overhead, so consider not declaring it on large text attributes. SORTABLE can often actually be removed from TEXT, it's unlikely that in full-text search use cases, you want to sort on the content of field data. Sorting of full-text search is usually done using the relevance of the search