{"record":{"id":"5ec1c6005a197581","repo":"dotnet/efcore","slug":"a-full-text-index-on-entitytype-is-defined-ove","errorCode":null,"errorMessage":"A full-text index on '{entityType}' is defined over multiple properties (`{properties}`). A full-text index can only target a single property.","messagePattern":"A full-text index on '(.+?)' is defined over multiple properties \\(`(.+?)`\\)\\. A full-text index can only target a single property\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs","lineNumber":643,"sourceCode":"                CosmosStrings.VectorIndexOnNonVector(\n                    entityType.DisplayName(),\n                    index.Properties[0].Name));\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 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","sourceCodeStart":625,"sourceCodeEnd":661,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs#L625-L661","documentation":"Thrown by CosmosModelValidator.ValidateFullTextIndex when a full-text index is declared over more than one property. Azure Cosmos DB full-text indexes can target exactly one property each, so the validator rejects any composite full-text index at model validation time.","triggerScenarios":"Calling HasFullTextIndex on an index whose Properties list contains 2+ properties (e.g. composing an index over (Title, Body) and marking it full-text).","commonSituations":"Porting a relational composite full-text index to Cosmos; combining multiple string properties into one index assuming it behaves like SQL Server's full-text catalog.","solutions":["Split the composite full-text index into one single-property full-text index per property.","If you need combined search across multiple fields, query each indexed property separately or project/concatenate at the application layer.","Re-run with the corrected model to confirm validation passes."],"exampleFix":"// before\nmodelBuilder.Entity<Article>()\n    .HasIndex(a => new { a.Title, a.Body })\n    .HasFullTextIndex();\n\n// after\nmodelBuilder.Entity<Article>(b =>\n{\n    b.HasIndex(a => a.Title).HasFullTextIndex();\n    b.HasIndex(a => a.Body).HasFullTextIndex();\n});","handlingStrategy":"validation","validationCode":"// Reject any full-text index whose property count != 1 at startup.\nforeach (var et in modelBuilder.Model.GetEntityTypes())\nforeach (var idx in et.GetIndexes())\n    if (idx.IsFullTextIndex() && idx.Properties.Count != 1)\n        throw new InvalidOperationException($\"Full-text index on {et.DisplayName()} must target a single property.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Define full-text indexes one property at a time; never compose them.","Review any .HasIndex(new { ... }) builder before chaining .HasFullTextIndex().","Codify the single-property rule in a test that scans GetIndexes()."],"tags":["cosmos","full-text-search","model-validation","configuration"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}