[Feature Request] /msearch
API fails if any query is malformed
#16862
Labels
enhancement
Enhancement or improvement to existing feature or request
Search
Search query, autocomplete ...etc
Is your feature request related to a problem? Please describe
In the example below, we run two queries on the ecommerce dataset via an
/msearch
request. The first query is valid, but the second query is malformed (due to thenull
value). The entire/msearch
API fails with a 400 error and we do not get a response for the first query.Contrast this with what happens if the second query is malformed in a different way, such as referencing an index that doesn't exist. In this case, the
/msearch
API returns a response for the first query, and an error for the second query.In both cases, only one of the two queries is malformed. However, only the second scenario gives us a partial response. This contrasts with the docs, which state: " OpenSearch executes each search independently, so the failure of one doesn’t affect the others."
Describe the solution you'd like
I would like the
/msearch
API to return the following response for the first scenario. This would give us a partial response, and would prevent the failure of the second query from impacting the first query.If this is considered a breaking change, I'd propose making this behavior opt-in via a boolean request argument.
Related component
Search
Describe alternatives you've considered
We could call the Validate Query on each of the queries we want to execute, but that adds latency to our overall search performance. A bulk version of this API would help, but we'd still prefer if this happened automatically within msearch.
Additional context
The examples above were tested on OpenSearch 2.18 using the dataset from here.
The text was updated successfully, but these errors were encountered: