@@ -80,6 +80,7 @@ public class ElasticsearchBackendClient extends AbstractBackendListenerClient {
8080 private Set <String > fields ;
8181 private int buildNumber ;
8282 private int bulkSize ;
83+ private int esVersion ;
8384 private long timeoutMs ;
8485
8586 public ElasticsearchBackendClient () {
@@ -136,6 +137,7 @@ public void onFailure(Node node) {
136137 context .getParameter (ES_AUTH_USER ), context .getParameter (ES_AUTH_PWD ),
137138 context .getParameter (ES_AWS_ENDPOINT ));
138139 this .sender .createIndex ();
140+ this .esVersion = int sender .getElasticSearchVersion ();
139141
140142 checkTestMode (context .getParameter (ES_TEST_MODE ));
141143 super .setupTest (context );
@@ -202,7 +204,7 @@ public void handleSampleResults(List<SampleResult> results, BackendListenerConte
202204
203205 if (this .sender .getListSize () >= this .bulkSize ) {
204206 try {
205- this .sender .sendRequest ();
207+ this .sender .sendRequest (this . esVersion );
206208 } catch (Exception e ) {
207209 logger .error ("Error occured while sending bulk request." , e );
208210 } finally {
@@ -214,7 +216,7 @@ public void handleSampleResults(List<SampleResult> results, BackendListenerConte
214216 @ Override
215217 public void teardownTest (BackendListenerContext context ) throws Exception {
216218 if (this .sender .getListSize () > 0 ) {
217- this .sender .sendRequest ();
219+ this .sender .sendRequest (this . esVersion );
218220 }
219221 this .sender .closeConnection ();
220222 super .teardownTest (context );
0 commit comments