When would you use None indexing mode in Cosmos DB?
The “None” indexing mode in Cosmos DB is a specialized indexing mode that disables indexing for a container. This mode is typically used in specific scenarios where indexing is not required or can be handled externally. Here are a few cases where you might consider using the “None” indexing mode in Cosmos DB:
- Static Reference Data:
- If you have a container that stores static reference data that rarely changes and doesn’t require indexing for query purposes, you can choose the “None” indexing mode. This reduces storage overhead and improves write performance by eliminating the indexing operations for that container.
- Archive or Cold Storage:
- In situations where you’re using Cosmos DB for archival or cold storage purposes, where the primary access pattern is read-only or infrequent, you may opt for the “None” indexing mode. Since indexing is not needed for queries, disabling indexing can reduce storage costs and improve write performance.
- External Indexing Solutions:
- If you have a separate indexing system or external search engine that is responsible for indexing and searching your data, you might choose the “None” indexing mode in Cosmos DB. This allows you to rely on the external indexing solution while leveraging Cosmos DB for storage and retrieval.
- Custom Indexing Approaches:
- In certain cases, you might have custom indexing mechanisms or specialized indexing requirements that can be managed outside of Cosmos DB. If you have alternative methods for indexing and querying your data, you could consider using the “None” indexing mode to bypass Cosmos DB’s built-in indexing system.
It’s important to note that when using the “None” indexing mode, querying capabilities in Cosmos DB are limited, as indexed queries are not supported. You can only use direct document lookups by specifying the document’s unique identifier (ID). Therefore, it’s crucial to carefully evaluate your specific requirements, access patterns, and the need for indexing before choosing the “None” indexing mode.