dotnet/efcore · error · InvalidOperationException
A full-text index is defined for `{entityType}.{property}`,
Error message
A full-text index is defined for `{entityType}.{property}`, but full-text search was not enabled for this property. Use '{enableFullText}' method in 'OnModelCreating' to enable full-text search for this property. What it means
Thrown by CosmosModelValidator.ValidateFullTextIndex when the single property of a full-text index does not have IsFullTextSearchEnabled set to true. The validator checks index.Properties[0].GetIsFullTextSearchEnabled() != true and names the EnableFullTextSearch extension method as the remediation. The full-text index policy and the per-property full-text flag are separate facets and both must be set consistently.
Source
Thrown at src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs:652
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
protected virtual void ValidateFullTextIndex(
IIndex index,
IDiagnosticsLogger<DbLoggerCategory.Model.Validation> logger)
{
if (index.Properties.Count > 1)
{
throw new InvalidOperationException(
CosmosStrings.CompositeFullTextIndex(
index.DeclaringEntityType.DisplayName(),
string.Join(",", index.Properties.Select(e => e.Name))));
}
if (index.Properties[0] is not IProperty firstFullTextProperty
|| firstFullTextProperty.GetIsFullTextSearchEnabled() != true)
{
throw new InvalidOperationException(
CosmosStrings.FullTextIndexOnNonFullTextProperty(
index.DeclaringEntityType.DisplayName(),
index.Properties[0].Name,
nameof(CosmosPropertyBuilderExtensions.EnableFullTextSearch)));
}
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
protected override void ValidateProperty(
IProperty property,
ITypeBase structuralType,
IDiagnosticsLogger<DbLoggerCategory.Model.Validation> logger)
{View on GitHub (pinned to dbf9771522)
Solutions
- Call EnableFullTextSearch on the exact same property that the index targets, inside OnModelCreating.
- Verify the property name in HasIndex matches the property on which EnableFullTextSearch is called.
Example fix
// before
modelBuilder.Entity<Doc>()
.HasIndex(d => d.Summary)
.HasFullTextIndex();
// after
modelBuilder.Entity<Doc>()
.Property(d => d.Summary)
.EnableFullTextSearch();
modelBuilder.Entity<Doc>()
.HasIndex(d => d.Summary)
.HasFullTextIndex(); Defensive patterns
Strategy: validation
Validate before calling
// Assert the full-text flag is set on the indexed property before validation runs
foreach (var index in modelBuilder.Model.GetEntityTypes().SelectMany(e => e.GetIndexes()))
{
if (index.Properties.Count == 1 && index.Properties[0].GetIsFullTextSearchEnabled() != true)
{
// decide: enable it, or remove the full-text designation
}
} Prevention
- Keep the EnableFullTextSearch call directly adjacent to the matching HasFullTextIndex call in OnModelCreating.
- Write a model snapshot test that asserts every full-text index property has IsFullTextSearchEnabled true.
When it happens
Trigger: Configuring builder.HasIndex(x => x.Summary).HasFullTextIndex() without first calling EnableFullTextSearch on the Summary property in the same OnModelCreating.
Common situations: Copy-pasting only the HasFullTextIndex half of the recipe, or enabling full-text on the index but on a different property than the one in the index. Generated/migrated models where the property-level facet was dropped.
Related errors
- A full-text index on '{entityType}' is defined over multiple
- The property '{propertyType} {structuralType}.{property}' ha
- The entity type '{entityType}' has property '{property}' con
- The type of the etag property '{property}' on '{entityType}'
- Trigger '{trigger}' is defined on entity type '{entityType}'
AI-assisted analysis of dotnet/efcore@dbf9771522 (2026-08-06).
Data as JSON: /api/errors/52b86c338d9e19c2.
Report an issue: GitHub.