Skip to content

Commit 4dc5b9d

Browse files
committed
Apply review comments.
1 parent 560df9e commit 4dc5b9d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

content/develop/interact/search-and-query/best-practices/index-mgmt-best-practices.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,20 @@ See [these pages]({{< relref "/develop/interact/search-and-query/query" >}}) for
5454

5555
Next, simulate queries on a sample dataset to identify potential bottlenecks.
5656
Use tools like [`FT.PROFILE`]({{< baseurl >}}/commands/ft.profile) to analyze query execution and refine your schema if needed.
57-
For example, assign weights to `TEXT` fields for prioritizing results or use the `PREFIX` option of [`FT.CREATE`]({{< baseurl >}}/commands/ft.create) to limit indexing to specific key patterns. Note: you can use multiple `PREFIX` clauses when you create an index.
57+
For example, assign weights to `TEXT` fields for prioritizing results or use the `PREFIX` option of [`FT.CREATE`]({{< baseurl >}}/commands/ft.create) to limit indexing to specific key patterns. Note that you can use multiple `PREFIX` clauses when you create an index (see [below](#index-creation))
5858
After creating the index, validate its performance with real queries and monitor usage with the available tools:
5959

6060
- [`FT.EXPLAIN`]({{< baseurl >}}/commands/ft.explain) and [`FT.EXPLAINCLI`]({{< baseurl >}}/commands/ft.explaincli) allow you to see how Redis Query Engine parses a given search query. `FT.EXPLAIN` returns a structured breakdown of the query execution plan, while `FT.EXPLAINCLI` presents a more readable, tree-like format for easier interpretation. These commands are useful for diagnosing query structure and ensuring it aligns with the intended logic.
61-
- [`FT.INFO `]({{< baseurl >}}/commands/ft.info) provides detailed statistics about an index, including the number of indexed documents, memory usage, and configuration settings. It helps in monitoring index growth, assessing memory consumption, and verifying index structure to detect potential inefficiencies.
62-
- [`FT.PROFILE`]({{< baseurl >}}/commands/ft.profile) runs a query while capturing execution details, revealing query performance bottlenecks. It provides insights into processing time, key accesses, and filter application, making it a crucial tool for fine-tuning complex queries and optimizing search efficiency.
61+
- [`FT.INFO`]({{< baseurl >}}/commands/ft.info) provides detailed statistics about an index, including the number of indexed documents, memory usage, and configuration settings. It helps in monitoring index growth, assessing memory consumption, and verifying index structure to detect potential inefficiencies.
62+
- [`FT.PROFILE`]({{< baseurl >}}/commands/ft.profile) runs a query while capturing execution details, which helps to reveal query performance bottlenecks. It provides insights into processing time, key accesses, and filter application, making it a crucial tool for fine-tuning complex queries and optimizing search efficiency.
6363

6464
Avoid over-indexing. Indexing every field increases memory usage and can slow down updates.
6565
Only index the fields that are essential for your planned queries.
6666

67-
## Index creation
67+
## Index creation {#index-creation}
6868
- Use the [`FT.CREATE`]({{< baseurl >}}/commands/ft.create) command to define an index schema.
6969
- Assign weights to `TEXT` fields to prioritize certain fields in full-text search results.
70-
- Leverage the `PREFIX` option to restrict indexing to keys with specific patterns.
70+
- Use the `PREFIX` option to restrict indexing to keys with specific patterns.
7171
Using multiple PREFIX clauses when creating an index allows you to index multiple key patterns under a single index. This is useful in several scenarios:
7272
- If your Redis database stores different types of entities under distinct key prefixes (e.g., `user:123`, `order:456`), a single index can cover both by specifying multiple prefixes. For example:
7373

@@ -86,7 +86,7 @@ Only index the fields that are essential for your planned queries.
8686

8787
## Index aliasing
8888

89-
Index aliasing allows you to assign an alias to an index. Aliases act as abstracted names for the underlying indexes, enabling applications to reference the alias instead of the actual index name. This approach simplifies schema updates and index management.
89+
Index aliases act as abstracted names for the underlying indexes, enabling applications to reference the alias instead of the actual index name. This approach simplifies schema updates and index management.
9090

9191
There are several use cases for index aliasing, including:
9292

@@ -96,9 +96,9 @@ There are several use cases for index aliasing, including:
9696

9797
Best practices for aliasing:
9898

99-
- Default aliases: always create an alias for your indexes during initial setup, even if you don’t anticipate immediate schema changes.
100-
- Consistent naming conventions: use clear and descriptive alias names to avoid confusion (e.g., `users_current` or `orders_live`).
101-
- Avoid overlapping aliases: ensure that an alias points to only one index at a time to maintain predictable query results.
99+
- Always create an alias for your indexes during initial setup, even if you don’t anticipate immediate schema changes.
100+
- Use clear and descriptive alias names to avoid confusion (e.g., `users_current` or `orders_live`).
101+
- Make sure that an alias points to only one index at a time to maintain predictable query results.
102102
- Use aliases to provide tenant-specific access. For example, assign tenant-specific aliases like `tenant1_products` and `tenant2_products` to different indexes for isolated query performance.
103103

104104
Tools for managing aliases:
@@ -152,7 +152,7 @@ Monitoring and troubleshooting aliases:
152152
- If schema changes are required, create a new index with the updated schema and reassign the alias once the index is ready.
153153
- Use [Redis key expiration]({{< relref "/develop/use/keyspace#key-expiration" >}}) to automatically remove outdated records and keep indexes lean.
154154
155-
When is it appropriate to use [`FT.ALTER`]({{< baseurl >}}/commands/ft.alter) and when is it best to use aliasing?
155+
### [`FT.ALTER`]({{< baseurl >}}/commands/ft.alter) vs. aliasing
156156
157157
Use `FT.ALTER` when you need to add new fields to an existing index without rebuilding it, minimizing downtime and resource usage. However, `FT.ALTER` cannot remove or modify existing fields, limiting its flexibility.
158158

0 commit comments

Comments
 (0)