-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
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
Consolidate usage of FluentDescriptorDictionary
#8349
Comments
Hi @niemyjski, this works fine for var query = new QueryDescriptor<Person>()
.Term(t => t
.Field("user.id")
.Value("kimchy")
);
var response = await client.SearchAsync<Person>(s => s
.Query(query)
); we always generate multiple overloads to support these kind of assignments: public SearchRequestDescriptor<TDocument> Query(QueryDsl.Query? query)
public SearchRequestDescriptor<TDocument> Query(QueryDescriptor<TDocument> descriptor)
public SearchRequestDescriptor<TDocument> Query(Action<QueryDsl.QueryDescriptor<TDocument>> configure) For aggregations it's slightly different, but this should work: var aggs = new FluentDescriptorDictionary<string, AggregationDescriptor<Person>>();
aggs = aggs.Add("name1", agg => agg.Avg(avg => avg.Field("test")));
aggs = aggs.Add("name2", agg => agg.Min(min => min.Field("test")));
var response = await client.SearchAsync<Person>(s => s
.Aggregations(_ => aggs)
); As discussed in the other issue, it would be good to have an overload that directly accepts a regular collection of Please let me know, if we can close this issue. |
Feels like if you can do |
This issue is stale because it has been open 5 days with no activity. Remove stale label or comment or this will be closed in 2 days. |
FluentDescriptorDictionary
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:
In the past we built up queries and then assigned them to the descriptor. This is useful in our scenario but also in several apps when you want to conditionally build up queries based on method parameters over various control statements.
Expected behavior
I should be able to apply built up query and aggregation descriptors to the fluent api
Reference: FoundatioFx/Foundatio.Parsers#84
The text was updated successfully, but these errors were encountered: