Skip to content

Commit 94e5549

Browse files
committed
Adjust profile tests
1 parent 7f95ac5 commit 94e5549

File tree

5 files changed

+48
-6
lines changed

5 files changed

+48
-6
lines changed

rest-api-spec/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ tasks.named("precommit").configure {
5757
tasks.named("yamlRestCompatTestTransform").configure ({ task ->
5858
task.replaceValueInMatch("profile.shards.0.dfs.knn.0.query.0.description", "DocAndScoreQuery[0,...][0.009673266,...],0.009673266", "dfs knn vector profiling")
5959
task.replaceValueInMatch("profile.shards.0.dfs.knn.0.query.0.description", "DocAndScoreQuery[0,...][0.009673266,...],0.009673266", "dfs knn vector profiling with vector_operations_count")
60+
task.replaceValueInMatch("profile.shards.0.dfs.knn.0.collector.0.name", "TopScoreDocCollector", "dfs knn vector profiling")
61+
task.replaceValueInMatch("profile.shards.0.dfs.knn.0.query.0.description", "TopScoreDocCollector", "dfs knn vector profiling with vector_operations_count")
6062
task.skipTest("cat.aliases/10_basic/Deprecated local parameter", "CAT APIs not covered by compatibility policy")
6163
task.skipTest("cat.shards/10_basic/Help", "sync_id is removed in 9.0")
6264
task.skipTest("search/500_date_range/from, to, include_lower, include_upper deprecated", "deprecated parameters are removed in 9.0")

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/370_profile.yml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ dfs knn vector profiling:
230230
- gt: { profile.shards.0.dfs.knn.0.query.0.breakdown.create_weight: 0 }
231231
- gt: { profile.shards.0.dfs.knn.0.query.0.breakdown.create_weight_count: 0 }
232232
- gt: { profile.shards.0.dfs.knn.0.rewrite_time: 0 }
233-
- match: { profile.shards.0.dfs.knn.0.collector.0.name: "SimpleTopScoreDocCollector" }
234233
- match: { profile.shards.0.dfs.knn.0.collector.0.reason: "search_top_hits" }
235234
- gt: { profile.shards.0.dfs.knn.0.collector.0.time_in_nanos: 0 }
236235

@@ -275,6 +274,47 @@ dfs knn vector profiling description:
275274
- match: { hits.total.value: 1 }
276275
- match: { profile.shards.0.dfs.knn.0.query.0.description: "DocAndScoreQuery[0,...][0.009673266,...],0.009673266" }
277276

277+
---
278+
dfs knn vector profiling collector name:
279+
- requires:
280+
cluster_features: "lucene_10_1_upgrade"
281+
reason: collector name changed with lucene 10.1
282+
283+
- do:
284+
indices.create:
285+
index: images
286+
body:
287+
settings:
288+
index.number_of_shards: 1
289+
mappings:
290+
properties:
291+
image:
292+
type: "dense_vector"
293+
dims: 3
294+
index: true
295+
similarity: "l2_norm"
296+
297+
- do:
298+
index:
299+
index: images
300+
id: "1"
301+
refresh: true
302+
body:
303+
image: [1, 5, -20]
304+
305+
- do:
306+
search:
307+
index: images
308+
body:
309+
profile: true
310+
knn:
311+
field: "image"
312+
query_vector: [-5, 9, -12]
313+
k: 1
314+
num_candidates: 100
315+
316+
- match: { profile.shards.0.dfs.knn.0.collector.0.name: "TopScoreDocCollector" }
317+
278318
---
279319
dfs knn vector profiling with vector_operations_count:
280320
- requires:
@@ -335,7 +375,6 @@ dfs knn vector profiling with vector_operations_count:
335375
- gt: { profile.shards.0.dfs.knn.0.query.0.breakdown.create_weight: 0 }
336376
- gt: { profile.shards.0.dfs.knn.0.query.0.breakdown.create_weight_count: 0 }
337377
- gt: { profile.shards.0.dfs.knn.0.rewrite_time: 0 }
338-
- match: { profile.shards.0.dfs.knn.0.collector.0.name: "SimpleTopScoreDocCollector" }
339378
- match: { profile.shards.0.dfs.knn.0.collector.0.reason: "search_top_hits" }
340379
- gt: { profile.shards.0.dfs.knn.0.collector.0.time_in_nanos: 0 }
341380

server/src/main/java/org/elasticsearch/search/SearchFeatures.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
public final class SearchFeatures implements FeatureSpecification {
1919

2020
public static final NodeFeature LUCENE_10_0_0_UPGRADE = new NodeFeature("lucene_10_upgrade");
21+
public static final NodeFeature LUCENE_10_1_0_UPGRADE = new NodeFeature("lucene_10_1_upgrade");
2122

2223
@Override
2324
public Set<NodeFeature> getFeatures() {
24-
return Set.of(KnnVectorQueryBuilder.K_PARAM_SUPPORTED, LUCENE_10_0_0_UPGRADE);
25+
return Set.of(KnnVectorQueryBuilder.K_PARAM_SUPPORTED, LUCENE_10_0_0_UPGRADE, LUCENE_10_1_0_UPGRADE);
2526
}
2627
}

server/src/test/java/org/elasticsearch/search/dfs/DfsPhaseTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ public void testSingleKnnSearch() throws IOException {
8686
List<QueryProfileShardResult> queryProfileShardResult = searchProfileDfsPhaseResult.getQueryProfileShardResult();
8787
assertNotNull(queryProfileShardResult);
8888
CollectorResult collectorResult = queryProfileShardResult.get(0).getCollectorResult();
89-
assertEquals("SimpleTopScoreDocCollector", (collectorResult.getName()));
89+
assertEquals("TopScoreDocCollector", (collectorResult.getName()));
9090
assertEquals("search_top_hits", (collectorResult.getReason()));
9191
assertTrue(collectorResult.getTime() > 0);
9292
List<CollectorResult> children = collectorResult.getChildrenResults();
9393
if (children.size() > 0) {
9494
long totalTime = 0L;
9595
for (CollectorResult child : children) {
96-
assertEquals("SimpleTopScoreDocCollector", (child.getName()));
96+
assertEquals("TopScoreDocCollector", (child.getName()));
9797
assertEquals("search_top_hits", (child.getReason()));
9898
totalTime += child.getTime();
9999
}

server/src/test/java/org/elasticsearch/search/profile/query/ProfileCollectorManagerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void testManagerWithSearcher() throws IOException {
135135
assertEquals(numDocs, topDocs.totalHits.value());
136136
CollectorResult result = profileCollectorManager.getCollectorTree();
137137
assertEquals("profiler_reason", result.getReason());
138-
assertEquals("SimpleTopScoreDocCollector", result.getName());
138+
assertEquals("TopScoreDocCollector", result.getName());
139139
assertTrue(result.getTime() > 0);
140140
}
141141
}

0 commit comments

Comments
 (0)