We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Elastic.Clients.Elasticsearch version: 8.0.1
Elasticsearch version: 8.5.2
.NET runtime version:
$ dotnet --version 7.0.100 $ dotnet --list-runtimes Microsoft.AspNetCore.App 6.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
This is an AspNetCore 6.0.11
Operating system version: macOS Ventura 13.0.1 (22A400)
Description of the problem including expected versus actual behavior: Cannot set Sort order in SortOptionsDescriptor<T>
SortOptionsDescriptor<T>
Steps to reproduce:
var response = await client.SearchAsync<SomeType>( s => s .Index("...") .Size(100) .Sort( srt => srt.Field( f => f.SomeFieldHere, cfg => cfg.Order(SortOrder.Desc) ) ), cancellationToken );
The above compiles fine. When invoked at runtime, there is an exception:
Stacktrace (partial)
Elastic.Transport.UnexpectedTransportException: Value cannot be null. (Parameter 'propertyName') ---> System.ArgumentNullException: Value cannot be null. (Parameter 'propertyName') at System.Text.Json.Utf8JsonWriter.WritePropertyName(String propertyName) at Elastic.Clients.Elasticsearch.SortOptionsDescriptor`1.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) in /_/src/Elastic.Clients.Elasticsearch/_Generated/Types/SortOptions.g.cs:line 165 at Elastic.Clients.Elasticsearch.Fluent.SerializableDescriptor`1.Elastic.Clients.Elasticsearch.Serialization.ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) in /_/src/Elastic.Clients.Elasticsearch/Core/Fluent/Descriptor.cs:line 71 at Elastic.Clients.Elasticsearch.Serialization.SelfSerializableConverterFactory.SelfSerializableJsonConverter.Write(Utf8JsonWriter writer, ISelfSerializable value, JsonSerializerOptions options) in /_/src/Elastic.Clients.Elasticsearch/Serialization/SelfSerializableConverterFactory.cs:line 34 at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter`1.WriteCoreAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.JsonSerializer.WriteUsingSerializer[TValue](Utf8JsonWriter writer, TValue& value, JsonTypeInfo jsonTypeInfo) at System.Text.Json.JsonSerializer.Serialize[TValue](Utf8JsonWriter writer, TValue value, JsonSerializerOptions options) at Elastic.Clients.Elasticsearch.SearchRequestDescriptor`1.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) in /_/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchRequest.g.cs:line 1629 at Elastic.Clients.Elasticsearch.Requests.RequestDescriptor`2.Elastic.Clients.Elasticsearch.Serialization.ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) in /_/src/Elastic.Clients.Elasticsearch/Core/Request/RequestDescriptor.cs:line 22 ...
If I omit the FieldSortOrderDescriptor (i.e., the second argument), everything works as expected. But then, how can I specify the sort order?
FieldSortOrderDescriptor
Surely, I am doing something wrong.
The text was updated successfully, but these errors were encountered:
Thanks for raising this, @kleanthis. This looks like a bug which I'll investigate ASAP.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Elastic.Clients.Elasticsearch version:
8.0.1
Elasticsearch version:
8.5.2
.NET runtime version:
This is an AspNetCore 6.0.11
Operating system version:
macOS Ventura 13.0.1 (22A400)
Description of the problem including expected versus actual behavior:
Cannot set Sort order in
SortOptionsDescriptor<T>
Steps to reproduce:
The above compiles fine. When invoked at runtime, there is an exception:
Stacktrace (partial)
If I omit the
FieldSortOrderDescriptor
(i.e., the second argument), everything works as expected. But then, how can I specify the sort order?Surely, I am doing something wrong.
The text was updated successfully, but these errors were encountered: