Description
Product
Hot Chocolate
Is your feature request related to a problem?
The current implementation of the Elasticsearch feature in does not provide an efficient way to handle selective data indexing and retrieval. Right now, while the "all data is index" case is well covered, but usually this is not what people use.
A clear and concise description of what the problem is.
With Elasticsearch, it's often more efficient to index and query specific fields rather than all data. The usual process involves:
- Searching in Elasticsearch
- Performing a DB query with the Elasticsearch results
Currently, we lack a straightforward and efficient way to perform these steps. At the moment we directly return an Executable and return the data from the ES directly.
The solution you'd like
To better manage this, we need a mechanism to generate a SearchRequest<T>
either as an extension method on IResolverContext
or the Elasticsearch client. Moreover, we should have a parameter expression builder that injects a SearchRequest<T>
when [UseFiltering]
is used and a SearchRequest<T>
is injected into the resolver.
The newly added extension methods should allow us to easily generate a SearchRequest<T>
based on the provided context and execute the two-step query process (search in Elasticsearch and perform a DB query with the results). The parameter expression builder should be able to handle injection of a SearchRequest<T>
directly, so that we can also use this in Annotation Based.
Example of a Parameter Expression Builder: https://github.com/ChilliCream/graphql-platform/blob/main/src/HotChocolate/Data/src/Data/Filters/Context/FilterContextParameterExpressionBuilder.cs
CC:
@A360JMaxxgamer