10
10
11
11
import com .carrotsearch .randomizedtesting .annotations .ParametersFactory ;
12
12
13
+ import org .opensearch .action .admin .indices .segments .IndicesSegmentResponse ;
13
14
import org .opensearch .action .search .SearchResponse ;
14
15
import org .opensearch .cluster .health .ClusterHealthStatus ;
15
16
import org .opensearch .cluster .metadata .IndexMetadata ;
26
27
import java .util .Collection ;
27
28
import java .util .List ;
28
29
30
+ import static org .opensearch .indices .IndicesRequestCache .INDEX_CACHE_REQUEST_ENABLED_SETTING ;
29
31
import static org .opensearch .search .SearchService .CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING ;
30
32
import static org .opensearch .test .hamcrest .OpenSearchAssertions .assertAcked ;
31
33
import static org .opensearch .test .hamcrest .OpenSearchAssertions .assertSearchResponse ;
@@ -50,26 +52,31 @@ public void setupSuiteScopeCluster() throws Exception {
50
52
assertAcked (
51
53
prepareCreate (
52
54
"idx" ,
53
- Settings .builder ().put (IndexMetadata .SETTING_NUMBER_OF_SHARDS , 1 ).put (IndexMetadata .SETTING_NUMBER_OF_REPLICAS , 0 )
55
+ Settings .builder ()
56
+ .put (IndexMetadata .SETTING_NUMBER_OF_SHARDS , 1 )
57
+ .put (IndexMetadata .SETTING_NUMBER_OF_REPLICAS , 0 )
58
+ .put (INDEX_CACHE_REQUEST_ENABLED_SETTING .getKey (), false )
54
59
).setMapping ("type" , "type=keyword" , "num" , "type=integer" , "score" , "type=integer" )
55
60
);
56
61
waitForRelocation (ClusterHealthStatus .GREEN );
57
62
58
- client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type1" , "num" , "1" , "score" , "5" ).get ();
59
- client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type2" , "num" , "11" , "score" , "50" ).get ();
60
- refresh ("idx" );
61
- client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type1" , "num" , "1" , "score" , "2" ).get ();
62
- client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type2" , "num" , "12" , "score" , "20" ).get ();
63
- refresh ("idx" );
64
- client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type1" , "num" , "3" , "score" , "10" ).get ();
65
- client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type2" , "num" , "13" , "score" , "15" ).get ();
66
- refresh ("idx" );
67
- client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type1" , "num" , "3" , "score" , "1" ).get ();
68
- client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type2" , "num" , "13" , "score" , "100" ).get ();
69
- refresh ("idx" );
63
+ indexRandom (
64
+ true ,
65
+ client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type1" , "num" , "1" , "score" , "5" ),
66
+ client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type2" , "num" , "11" , "score" , "50" ),
67
+ client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type1" , "num" , "1" , "score" , "2" ),
68
+ client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type2" , "num" , "12" , "score" , "20" ),
69
+ client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type1" , "num" , "3" , "score" , "10" ),
70
+ client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type2" , "num" , "13" , "score" , "15" ),
71
+ client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type1" , "num" , "3" , "score" , "1" ),
72
+ client ().prepareIndex ("idx" ).setId ("1" ).setSource ("type" , "type2" , "num" , "13" , "score" , "100" )
73
+ );
70
74
71
75
waitForRelocation (ClusterHealthStatus .GREEN );
72
76
refresh ();
77
+
78
+ IndicesSegmentResponse segmentResponse = client ().admin ().indices ().prepareSegments ("idx" ).get ();
79
+ System .out .println ("Segments: " + segmentResponse .getIndices ().get ("idx" ).getShards ().get (0 ).getShards ()[0 ].getSegments ().size ());
73
80
}
74
81
75
82
public void testCompositeAggWithNoSubAgg () {
0 commit comments