{"record":{"id":"52b86c338d9e19c2","repo":"dotnet/efcore","slug":"a-full-text-index-is-defined-for-entitytype-pr","errorCode":null,"errorMessage":"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.","messagePattern":"A full-text index is defined for `(.+?)\\.(.+?)`, but full-text search was not enabled for this property\\. Use '(.+?)' method in 'OnModelCreating' to enable full-text search for this property\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs","lineNumber":652,"sourceCode":"    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    protected virtual void ValidateFullTextIndex(\n        IIndex index,\n        IDiagnosticsLogger<DbLoggerCategory.Model.Validation> logger)\n    {\n        if (index.Properties.Count > 1)\n        {\n            throw new InvalidOperationException(\n                CosmosStrings.CompositeFullTextIndex(\n                    index.DeclaringEntityType.DisplayName(),\n                    string.Join(\",\", index.Properties.Select(e => e.Name))));\n        }\n\n        if (index.Properties[0] is not IProperty firstFullTextProperty\n            || firstFullTextProperty.GetIsFullTextSearchEnabled() != true)\n        {\n            throw new InvalidOperationException(\n                CosmosStrings.FullTextIndexOnNonFullTextProperty(\n                    index.DeclaringEntityType.DisplayName(),\n                    index.Properties[0].Name,\n                    nameof(CosmosPropertyBuilderExtensions.EnableFullTextSearch)));\n        }\n    }\n\n    /// <summary>\n    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to\n    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in\n    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    protected override void ValidateProperty(\n        IProperty property,\n        ITypeBase structuralType,\n        IDiagnosticsLogger<DbLoggerCategory.Model.Validation> logger)\n    {","sourceCodeStart":634,"sourceCodeEnd":670,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs#L634-L670","documentation":"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.","triggerScenarios":"Configuring builder.HasIndex(x => x.Summary).HasFullTextIndex() without first calling EnableFullTextSearch on the Summary property in the same OnModelCreating.","commonSituations":"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.","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."],"exampleFix":"// before\nmodelBuilder.Entity<Doc>()\n    .HasIndex(d => d.Summary)\n    .HasFullTextIndex();\n\n// after\nmodelBuilder.Entity<Doc>()\n    .Property(d => d.Summary)\n    .EnableFullTextSearch();\nmodelBuilder.Entity<Doc>()\n    .HasIndex(d => d.Summary)\n    .HasFullTextIndex();","handlingStrategy":"validation","validationCode":"// Assert the full-text flag is set on the indexed property before validation runs\nforeach (var index in modelBuilder.Model.GetEntityTypes().SelectMany(e => e.GetIndexes()))\n{\n    if (index.Properties.Count == 1 && index.Properties[0].GetIsFullTextSearchEnabled() != true)\n    {\n        // decide: enable it, or remove the full-text designation\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["cosmos","ef-core","model-validation","full-text-index"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}