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.15.6
Elasticsearch version: 8.15.1
.NET runtime version: 8.x
Operating system version: Any
Description of the problem including expected versus actual behavior:
Sorting with the new client is insanely verbose and tedious, to the point I don't even want to convert the tests we have...
// Previous Client.Search<MyType>(d => d.Index(index).Aggregations(a => a .Terms("terms_field1", t => t .Field("field1.keyword") .Order(o => o.Descending("cardinality_field4")))); // New await Client.SearchAsync<MyType>(d => d.Index(index).Aggregations(a => a .Add("terms_field1", a1 => a1 .Terms(t => t.Field("field1.keyword").Order(new List<KeyValuePair<Field, SortOrder>> { new ("cardinality_field4", SortOrder.Desc) })))));
// Previous if (termsAggregation != null && (child.Prefix == "-" || child.Prefix == "+")) { if (termsAggregation.Order == null) termsAggregation.Order = new List<TermsOrder>(); termsAggregation.Order.Add(new TermsOrder { Key = ((IAggregation)aggregation).Name, Order = child.Prefix == "-" ? SortOrder.Descending : SortOrder.Ascending }); } // New if (termsAggregation != null && child.Prefix is "-" or "+") { termsAggregation.Order ??= new List<KeyValuePair<Field, SortOrder>>(); termsAggregation.Order.Add(new KeyValuePair<Field, SortOrder>(aggregation.Name, child.Prefix == "-" ? SortOrder.Desc : SortOrder.Asc)); }
await Client.SearchAsync<MyType>(d => d.Index(index).Sort(s => s .Field(f => f.Field(new Field("field3")).Ascending().UnmappedType(FieldType.GeoPoint)) .Field(f => f.Field(new Field("field1.keyword")).Descending().UnmappedType(FieldType.Keyword)) .Field(f => f.Field(new Field("field2.sort")).Descending().UnmappedType(FieldType.Keyword)) .Field(f => f.Field(new Field("field3")).Descending().UnmappedType(FieldType.GeoPoint)) .Field(f => f.Field(new Field("field4")).Ascending().UnmappedType(FieldType.Long)) .Field(f => f.Field(new Field("field5")).Ascending().UnmappedType(FieldType.Date)) .Field(f => f.Field(new Field("field3")).Ascending().UnmappedType(FieldType.GeoPoint)) ));
Expected behavior
Sorting should be a very common operation and easy todo.
Reference: FoundatioFx/Foundatio.Parsers#84
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Elastic.Clients.Elasticsearch version: 8.15.6
Elasticsearch version: 8.15.1
.NET runtime version: 8.x
Operating system version: Any
Description of the problem including expected versus actual behavior:
Sorting with the new client is insanely verbose and tedious, to the point I don't even want to convert the tests we have...
Example 1
Example 2
Example 3 (I don't even want to think about converting)
Expected behavior
Sorting should be a very common operation and easy todo.
Reference: FoundatioFx/Foundatio.Parsers#84
The text was updated successfully, but these errors were encountered: