Skip to content
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

[8.18] Query rules: Check if MGET request failed when we retrieve query rules (#123616) #123910

Merged
merged 2 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
setup:
- do:
bulk:
refresh: true
index: test-index1
body:
- index:
_id: foo
- { "text": "foo - pinned doc for foo" }

---
"query rules retriever when the .query-rules system index is missing":
- skip:
features: [ headers ]
- do:
search:
index: test-index1
body:
retriever:
rule:
match_criteria:
foo: foo
bar: bar
ruleset_ids:
abc
retriever:
standard:
query:
query_string:
query: bar
explain: true
catch: "missing"
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,15 @@ protected QueryBuilder doRewrite(QueryRewriteContext queryRewriteContext) {

for (MultiGetItemResponse item : multiGetResponse) {
String rulesetId = item.getId();
// this usually happens when the system index does not exist because no query rules were created yet
if (item.isFailed()) {
listener.onFailure(item.getFailure().getFailure());
return;
}

GetResponse getResponse = item.getResponse();

// this happens when an individual query ruleset cannot be found
if (getResponse.isExists() == false) {
listener.onFailure(new ResourceNotFoundException("query ruleset " + rulesetId + " not found"));
return;
Expand Down