Skip to content

Commit a2d71ef

Browse files
added failing test
1 parent 0d6ae3a commit a2d71ef

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

server/src/test/java/org/elasticsearch/rest/action/search/SearchPhaseCoordinatorAPMMetricsTests.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class SearchPhaseCoordinatorAPMMetricsTests extends ESSingleNodeTestCase
4141
private static final String indexName = "test_coordinator_search_phase_metrics";
4242
private final int num_primaries = randomIntBetween(2, 7);
4343

44+
private static final String CAN_MATCH_SEARCH_PHASE_METRIC = "es.search_response.took_durations.can_match.histogram";
4445
private static final String DFS_QUERY_SEARCH_PHASE_METRIC = "es.search_response.took_durations.dfs_query.histogram";
4546
private static final String DFS_SEARCH_PHASE_METRIC = "es.search_response.took_durations.dfs.histogram";
4647
private static final String FETCH_SEARCH_PHASE_METRIC = "es.search_response.took_durations.fetch.histogram";
@@ -112,6 +113,20 @@ public void testPointInTime() {
112113
}
113114
}
114115

116+
public void testCanMatchSearch() {
117+
assertSearchHitsWithoutFailures(
118+
client().prepareSearch(indexName)
119+
.setSearchType(SearchType.QUERY_THEN_FETCH)
120+
.setPreFilterShardSize(1)
121+
.setQuery(simpleQueryStringQuery("doc1")),
122+
"1"
123+
);
124+
125+
assertMeasurements(
126+
List.of(CAN_MATCH_SEARCH_PHASE_METRIC, FETCH_SEARCH_PHASE_METRIC, QUERY_SEARCH_PHASE_METRIC)
127+
);
128+
129+
}
115130
private void resetMeter() {
116131
getTestTelemetryPlugin().resetMeter();
117132
}

0 commit comments

Comments
 (0)