Skip to content

Cosmos: Failing test on real cosmos db: full-text and vector indexes on collection wildcard paths are not allowed #38557

Closed

Description

@JoasE

Bug description

EF Cosmos provider allows defining full text and vector indexes on complex collection type properties
This will be translated to a vector/full-text policy with a [] 'collection' wildcard expression in the property path.
This is currently not supported, but tests have been added that run when using a real cosmos db.
Related:
#38067
#17303
#35898

See:
https://learn.microsoft.com/en-us/cosmos-db/full-text-indexing#full-text-policy
https://learn.microsoft.com/en-us/azure/cosmos-db/vector-search#vector-indexing-policies

EF throwing an exception OnModelCreating might be nice, but test should most likely be removed at-least

Your code

Failing tests in:
VectorSearchTranslationsCosmosTest
FullTextSearchTranslationsCosmosTest

b.ComplexCollection(x => x.ComplexNestedCollection, cb => cb.Property(c => c.NestedSingles).IsVectorProperty(DistanceFunction.Cosine, 10));
b.HasIndex(x => x.ComplexNestedCollection.Select(c => c.NestedSingles)).IsVectorIndex(VectorIndexType.Flat);

Stack traces

Microsoft.EntityFrameworkCore.Query.Translations.VectorSearchTranslationsCosmosTest.VectorDistance_with_distance_function_and_brute_force_null
   Source: VectorSearchTranslationsCosmosTest.cs line 185
   Duration: < 1 ms

  Message: 
Class fixture type 'Microsoft.EntityFrameworkCore.Query.Translations.VectorSearchTranslationsCosmosTest+VectorSearchFixture' threw in InitializeAsync
---- Microsoft.Azure.Cosmos.CosmosException : Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: bcd312e6-0b44-4a06-8e3d-4a98db89fd2c; Reason: (
code : BadRequest
message : Message: {"Errors":["The Vector Embedding Policy has an invalid Path:/ComplexNestedCollection/[]/NestedSingles. Specify the correct path for vector properties of your documents."]}
ActivityId: bcd312e6-0b44-4a06-8e3d-4a98db89fd2c, Request URI: /apps/f1099ee9-2f43-4e48-968b-023e4fb688c1/services/f0d23fcb-73cb-4207-99fc-b960ce2096b0/partitions/94c55af5-3881-4d58-91bb-4c1d3c36976b/replicas/134259198644572087p, RequestStats: , SDK: Microsoft.Azure.Documents.Common/2.14.0
);

  Stack Trace: 
----- Inner Stack Trace -----
ClientContextCore.RunWithDiagnosticsHelperAsync[TResult](String containerName, String databaseName, OperationType operationType, ITrace trace, Func`2 task, Nullable`1 openTelemetry, RequestOptions requestOptions, Nullable`1 resourceType)
ClientContextCore.OperationHelperWithRootTraceAsync[TResult](String operationName, String containerName, String databaseName, OperationType operationType, RequestOptions requestOptions, Func`2 task, Nullable`1 openTelemetry, TraceComponent traceComponent, TraceLevel traceLevel, Nullable`1 resourceType)
CosmosClientWrapper.CreateContainerIfNotExistsOnceAsync(DbContext _, ValueTuple`2 parametersTuple, CancellationToken cancellationToken) line 376
ExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) line 300
<<EnsureCreatedAsync>b__9_0>d.MoveNext() line 85
--- End of stack trace from previous location ---
ExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) line 300
CosmosTestStore.CleanAsyncImpl(DbContext context, Boolean createTables) line 334
CosmosTestStore.CleanAsyncImpl(DbContext context, Boolean createTables) line 356
CosmosTestStore.<CleanAsync>b__40_0(DbContext _, ValueTuple`3 state, CancellationToken ct) line 312
ExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) line 300
<<InitializeAsync>b__0>d.MoveNext() line 78
--- End of stack trace from previous location ---
<<ExecuteAsync>b__3_0>d.MoveNext() line 111
--- End of stack trace from previous location ---
<<ExecuteAsync>b__0>d.MoveNext() line 307
--- End of stack trace from previous location ---
ExecutionStrategy.ExecuteImplementationAsync[TState,TResult](Func`4 operation, Func`4 verifySucceeded, TState state, CancellationToken cancellationToken) line 330
ExecutionStrategy.ExecuteImplementationAsync[TState,TResult](Func`4 operation, Func`4 verifySucceeded, TState state, CancellationToken cancellationToken) line 354
ExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) line 306
TestStore.InitializeAsync(Func`1 createContext, Func`2 seed, Func`2 clean) line 64
CosmosTestStore.InitializeAsync(Func`1 createContext, Func`2 seed, Func`2 clean) line 225
<<InitializeAsync>b__0>d.MoveNext() line 28
--- End of stack trace from previous location ---
TestStoreIndex.CreateSharedAsync(String name, Func`1 initializeDatabase) line 25
TestStore.InitializeAsync(IServiceProvider serviceProvider, Func`1 createContext, Func`2 seed, Func`2 clean) line 27
SharedStoreFixtureBase`1.InitializeAsync() line 71

and 

Microsoft.EntityFrameworkCore.Query.Translations.FullTextSearchTranslationsCosmosTest.Rrf_using_two_FullTextScore_functions
   Source: FullTextSearchTranslationsCosmosTest.cs line 355
   Duration: < 1 ms

  Message: 
Class fixture type 'Microsoft.EntityFrameworkCore.Query.Translations.FullTextSearchTranslationsCosmosTest+FullTextSearchFixture' threw in InitializeAsync
---- Microsoft.Azure.Cosmos.CosmosException : Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: e30112e4-764e-4029-a6d4-818b3256c210; Reason: (
code : BadRequest
message : Message: {"Errors":["The path of the full-text index '/ComplexNestedCollection/[]/AnotherDescription' does not match the path specified in the full-text policy."]}
ActivityId: e30112e4-764e-4029-a6d4-818b3256c210, Request URI: /apps/f1099ee9-2f43-4e48-968b-023e4fb688c1/services/f0d23fcb-73cb-4207-99fc-b960ce2096b0/partitions/94c55af5-3881-4d58-91bb-4c1d3c36976b/replicas/134259198644572087p, RequestStats: , SDK: Microsoft.Azure.Documents.Common/2.14.0
);

  Stack Trace: 
----- Inner Stack Trace -----
ClientContextCore.RunWithDiagnosticsHelperAsync[TResult](String containerName, String databaseName, OperationType operationType, ITrace trace, Func`2 task, Nullable`1 openTelemetry, RequestOptions requestOptions, Nullable`1 resourceType)
ClientContextCore.OperationHelperWithRootTraceAsync[TResult](String operationName, String containerName, String databaseName, OperationType operationType, RequestOptions requestOptions, Func`2 task, Nullable`1 openTelemetry, TraceComponent traceComponent, TraceLevel traceLevel, Nullable`1 resourceType)
CosmosClientWrapper.CreateContainerIfNotExistsOnceAsync(DbContext _, ValueTuple`2 parametersTuple, CancellationToken cancellationToken) line 376
ExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) line 300
<<EnsureCreatedAsync>b__9_0>d.MoveNext() line 85
--- End of stack trace from previous location ---
ExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) line 300
CosmosTestStore.CleanAsyncImpl(DbContext context, Boolean createTables) line 334
CosmosTestStore.CleanAsyncImpl(DbContext context, Boolean createTables) line 356
CosmosTestStore.<CleanAsync>b__40_0(DbContext _, ValueTuple`3 state, CancellationToken ct) line 312
ExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) line 300
<<InitializeAsync>b__0>d.MoveNext() line 78
--- End of stack trace from previous location ---
<<ExecuteAsync>b__3_0>d.MoveNext() line 111
--- End of stack trace from previous location ---
<<ExecuteAsync>b__0>d.MoveNext() line 307
--- End of stack trace from previous location ---
ExecutionStrategy.ExecuteImplementationAsync[TState,TResult](Func`4 operation, Func`4 verifySucceeded, TState state, CancellationToken cancellationToken) line 330
ExecutionStrategy.ExecuteImplementationAsync[TState,TResult](Func`4 operation, Func`4 verifySucceeded, TState state, CancellationToken cancellationToken) line 354
ExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) line 306
TestStore.InitializeAsync(Func`1 createContext, Func`2 seed, Func`2 clean) line 64
CosmosTestStore.InitializeAsync(Func`1 createContext, Func`2 seed, Func`2 clean) line 225
<<InitializeAsync>b__0>d.MoveNext() line 28
--- End of stack trace from previous location ---
TestStoreIndex.CreateSharedAsync(String name, Func`1 initializeDatabase) line 25
TestStore.InitializeAsync(IServiceProvider serviceProvider, Func`1 createContext, Func`2 seed, Func`2 clean) line 27
SharedStoreFixtureBase`1.InitializeAsync() line 71

Verbose output


EF Core version

11.0-preview6 (main branch)

Database provider

Microsoft.EntityFrameworkCore.Cosmos

Target framework

.NET 11

Operating system

W11

IDE

VS2026

Activity

  1. added theissue type on Jul 8, 2026
  2. added this to the 11.0.0 milestone on Jul 8, 2026
  3. added a commit that references this issue on Jul 8, 2026
    d812175
  4. added a commit that references this issue on Jul 13, 2026
    5b8f790
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions