-
Notifications
You must be signed in to change notification settings - Fork 129
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
[RFC] Introduce Template Query to OpenSearch #2979
Comments
From your example, it seems that vector is the embedding of text |
Will this build on this feature - https://opensearch.org/docs/latest/api-reference/search-template/? |
Right, this is limitation to knn query which requires a list of vectors. For string type, we can use neural query to pass a string to model input(even though we cannot parse different model output format, it requires post processing functions). Extending use cases, for example,
these can be send to model inputs and generate vectors but it cannot be passed to the existing query builders |
Would you like to provide a few examples to showcase how to use your feature with |
Problem Statement:
When using search request processors, users need to send an initial search request with properly constructed query builders. However, if the initial request fails to meet the type constraints of the query builders, it will be rejected, and the search request cannot be processed by the search request processors.
The data flow is as follows:
Initial Search Request -> Search Request Processors -> New Search Request
However, when constructing the initial request every query builder has type constrains. For example, for knn query,
(Happy case) this is a valid query accepted by knn query builder, and it can be passed to search request processors:
(Sad case) this is not a valid query that would be throwing exceptions when constructing knn query builder. It cannot reach search request processors.
In the sad case, the "vector" field is provided with a string value ("sunny") instead of the required list of integers or floats, violating the type constraints of the knn query builder. As a result, an exception will be thrown during the construction of the query builder, preventing the search request from reaching the search request processors.
Scope:
Proposed Design:
To allow the initial search request to pass the search request processors, we are introducing a template query type, which contains the query body.
for the same example above, here is the sample curl command using query extensions:
combing with a ml_inference search request processor and query extension:
this is the sample search pipeline config:
after ml inference search request processor run, it will rewrite to the new search requests as follows:
By using the template query type, the initial search request can bypass the strict type checking and validation of the query builders during the initial processing by the search request processors. This allows the search request to flow through the search request processors, even if the query body contains invalid or incorrect data types.
After the search request processors have completed their processing, the query body inside the template query type can be validated and processed according to the type constraints of the respective query builders.
This approach separates the initial processing of the search request from the validation and construction of the query builders, allowing for more flexibility and error handling in the overall search request processing pipeline.
Limitations:
The text was updated successfully, but these errors were encountered: