Skip to content

fix(infra): exclude vector path from DiskANN standard index (article 1) - #100

Open
diberry wants to merge 2 commits into
Azure-Samples:mainfrom
diberry:diberry/article-1-diskann-index-exclusion
Open

fix(infra): exclude vector path from DiskANN standard index (article 1)#100
diberry wants to merge 2 commits into
Azure-Samples:mainfrom
diberry:diberry/article-1-diskann-index-exclusion

Conversation

@diberry

@diberry diberry commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

The article-1 vector-search DiskANN container omits the vector-path exclusion from its standard index, while the sibling QuantizedFlat container already excludes /DescriptionVector/*. This is a pre-existing issue on main and was not introduced by PR #95.

Research and rationale

This is a general Cosmos DB indexing principle: when a container uses a broad /* included path, the vector field path should be excluded from the standard index because every vector index type (DiskANN, QuantizedFlat, Flat) maintains its own vector index. The principle applies regardless of how the container/index is created (Bicep, ARM, SDK at runtime, portal, or CLI).

Article 1 and article 2 use different schemas and provisioning paths:

  • Article 1 (vector-search) uses field /DescriptionVector with partition key /HotelId, and its containers are provisioned through Bicep/ARM.
  • Article 2 (create-index) uses field /embedding with partition key /Region, and its containers are provisioned at runtime from sample control-plane code. The article-2 fix belongs in PR Article 2 index creation #95: Article 2 index creation #95

This fix was split out of PR #95 because PR #95 is scoped to article 2. The article-1 infra correction is independent and already exists on main.

Exact change

  • Added { path: '/DescriptionVector/*' } to the hotels_diskann container's excludedPaths in infra/database.bicep.
  • Regenerated infra/main.json and infra/database.json from the updated Bicep.

The article-1 vector-search DiskANN container included all paths (/*) in the standard index but excluded only /_etag/?, so the /DescriptionVector embedding field was indexed both in the standard index and in the dedicated DiskANN vector index. This wastes write RUs and storage.

Adds a /DescriptionVector/* exclusion to the DiskANN container's standard index, matching the sibling QuantizedFlat container which already excludes it.

This is a general Cosmos DB indexing principle: when a container uses a broad /* included path, the vector field path should be excluded from the standard index because every vector index type (DiskANN, QuantizedFlat, Flat) maintains its own vector index. The principle applies regardless of how the container/index is created (Bicep, ARM, SDK at runtime, portal, or CLI).

Regenerates infra/main.json and infra/database.json from the updated Bicep.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 219997ec-391e-4043-a21d-1275783b6ea2
@diberry
diberry requested a review from Copilot July 16, 2026 20:46
@diberry
diberry marked this pull request as ready for review July 16, 2026 20:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the article-1 (vector-search) infrastructure templates so the DiskANN container excludes the vector field path from the standard index, aligning it with the existing QuantizedFlat container behavior and common Cosmos DB indexing guidance.

Changes:

  • Added /DescriptionVector/* to excludedPaths for the hotels_diskann container indexing policy in infra/database.bicep.
  • Regenerated the compiled ARM templates (infra/database.json and infra/main.json) from the updated Bicep.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
infra/database.bicep Adds the missing standard-index exclusion for /DescriptionVector/* on the DiskANN container.
infra/database.json Regenerated compiled template reflecting the updated DiskANN indexing policy exclusion.
infra/main.json Regenerated top-level deployment template to include the updated database module output.

Deployment runs from Bicep (main.bicep + main.bicepparam via azd); the
compiled ARM templates (database.json, main.json) are build artifacts that
were never tracked on main. Remove them and add infra/*.json to .gitignore
so bicep build output is not committed again.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4da54cd1-6cdc-442c-af04-a13d33c96b5c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants