{"record":{"id":"d4f50b014f9f6353","repo":"dotnet/efcore","slug":"property-entitytype-property-was-configured","errorCode":null,"errorMessage":"Property '{entityType}.{property}' was configured for full-text search, but has type '{clrType}'; only string properties can be configured for full-text search.","messagePattern":"Property '(.+?)\\.(.+?)' was configured for full-text search, but has type '(.+?)'; only string properties can be configured for full-text search\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs","lineNumber":250,"sourceCode":"                        ? CompositePathSortOrder.Descending\n                        : CompositePathSortOrder.Ascending;\n                    compositePaths.Add(new CompositePath { Path = path, Order = order });\n                    key.Append(path).Append('=').Append(order).Append('|');\n                }\n\n                if (seenCompositeIndexes.Add(key.ToString()))\n                {\n                    compositeIndexes.Add(compositePaths);\n                }\n            }\n        }\n\n        var fullTextPaths = new Collection<FullTextPath>();\n        foreach (var (property, language) in parameters.FullTextProperties)\n        {\n            if (property.ClrType != typeof(string))\n            {\n                throw new InvalidOperationException(\n                    CosmosStrings.FullTextSearchConfiguredForUnsupportedPropertyType(\n                        property.DeclaringType.DisplayName(),\n                        property.Name,\n                        property.ClrType.Name));\n            }\n\n            fullTextPaths.Add(\n                new FullTextPath\n                {\n                    Path = GetJsonPropertyPathFromRoot(property),\n                    // TODO: remove the fallback once Cosmos SDK allows optional language (see #35939)\n                    Language = language ?? parameters.DefaultFullTextLanguage ?? \"en-US\"\n                });\n        }\n\n        var embeddings = new Collection<Embedding>();\n        foreach (var (property, vectorType) in parameters.Vectors)\n        {","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs#L232-L268","documentation":"CosmosClientWrapper throws FullTextSearchConfiguredForUnsupportedPropertyType when generating full-text paths and finds a property configured for full-text search whose ClrType is not string. Cosmos DB full-text search supports only string properties; applying it to any other CLR type is rejected at create-container time.","triggerScenarios":"Marking a non-string property (int, byte[], Json, GUID, etc.) as full-text searchable in OnModelCreating.","commonSituations":"Accidentally applying IsFullText to a binary/JSON payload column; applying full-text configuration to the wrong property; copy-paste from a string property to a non-string one.","solutions":["Move the full-text configuration to a string property.","Change the property's CLR type to string if full-text search is required on that data.","Serialize the searchable content into a dedicated string column and index that."],"exampleFix":"// before - Content is byte[]\nmodelBuilder.Entity<Doc>().Property(x => x.Content).IsFullText();\n\n// after - Text is string and holds searchable content\nmodelBuilder.Entity<Doc>().Property(x => x.Text).IsFullText();","handlingStrategy":"validation","validationCode":"// At model build, assert full-text-configured properties are strings.\nforeach (var prop in entityType.GetProperties())\n{\n    if (prop.IsFullText() == true && prop.ClrType != typeof(string))\n        throw new InvalidOperationException($\"{entityType.DisplayName()}.{prop.Name} ({prop.ClrType.Name}) cannot be full-text indexed; only string is supported.\");\n}","typeGuard":"static bool CanBeFullTextIndexed(IProperty p) => p.ClrType == typeof(string);","tryCatchPattern":null,"preventionTips":["Apply full-text configuration only to string properties.","Add a model-build validator that rejects full-text on non-string properties.","Store searchable content in a dedicated string column when the source is non-string."],"tags":["cosmos","full-text-search","model","type-mapping"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}