[BUG] Creating an Index with Scoring Profile throws Requested value 'ScoringFunction' was not found. error.
See original GitHub issueDescribe the bug Creating an Index with Scoring Profile throws Requested value ‘ScoringFunction’ was not found. error.
Expected behavior New Index with Scoring Profile Created
Actual behavior (include Exception or Stack Trace)
"Message": "The request is invalid. Details: index : Requested value 'ScoringFunction' was not found.\r\n"
"StackTrace": " at Microsoft.Azure.Search.IndexesOperations.CreateWithHttpMessagesAsync(Index index, SearchRequestOptions searchRequestOptions, Dictionary`2 customHeaders, CancellationToken cancellationToken)\r\n at Microsoft.Azure.Search.IndexesOperationsExtensions.CreateAsync(IIndexesOperations operations, Index index, SearchRequestOptions searchRequestOptions, CancellationToken cancellationToken)\r\n at [OMITTED].[OMITTED].Infrastructure.Search.SearchService.ScoringProfileDebugAsync()..."
To Reproduce Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)
public class AFReproDocument
{
[IsFilterable, IsSearchable]
public string AProp { get; set; }
[IsFilterable, IsSearchable]
public string BProp { get; set; }
}
public async Task ScoringProfileDebugAsync()
{
const string reproIndexName = "repro";
const string reproSProfileName = "reproscoringprofile";
var name = [OMITTED].ServiceName;
var key = [OMITTED].AdminApiKey;
var sClient = new SearchServiceClient(name, new SearchCredentials(key));
if (sClient.Indexes.Exists(reproIndexName))
await sClient.Indexes.DeleteWithHttpMessagesAsync(reproIndexName);
var rIndex = new Index()
{
Name = reproIndexName,
Fields = FieldBuilder.BuildForType<AFReproDocument>(),
ScoringProfiles = new List<ScoringProfile>()
{
new ScoringProfile()
{
Name = reproSProfileName,
Functions = new List<ScoringFunction>()
{
new ScoringFunction(nameof(AFReproDocument.AProp), 1),
new ScoringFunction(nameof(AFReproDocument.BProp), 5)
}
}
},
DefaultScoringProfile = reproSProfileName
};
// Throws "The request is invalid. Details: index : Requested value 'ScoringFunction' was not found.\r\n"
await sClient.Indexes.CreateAsync(rIndex);
}
Environment:
- Name and version of the Library package used: [e.g. Azure.Storage.Blobs 12.2.0] Microsoft.Azure.Search 10.0.1
- Hosting platform or OS and .NET runtime version (
dotnet --info
output for .NET Core projects):
NET Core SDK (reflecting any global.json):
Version: 3.1.201
Commit: b1768b4ae7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.201\
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
2.1.700 [C:\Program Files\dotnet\sdk]
2.1.701 [C:\Program Files\dotnet\sdk]
2.1.801 [C:\Program Files\dotnet\sdk]
2.1.802 [C:\Program Files\dotnet\sdk]
2.2.207 [C:\Program Files\dotnet\sdk]
2.2.300 [C:\Program Files\dotnet\sdk]
2.2.301 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]
2.2.402 [C:\Program Files\dotnet\sdk]
3.1.201 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
- IDE and version : Visual Studio Version 16.5.4
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
My Azure Cognitive Search Index Scoring Profile for ...
I am working with Azure Cog Search and trying to create a scoring profile with a scoring function for distance. I was able...
Read more >Indexer errors and warnings - Azure Cognitive Search
This article provides information and solutions to common errors and warnings you might encounter during indexing and AI enrichment in Azure ...
Read more >Azure Search throws an error when indexing custom ...
A 'PrimitiveValue' node was expected. The error is thrown because the field in the index is created as an Edm. String field instead...
Read more >Top 18 Most Common AngularJS Developer Mistakes
Sheer size of the AngularJS can easily lead to many mistakes. In this article you will learn about most common AngularJS developer mistakes...
Read more >How do scoring profiles generate scores in Azure Search?
The scoring function can be either a magnitude, freshness, geo or tag based function. Multiple functions can be made within one scoring profile....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@AFDevMike That’s an example of field boosting, or did you mean tag boosting? Either way,
ScoringFunction
by itself is just an abstraction and isn’t going to help you there.If you did want to boost by weighting different fields, you need to set the TextWeights property of the scoring profile.
Hope this helps.
TextWeights of the scoring profile is exactly what I needed. Thx!