Table of contents
1.
Introduction
2.
Configuration Parameters
3.
Run-Time Configuration
3.1.
Options for Configuration Passing
3.1.1.
For command-line:
3.1.2.
For Redis-cli:
3.1.3.
For Redis.conf:
4.
RediSearch Configuration Options
4.1.
TIMEOUT
4.2.
SAFEMODE 
4.3.
EXTLOAD (File name)
4.4.
NOGC
4.5.
MINPREFIX
4.6.
MAXEXPANSIONS
5.
Features are available in RediSearch
6.
Frequently Asked Questions
6.1.
How does RediSearch function?
6.2.
How can I modify the Redis directory?
6.3.
What purpose does a Redis client serve?
6.4.
How is data stored in memory by Redis?
6.5.
Why is Redis so well-liked?
7.
Conclusion
Last Updated: Mar 27, 2024
Easy

Configuration in Search Redis

Introduction

In this article, we will go through Configuration in search Redis. A Full-Text Search engine called RediSearch is offered as a Redis module. This article provides a practical RediSearch tutorial and some key Full-Text Search ideas necessary to understand RediSearch.

RediSearch

A basic understanding of databases and programming should be sufficient to follow this course. Although it would be beneficial, it is not necessary to understand Redis to follow this guide.

Configuration Parameters

RediSearch supports multiple module configuration parameters. Some of these settings can only be changed at load time, while others can also be changed at run time.

  1. Load time
  2. Run time

Run-Time Configuration

A few run-time configuration settings for RediSearch can be selected when the module is loaded. More options will be introduced over time.

Options for Configuration Passing

Typically, configuration parameters are passed by appending arguments to the end of the —load module argument in command-line code, the load module configuration directive in a Redis config file, or MODULE LOAD when loading modules in command-line code. For instance:

For command-line:

$ redis-server --loadmodule ./redisearch.so OPT1 OPT2

 

For Redis-cli:

127.0.0.6379> MODULE load redisearch.so OPT1 OPT2

 

For Redis.conf:

loadmodule redisearch.so OPT1 OPT2

 

RediSearch Configuration Options

TIMEOUT

The most extended period of time in Milliseconds that a search query may run. If this period is exceeded, we return the best findings we have so far gathered. There is a 500ms delay.

Default:500

 

NOTE: Because this only functions in concurrent mode, turning on SAFEMODE also turns off this feature.

Timeout

Example

$ redis-server --loadmodule ./redisearch.so TIMEOUT 100

SAFEMODE
 

RediSearch will work in a single thread and disable concurrency for query processing if the argument is present in the argument list.
Default: Off (not present)

This is helpful in cases where maintaining data consistency is crucial because it prevents results from becoming temporarily inconsistent when documents are removed while being queried.

Safemode

Example

$ redis-server --loadmodule ./redisearch.so SAFEMODE


EXTLOAD (File name)

If a redisearch extension dynamic library is present, we attempt to load it from the given file path. For information, see Extensions.

Default: None

Example

$ redis-server --loadmodule ./redisearch.so EXTLOAD ./ext/my_extension.so


NOGC

If set, all indexes have Garbage Collection disabled. Users shouldn't change this setting because it is mostly used for testing and debugging.

Default: Not set

Example:

$ redis-server --loadmodule ./redisearch.so NOGC

 

MINPREFIX

The bare minimum of characters we permit in prefix queries (such as hel*). Performance may suffer if it is set to 1.

Default: 2

Example:

$ redis-server --loadmodule ./redisearch.so MINPREFIX 3


MAXEXPANSIONS

Most expansions we permit for query prefixes. A setting that is too high may affect performance.

Default: 200

Example:

$ redis-server --loadmodule ./redisearch.so MAXEXPANSIONS 1000

 

RediSearch

Features are available in RediSearch

  1. Additional indexing
  2. Multiple-field searches
  3. Aggregation
  4. Multiple fields in a document can be fully indexed in full text
  5. Indexing incrementally without sacrificing performance
  6. Ranking of documents (provided manually by the user at index time)
  7. Boolean queries interspersed with AND, OR, and NOT operators
  8. Optional clauses in the query
  9. Searches based on prefixes
  10. Area weights
  11. Automatic completion advice (with fuzzy prefix suggestions)
  12. Slop-based search versus exact-phrase search
  13. Query extension for several languages using stemming (using Snowball)
  14. Support for specialized scoring and query-expansion methods (see Extensions)
  15. Filters and ranges for numbers
  16. Using Redis' geo commands to geo-filter
  17. Unicode assistance (UTF-8 input required)
  18. Retrieval of the entire contents of documents or only their IDs
  19. Document update and garbage collection with the index
  20. Conditional and limited document updates
RediSearch

Frequently Asked Questions

How does RediSearch function?

Redis has a primary-replica architecture with asynchronous replication, which allows for the image of data across numerous replica servers. As a result, read speed increases (as requests can be distributed among the servers), and the primary server recovers more quickly during an outage.

How can I modify the Redis directory?

Redis CONFIG SET dir /new/path and the corresponding modification to the configuration file can be used to accomplish this, as can CONFIG REWRITE. The following dump file, made, for instance, with BGSAVE, will utilize the new path.

What purpose does a Redis client serve?

The Command CLIENT

You can name connections, kill a specific Redis client, and view the state of every connected client with the Redis CLIENT command. It is a highly potent debugging tool if you utilize Redis at scale. Two clients are linked to the Redis server in the example above.

How is data stored in memory by Redis?

Redis is an In-Memory Database (IMDB) since it stores data in the computer's main memory instead of traditional databases, which use disc storage. Because disc access is slower than memory access, Redis performs better than databases optimized for the disc.

Why is Redis so well-liked?

You are built for Languages & Speed. Redis uses an in-memory dataset to operate at its current speed. You can periodically save the data to a disc or add all commands to a log to keep the data. If you're utilizing persistence as a temporary cache, you may turn it off as you don't always want it.

Conclusion

This article covers everything you need to know about Redisearch Configuration. Still have more questions; Here are some articles for rescue:

Refer to our guided paths on Coding Ninjas Studio to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. Enroll in our courses and refer to the mock test and problems available. Take a look at the interview experiences and interview bundle for placement preparations.

Do upvote our blog to help other ninjas grow.

Happy Learning!

Live masterclass