Skip to content

Commit 4250ed3

Browse files
committed
Updated java vector howto
1 parent fbedb9a commit 4250ed3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

articles/cosmos-db/nosql/how-to-java-vector-index-query.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ Once the vector embedding paths are decided, vector indexes need to be added to
115115
```java
116116
IndexingPolicy indexingPolicy = new IndexingPolicy();
117117
indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT);
118-
ExcludedPath excludedPath = new ExcludedPath("/*");
119-
indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath));
118+
ExcludedPath excludedPath1 = new ExcludedPath("/coverImageVector/*");
119+
ExcludedPath excludedPath2 = new ExcludedPath("/contentVector/*");
120+
indexingPolicy.setExcludedPaths(ImmutableList.of(excludedPath1, excludedPath2));
120121

121-
IncludedPath includedPath1 = new IncludedPath("/name/?");
122-
IncludedPath includedPath2 = new IncludedPath("/description/?");
123-
indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2));
122+
IncludedPath includedPath1 = new IncludedPath("/*");
123+
indexingPolicy.setIncludedPaths(Collections.singletonList(includedPath1));
124124

125125
// Creating vector indexes
126126
CosmosVectorIndexSpec cosmosVectorIndexSpec1 = new CosmosVectorIndexSpec();
@@ -143,6 +143,10 @@ database.createContainer(collectionDefinition).block();
143143
```
144144

145145

146+
147+
>[!IMPORTANT]
148+
> The vector path added to the "excludedPaths" section of the indexing policy to ensure optimized performance for insertion. Not adding the vector path to "excludedPaths" will result in higher RU charge and latency for vector insertions.
149+
146150
> [!IMPORTANT]
147151
> Currently vector search in Azure Cosmos DB for NoSQL is supported on new containers only. You need to set both the container vector policy and any vector indexing policy during the time of container creation as it can’t be modified later. Both policies will be modifiable in a future improvement to the preview feature.
148152

0 commit comments

Comments
 (0)