@@ -418,18 +418,18 @@ public void testHasChildWithInnerHit() throws Exception {
418418 duelSearch (searchRequest , CCSDuelIT ::assertHits );
419419 }
420420
421- // public void testProfile() throws Exception {
422- // assumeMultiClusterSetup();
423- // SearchRequest searchRequest = initSearchRequest();
424- // SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
425- // sourceBuilder.profile(true);
426- // sourceBuilder.query(QueryBuilders.matchQuery("tags", "html"));
427- // searchRequest.source(sourceBuilder);
428- // duelSearch(searchRequest, response -> {
429- // assertHits(response);
430- // assertFalse(response.getProfileResults().isEmpty());
431- // });
432- // }
421+ public void testProfile () throws Exception {
422+ assumeMultiClusterSetup ();
423+ SearchRequest searchRequest = initSearchRequest ();
424+ SearchSourceBuilder sourceBuilder = new SearchSourceBuilder ();
425+ sourceBuilder .profile (true );
426+ sourceBuilder .query (QueryBuilders .matchQuery ("tags" , "html" ));
427+ searchRequest .source (sourceBuilder );
428+ duelSearch (searchRequest , response -> {
429+ assertHits (response );
430+ assertFalse (response .getProfileResults ().isEmpty ());
431+ });
432+ }
433433
434434 public void testSortByField () throws Exception {
435435 assumeMultiClusterSetup ();
@@ -831,10 +831,12 @@ private static Map<String, Object> responseToMap(SearchResponse response) throws
831831 Map <String , Object > responseMap = org .opensearch .common .xcontent .XContentHelper .convertToMap (bytesReference , false , MediaTypeRegistry .JSON ).v2 ();
832832 assertNotNull (responseMap .put ("took" , -1 ));
833833 responseMap .remove ("num_reduce_phases" );
834- Map <String , Object > profile = (Map <String , Object >)responseMap .get ("profile" );
834+ Map <String , Object > profile = (Map <String , Object >) responseMap .get ("profile" );
835835 if (profile != null ) {
836- List <Map <String , Object >> shards = (List <Map <String , Object >>)profile .get ("shards" );
836+ List <Map <String , Object >> shards = (List <Map <String , Object >>) profile .get ("shards" );
837837 for (Map <String , Object > shard : shards ) {
838+ // Unconditionally remove the fetch profile to prevent flaky failures
839+ shard .remove ("fetch" );
838840 replaceProfileTime (shard );
839841 }
840842 }
0 commit comments