Skip to content

Commit aa24b8f

Browse files
authored
Merge pull request #279336 from AvijitkGupta/vcore-indexes
indexing docs on vcore
2 parents 6098ea9 + 6146c00 commit aa24b8f

File tree

4 files changed

+457
-16
lines changed

4 files changed

+457
-16
lines changed

articles/cosmos-db/mongodb/vcore/TOC.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
href: high-availability.md
4343
- name: Cross-region replication
4444
href: cross-region-replication.md
45+
- name: Indexing
46+
href: indexing.md
4547
- name: Reliability
4648
href: /azure/reliability/reliability-cosmos-mongodb?toc=/azure/cosmos-db/mongodb/vcore/toc.json
4749
- name: Compute and storage
@@ -76,22 +78,28 @@
7678
href: how-to-transactions.md
7779
- name: Connect using Spark connector from Azure Databricks
7880
href: connect-from-databricks.md
81+
- name: Work with indexes
82+
items:
83+
- name: Background indexing
84+
href: background-indexing.md
85+
- name: Indexing best practices
86+
href: how-to-create-indexes.md
87+
- name: Working with wildcard
88+
href: how-to-create-wildcard-indexes.md
89+
- name: Search and query text
90+
href: how-to-create-text-index.md
91+
- name: Optimize index creation
92+
href: how-to-create-indexes.md
7993
- name: Scale cluster
8094
href: how-to-scale-cluster.md
8195
- name: Restore cluster
8296
href: how-to-restore-cluster.md
8397
- name: Manage replication
8498
href: how-to-cluster-replica.md
85-
- name: Search and query text
86-
href: how-to-create-text-index.md
8799
- name: Monitor diagnostics logs
88100
href: how-to-monitor-diagnostics-logs.md
89101
- name: Use Azure Private Link
90102
href: how-to-private-link.md
91-
- name: Optimize index creation
92-
href: how-to-create-indexes.md
93-
- name: Create wildcard indexes
94-
href: how-to-create-wildcard-indexes.md
95103
- name: Reference
96104
items:
97105
- name: Release notes
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
title: Background indexing
3+
titleSuffix: Background indexing on Azure Cosmos DB for MongoDB vCore
4+
description: Background indexing to enable non-blocking operation during index creation
5+
author: avijitgupta
6+
ms.author: avijitgupta
7+
ms.reviewer: gahllevy
8+
ms.service: cosmos-db
9+
ms.subservice: mongodb-vcore
10+
ms.topic: conceptual
11+
ms.date: 07/01/2024
12+
---
13+
14+
# Background indexing (Preview)
15+
16+
[!INCLUDE[MongoDB vCore](~/reusable-content/ce-skilling/azure/includes/cosmos-db/includes/appliesto-mongodb-vcore.md)]
17+
18+
Background indexing is a technique that enables a database system to perform indexing operations on a collection without blocking other queries or updates. Azure Cosmos DB for Mongo vcore accepts the background indexing request and asynchronously performs it in background.
19+
20+
If working with smaller tiers or workloads with higher I/O needs, it's recommended to predefine indexes on empty collections and avoid relying on background indexing.
21+
22+
> [!NOTE]
23+
> Background indexing is a Preview feature. Enabling this feature requires raising a support request.
24+
25+
> [!IMPORTANT]
26+
> It is advised to create `unique` indexes on an empty collection as those are created in foreground, which results in blocking of reads and writes.
27+
>
28+
> It is advised to create indexes based on query predicates beforehand, while the collection is still empty. It prevents resource contention if pushed on read-write heavy large collection.
29+
30+
## Monitor index build
31+
32+
We can learn about the progress of index build using command `currentOp()`.
33+
34+
```javascript
35+
db.currentOp("db_name":"<db_name>", "collection_name":"<collection_name>")
36+
```
37+
38+
- `db_name` is an optional parameter.
39+
- `collection_name` is optional parameter.
40+
41+
```javascript
42+
// Output for reviewing build status
43+
{
44+
inprog: [
45+
{
46+
shard: 'defaultShard',
47+
active: true,
48+
type: 'op',
49+
opid: '10000003049:1701252500485346',
50+
op_prefix: Long("10000003049"),
51+
currentOpTime: ISODate("2024-06-24T10:08:20.000Z"),
52+
secs_running: Long("2"),
53+
command: {createIndexes: '' },
54+
op: 'command',
55+
waitingForLock: true
56+
},
57+
{
58+
shard: 'defaultShard',
59+
active: true,
60+
type: 'op',
61+
opid: '10000003050:1701252500499914',
62+
op_prefix: Long("10000003050"),
63+
currentOpTime: ISODate("2024-06-24T10:08:20.000Z"),
64+
secs_running: Long("2"),
65+
command: {
66+
createIndexes: 'BRInventory', },
67+
indexes: [
68+
{
69+
v:2,
70+
key: {vendorItemId: 1, vendorId: 1, itemType: 1},
71+
name: 'compound_idx'
72+
}
73+
],
74+
'$db': 'test'
75+
op: 'command',
76+
waitingForLock: false,
77+
progress: {
78+
blocks_done: Long("12616"),
79+
blocks_done: Long("1276873"),
80+
documents_d: Long("0"),
81+
documents_to: Long("0")
82+
},
83+
msg: 'Building index.Progress 0.0098803875. Waiting on op_prefix: 10000000000.'
84+
}
85+
],
86+
ok: 1
87+
}
88+
```
89+
90+
## Limitations
91+
92+
- Unique indexes can't be created in the background. It's best to create them on an empty collection and then load the data.
93+
- Background indexing is performed sequentially within a single collection. However, the number of simultaneous index builds on different collections is configurable (default: 2).
94+
95+
## Next Steps
96+
97+
> [!div class="nextstepaction"]
98+
> [Best practices](how-to-create-indexes.md)

articles/cosmos-db/mongodb/vcore/how-to-scale-cluster.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
title: Scale or configure a cluster
33
titleSuffix: Azure Cosmos DB for MongoDB vCore
44
description: Scale an Azure Cosmos DB for MongoDB vCore cluster by changing the tier and disk size or change the configuration by enabling high availability.
5-
author: gahl-levy
6-
ms.author: gahllevy
7-
ms.reviewer: sidandrews
5+
author: avijitgupta
6+
ms.author: avijitgupta
7+
ms.reviewer: gahllevy
88
ms.service: cosmos-db
99
ms.subservice: mongodb-vcore
1010
ms.topic: how-to
11-
ms.date: 06/20/2024
11+
ms.date: 07/01/2024
1212
---
1313

1414
# Scaling and configuring Your Azure Cosmos DB for MongoDB vCore cluster
1515

1616
[!INCLUDE[MongoDB vCore](~/reusable-content/ce-skilling/azure/includes/cosmos-db/includes/appliesto-mongodb-vcore.md)]
1717

18-
Azure Cosmos DB for MongoDB vCore provides seamless scalability and high availability. This document serves as a quick guide for developers who want to learn how to scale and configure their clusters. When changes are made, they're performed live to the cluster without downtime.
18+
Azure Cosmos DB for MongoDB vCore provides seamless scalability and high availability. This document serves as a quick guide for developers who want to learn how to scale and configure their clusters. Changes to the cluster are performed live without downtime.
1919

2020
## Prerequisites
2121

@@ -32,9 +32,9 @@ To change the configuration of your cluster, use the **Scale** section of the Az
3232
3333
1. Sign in to the [Azure portal](https://portal.azure.com).
3434

35-
1. Navigate to the existing Azure Cosmos DB for MongoDB vCore cluster page.
35+
2. Navigate to the existing Azure Cosmos DB for MongoDB vCore cluster page.
3636

37-
1. From the Azure Cosmos DB for MongoDB vCore cluster page, select the **Scale** navigation menu option.
37+
3. From the Azure Cosmos DB for MongoDB vCore cluster page, select the **Scale** navigation menu option.
3838

3939
:::image type="content" source="media/how-to-scale-cluster/select-scale-option.png" lightbox="media/how-to-scale-cluster/select-scale-option.png" alt-text="Screenshot of the Scale option on the page for an Azure Cosmos DB for MongoDB vCore cluster.":::
4040

@@ -48,8 +48,10 @@ The cluster tier you select influences the amount of vCores and RAM assigned to
4848

4949
> [!NOTE]
5050
> This change is performed live to the cluster without downtime.
51+
>
52+
> Upgrade or downgrade from burstable tiers to memory optimized tier isn't supported at the moment.
5153
52-
1. Select **Save** to persist your change.
54+
2. Select **Save** to persist your change.
5355

5456
## Increase disk size
5557

@@ -62,7 +64,7 @@ You can increase the storage size to give your database more room to grow. For e
6264
> [!NOTE]
6365
> This change is performed live to the cluster without downtime. Also, storage size can only be increased, not decreased.
6466
65-
1. Select **Save** to persist your change.
67+
2. Select **Save** to persist your change.
6668

6769
## Enable or disable high availability
6870

@@ -72,7 +74,7 @@ You can enable or disable [high availability (HA)](./high-availability.md) to su
7274

7375
:::image type="content" source="media/how-to-scale-cluster/configure-high-availability.png" alt-text="Screenshot of the high availability checkbox in the Scale page of a cluster.":::
7476

75-
1. Select **Save** to persist your change.
77+
2. Select **Save** to persist your change.
7678

7779
## Next steps
7880

0 commit comments

Comments
 (0)