Skip to content

Commit 00c8ad8

Browse files
authored
Add rule retriever yaml test with empty indices (#125161)
* Add rule retriever yaml test with empty indices * Add more specificity to NodeFeature name
1 parent 23769da commit 00c8ad8

File tree

2 files changed

+76
-1
lines changed

2 files changed

+76
-1
lines changed

x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/40_rule_query_search.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,3 +893,74 @@ teardown:
893893
- match: { hits.total.value: 2 }
894894
- match: { hits.hits.0._id: 'doc1' }
895895
- match: { hits.hits.1._id: 'doc4' }
896+
897+
---
898+
"Multi-index search with missing documents does not error":
899+
- requires:
900+
cluster_features: [ "test_rule_retriever.with_indices_that_dont_return_rank_docs" ]
901+
reason: "Fixed in 9.1"
902+
903+
- do:
904+
indices.create:
905+
index: test-index-001
906+
907+
- do:
908+
indices.create:
909+
index: test-index-002
910+
911+
- do:
912+
bulk:
913+
refresh: true
914+
index: test-index-001
915+
body:
916+
- index:
917+
_id: 1
918+
- { "text": "patio" }
919+
- index:
920+
_id: 2
921+
- { "text": "catio" }
922+
923+
- do:
924+
bulk:
925+
refresh: true
926+
index: test-index-002
927+
body:
928+
- index:
929+
_id: 3
930+
- { "text": "balcony" }
931+
- index:
932+
_id: 4
933+
- { "text": "overhang" }
934+
935+
- do:
936+
query_rules.put_ruleset:
937+
ruleset_id: catio-ruleset
938+
body:
939+
rules:
940+
- rule_id: rule1
941+
type: pinned
942+
criteria:
943+
- type: exact
944+
metadata: foo
945+
values: [ bar ]
946+
actions:
947+
ids:
948+
- '2'
949+
950+
- do:
951+
search:
952+
body:
953+
retriever:
954+
rule:
955+
retriever:
956+
standard:
957+
query:
958+
query_string:
959+
query: "patio or balcony"
960+
match_criteria:
961+
foo: bar
962+
ruleset_ids: catio-ruleset
963+
964+
- match: { hits.total.value: 3 }
965+
- match: { hits.hits.0._id: '2' }
966+

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferenceFeatures.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public class InferenceFeatures implements FeatureSpecification {
3030
private static final NodeFeature TEST_RERANKING_SERVICE_PARSE_TEXT_AS_SCORE = new NodeFeature(
3131
"test_reranking_service.parse_text_as_score"
3232
);
33+
private static final NodeFeature TEST_RULE_RETRIEVER_WITH_INDICES_THAT_DONT_RETURN_RANK_DOCS = new NodeFeature(
34+
"test_rule_retriever.with_indices_that_dont_return_rank_docs"
35+
);
3336

3437
@Override
3538
public Set<NodeFeature> getTestFeatures() {
@@ -51,7 +54,8 @@ public Set<NodeFeature> getTestFeatures() {
5154
SEMANTIC_KNN_FILTER_FIX,
5255
TEST_RERANKING_SERVICE_PARSE_TEXT_AS_SCORE,
5356
SemanticTextFieldMapper.SEMANTIC_TEXT_BIT_VECTOR_SUPPORT,
54-
SemanticTextFieldMapper.SEMANTIC_TEXT_HANDLE_EMPTY_INPUT
57+
SemanticTextFieldMapper.SEMANTIC_TEXT_HANDLE_EMPTY_INPUT,
58+
TEST_RULE_RETRIEVER_WITH_INDICES_THAT_DONT_RETURN_RANK_DOCS
5559
);
5660
}
5761
}

0 commit comments

Comments
 (0)