Skip to content

SearchRequest parameter expression builder #6159

Open

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:

  1. Searching in Elasticsearch
  2. 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: #4998, #4883

CC:
@A360JMaxxgamer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions