Use explicit index name in RediSearch example
@@ -107,7 +107,8 @@ Examples of how to combine search and json can be found `here <examples/search_j
RediSearch Commands
*******************
-These are the commands for interacting with the `RediSearch module <https://redisearch.io>`_. Below is a brief example, as well as documentation on the commands themselves.
+These are the commands for interacting with the `RediSearch module <https://redisearch.io>`_. Below is a brief example, as well as documentation on the commands themselves. In the example
+below, an index named *my_index* is being created. When an index name is not specified, an index named *idx* is created.
**Create a search index, and display its information**
@@ -117,8 +118,9 @@ These are the commands for interacting with the `RediSearch module <https://redi
from redis.commands.search.field import TextField
r = redis.Redis()
- r.ft().create_index(TextField("play", weight=5.0), TextField("ball"))
- print(r.ft().info())
+ index_name = "my_index"
+ r.ft(index_name).create_index(TextField("play", weight=5.0), TextField("ball"))
+ print(r.ft(index_name).info())
.. automodule:: redis.commands.search.commands
