1313import org .apache .http .entity .ContentType ;
1414import org .elasticsearch .action .bulk .IncrementalBulkService ;
1515import org .elasticsearch .client .Request ;
16- import org .elasticsearch .client .RequestOptions ;
1716import org .elasticsearch .client .Response ;
1817import org .elasticsearch .client .ResponseException ;
1918import org .elasticsearch .common .settings .Settings ;
3433@ ESIntegTestCase .ClusterScope (scope = ESIntegTestCase .Scope .SUITE , supportsDedicatedMasters = false , numDataNodes = 2 , numClientNodes = 0 )
3534public class BulkRestMarkerSuffixIT extends HttpSmokeTestCase {
3635
37- private final RequestOptions options = RequestOptions .DEFAULT .toBuilder ().addHeader ("X-Bulk-Format" , "marker-suffix" ).build ();
38-
3936 @ Override
4037 protected Settings nodeSettings (int nodeOrdinal , Settings otherSettings ) {
4138 return Settings .builder ()
@@ -56,9 +53,6 @@ public void testBulkUriMatchingDoesNotMatchBulkCapabilitiesApi() throws IOExcept
5653
5754 public void testBulkMissingBody () throws IOException {
5855 Request request = new Request (randomBoolean () ? "POST" : "PUT" , "/_bulk" );
59- if (randomBoolean ()) {
60- request .setOptions (options );
61- }
6256 request .setJsonEntity ("" );
6357 ResponseException responseException = expectThrows (ResponseException .class , () -> getRestClient ().performRequest (request ));
6458 assertEquals (400 , responseException .getResponse ().getStatusLine ().getStatusCode ());
@@ -67,9 +61,6 @@ public void testBulkMissingBody() throws IOException {
6761
6862 public void testBulkInvalidIndexNameString () throws IOException {
6963 Request request = new Request ("POST" , "/_bulk" );
70- if (randomBoolean ()) {
71- request .setOptions (options );
72- }
7364
7465 byte [] bytes1 = "{\" create\" :{\" _index\" :\" " .getBytes (StandardCharsets .UTF_8 );
7566 byte [] bytes2 = new byte [] { (byte ) 0xfe , (byte ) 0xfe , (byte ) 0xff , (byte ) 0xff };
@@ -89,9 +80,7 @@ public void testBulkInvalidIndexNameString() throws IOException {
8980
9081 public void testBulkRequestBodyImproperlyTerminated () throws IOException {
9182 Request request = new Request (randomBoolean () ? "POST" : "PUT" , "/_bulk" );
92- if (randomBoolean ()) {
93- request .setOptions (options );
94- }
83+
9584 // missing final line of the bulk body. cannot process
9685 request .setJsonEntity (
9786 "{\" index\" :{\" _index\" :\" index_name\" ,\" _id\" :\" 1\" }}\n "
@@ -119,9 +108,6 @@ public void testBulkRequest() throws IOException {
119108 assertThat (indexCreatedResponse .getStatusLine ().getStatusCode (), equalTo (OK .getStatus ()));
120109
121110 Request firstBulkRequest = new Request ("POST" , "/index_name/_bulk" );
122- if (randomBoolean ()) {
123- firstBulkRequest .setOptions (options );
124- }
125111 String bulkBody = "{\" index\" :{\" _index\" :\" index_name\" ,\" _id\" :\" 1\" }}\n "
126112 + "{\" field\" :1}\n "
127113 + "{\" index\" :{\" _index\" :\" index_name\" ,\" _id\" :\" 2\" }}\n "
@@ -152,9 +138,6 @@ public void testBulkWithIncrementalDisabled() throws IOException {
152138 assertThat (indexCreatedResponse .getStatusLine ().getStatusCode (), equalTo (OK .getStatus ()));
153139
154140 Request firstBulkRequest = new Request ("POST" , "/index_name/_bulk" );
155- if (randomBoolean ()) {
156- firstBulkRequest .setOptions (options );
157- }
158141
159142 String bulkBody = "{\" index\" :{\" _index\" :\" index_name\" ,\" _id\" :\" 1\" }}\n "
160143 + "{\" field\" :1}\n "
@@ -195,9 +178,6 @@ public void testMalformedActionLineBulk() throws IOException {
195178 assertThat (indexCreatedResponse .getStatusLine ().getStatusCode (), equalTo (OK .getStatus ()));
196179
197180 Request bulkRequest = new Request ("POST" , "/index_name/_bulk" );
198- if (randomBoolean ()) {
199- bulkRequest .setOptions (options );
200- }
201181
202182 final StringBuilder bulk = new StringBuilder ();
203183 bulk .append ("{\" index\" :{\" _index\" :\" index_name\" }}\n " );
@@ -213,9 +193,7 @@ public void testMalformedActionLineBulk() throws IOException {
213193 @ SuppressWarnings ("unchecked" )
214194 private void sendLargeBulk () throws IOException {
215195 Request bulkRequest = new Request ("POST" , "/index_name/_bulk" );
216- if (randomBoolean ()) {
217- bulkRequest .setOptions (options );
218- }
196+
219197 final StringBuilder bulk = new StringBuilder ();
220198 bulk .append ("{\" delete\" :{\" _index\" :\" index_name\" ,\" _id\" :\" 1\" }}\n " );
221199 int updates = 0 ;
0 commit comments