ChilliCream / ChilliCream/graphql-platform
`SearchRequest` parameter expression builder
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 5.8k
- Forks
- 810
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 98
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
Related: https://github.com/ChilliCream/graphql-platform/pull/4998, https://github.com/ChilliCream/graphql-platform/discussions/4883
CC:
@A360JMaxxgamer
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Data/Filters/Context/FilterContextParameterExpressionBuilder.cs and the related PR 4998 and discussion 4883. Trace how IResolverContext, UseFiltering, and annotation-based resolvers currently handle parameters, then define the required SearchRequest generation and injection behavior before implementing and validating the two-step Elasticsearch and database query flow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, elasticsearch, graphql
- Domain
- backend-api-design, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100