31
31
import co .elastic .clients .elasticsearch ._core .SearchResponse ;
32
32
import co .elastic .clients .elasticsearch ._core .bulk .ResponseItem ;
33
33
import co .elastic .clients .elasticsearch .cat .NodesResponse ;
34
- import co .elastic .clients .elasticsearch .indices .CreateResponse ;
35
- import co .elastic .clients .elasticsearch .indices .GetResponse ;
34
+ import co .elastic .clients .elasticsearch .indices .CreateIndexResponse ;
35
+ import co .elastic .clients .elasticsearch .indices .GetIndexResponse ;
36
36
import co .elastic .clients .elasticsearch .indices .IndexState ;
37
37
import co .elastic .clients .elasticsearch .model .ModelTestCase ;
38
38
import co .elastic .clients .json .JsonpMapper ;
@@ -76,6 +76,16 @@ public static void tearDown() {
76
76
}
77
77
}
78
78
79
+ @ Test
80
+ public void testCount () throws Exception {
81
+ // Tests that a no-parameter method exists for endpoints that only have optional properties
82
+ RestClient restClient = RestClient .builder (new HttpHost ("localhost" , container .getMappedPort (9200 ))).build ();
83
+ Transport transport = new RestClientTransport (restClient , mapper );
84
+ ElasticsearchClient client = new ElasticsearchClient (transport );
85
+
86
+ assertTrue (client .count ().count () >= 0 );
87
+ }
88
+
79
89
@ Test
80
90
public void testIndexCreation () throws Exception {
81
91
RestClient restClient = RestClient .builder (new HttpHost ("localhost" , container .getMappedPort (9200 ))).build ();
@@ -87,13 +97,13 @@ public void testIndexCreation() throws Exception {
87
97
assertTrue (client .ping ().value ());
88
98
89
99
// Create an index...
90
- final CreateResponse createResponse = client .indices ().create (b -> b .index ("my-index" ));
100
+ final CreateIndexResponse createResponse = client .indices ().create (b -> b .index ("my-index" ));
91
101
assertTrue (createResponse .acknowledged ());
92
102
assertTrue (createResponse .shardsAcknowledged ());
93
103
94
104
// Find info about it, using the async client
95
- CompletableFuture <GetResponse > futureResponse = asyncClient .indices ().get (b -> b .index ("my-index" ));
96
- GetResponse response = futureResponse .get (10 , TimeUnit .SECONDS );
105
+ CompletableFuture <GetIndexResponse > futureResponse = asyncClient .indices ().get (b -> b .index ("my-index" ));
106
+ GetIndexResponse response = futureResponse .get (10 , TimeUnit .SECONDS );
97
107
98
108
Map <String , IndexState > indices = response .result ();
99
109
@@ -113,7 +123,7 @@ public void testDataIngestion() throws Exception {
113
123
String index = "ingest-test" ;
114
124
115
125
// Create an index
116
- CreateResponse createIndexResponse = client .indices ().create (b -> b
126
+ CreateIndexResponse createIndexResponse = client .indices ().create (b -> b
117
127
.index (index )
118
128
);
119
129
0 commit comments