Skip to content

feat: add Cosmos DB NoSQL create-index sample (Java)#89

Open
diberry wants to merge 2 commits into
Azure-Samples:mainfrom
diberry:squad/cosmos-create-index-java
Open

feat: add Cosmos DB NoSQL create-index sample (Java)#89
diberry wants to merge 2 commits into
Azure-Samples:mainfrom
diberry:squad/cosmos-create-index-java

Conversation

@diberry

@diberry diberry commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add the new
    osql-create-index-java\ Maven sample
  • use DefaultAzureCredential with Azure Cosmos DB and the Azure OpenAI client
  • bulk upsert the shared pre-vectorized hotel dataset and run VectorDistance() queries for DiskANN and QuantizedFlat containers

Validation

  • mvn test

diberry and others added 2 commits June 8, 2026 15:23
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@diberry

diberry commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

Review Score: 15/16 [PASS]

Specialist Dimension Score Notes
Sam Correctness 2 Java SDK usage correct: CosmosClientBuilder, DefaultAzureCredential, executeBulkOperations(), OpenAI embeddings all properly implemented. pom.xml dependencies valid (azure-cosmos, azure-identity, azure-ai-openai v1.0.0-beta.16).
Scooter Completeness 1.5 All files present and README is comprehensive. Article covers Prerequisites, Clone, Configure, Build/Run, and Structure. Minor: missing explicit cleanup section (less critical for data-plane only).
Beauregard Conventions 2 Maven project layout is standard (src/main/java/com/azure/cosmos/createindex/). Package naming follows Azure conventions. Class names and records are appropriately named. Matches other language sample patterns.
Statler Coverage 2 Excellent error handling: CosmosException caught with clear message, Config.validate() checks all required env vars, validateFieldName() regex prevents SQL injection, data file existence verified, VECTOR_ALGORITHM and container names validated.
Architect Coherence 2 Code structure matches Python/TS pattern: Config handles loading/validation, App orchestrates workflow, DataPlane contains client factories and operations. Article aligns with code structure and explains each component.
Razor Conciseness 1.5 No dead code or unused variables. SDK usage is efficient (contentResponseOnWriteEnabled=false, executeBulkOperations). Records for output types (IngestionSummary, QueryResult, QuerySummary) add clarity but could be more minimal.
Mirror Consistency 2 Env vars match standard across samples (AZURE_COSMOSDB_, AZURE_OPENAI_, VECTOR_ALGORITHM, DATA_FILE_WITH_VECTORS). Output format consistent with other language samples. Correct containers (hotels_diskann, hotels_quantizedflat) and relative data path.
Lens Clarity 2 README instructions are clear with step-by-step guidance and examples. Code comments minimal but sufficient. Error messages are actionable (e.g., 'Invalid embedding field name', missing env var details). Article well-structured with clear sections.
Total 15/16 PASS (≥13, no zeros) ✅ All critical criteria met: data-plane only, DefaultAzureCredential passed directly, field validation before SQL interpolation, VectorDistance() with field interpolation, executeBulkOperations() used, 'Azure OpenAI client' terminology, correct containers, shared data file, standard env vars, Tier 1 article structure.

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.

1 participant