@@ -107,7 +107,6 @@ static MediaType detectMediaType(byte[] document) {
107107 * @param defaultFetchSourceContext
108108 * @param defaultPipeline
109109 * @param defaultRequireAlias
110- * @param allowExplicitIndex whether explicit index specification is allowed (security setting)
111110 * @return
112111 */
113112 public static DocWriteRequest <?>[] getDocWriteRequests (
@@ -116,8 +115,7 @@ public static DocWriteRequest<?>[] getDocWriteRequests(
116115 String defaultRouting ,
117116 FetchSourceContext defaultFetchSourceContext ,
118117 String defaultPipeline ,
119- Boolean defaultRequireAlias ,
120- boolean allowExplicitIndex
118+ Boolean defaultRequireAlias
121119 ) {
122120 List <BulkRequestBody > bulkRequestBodyList = request .getBulkRequestBodyList ();
123121 DocWriteRequest <?>[] docWriteRequests = new DocWriteRequest <?>[bulkRequestBodyList .size ()];
@@ -155,9 +153,7 @@ public static DocWriteRequest<?>[] getDocWriteRequests(
155153 pipeline ,
156154 ifSeqNo ,
157155 ifPrimaryTerm ,
158- requireAlias ,
159- defaultIndex ,
160- allowExplicitIndex
156+ requireAlias
161157 );
162158 break ;
163159 case INDEX :
@@ -173,13 +169,11 @@ public static DocWriteRequest<?>[] getDocWriteRequests(
173169 pipeline ,
174170 ifSeqNo ,
175171 ifPrimaryTerm ,
176- requireAlias ,
177- defaultIndex ,
178- allowExplicitIndex
172+ requireAlias
179173 );
180174 break ;
181175 case UPDATE :
182- // Extract the doc field from UpdateAction (matches REST API structure)
176+ // Extract the doc field from UpdateAction
183177 // Use ByteString directly to avoid unnecessary byte array allocation
184178 ByteString updateDocBytes = ByteString .EMPTY ;
185179 if (bulkRequestBodyEntry .hasUpdateAction () && bulkRequestBodyEntry .getUpdateAction ().hasDoc ()) {
@@ -201,9 +195,7 @@ public static DocWriteRequest<?>[] getDocWriteRequests(
201195 pipeline ,
202196 ifSeqNo ,
203197 ifPrimaryTerm ,
204- requireAlias ,
205- defaultIndex ,
206- allowExplicitIndex
198+ requireAlias
207199 );
208200 break ;
209201 case DELETE :
@@ -215,9 +207,7 @@ public static DocWriteRequest<?>[] getDocWriteRequests(
215207 version ,
216208 versionType ,
217209 ifSeqNo ,
218- ifPrimaryTerm ,
219- defaultIndex ,
220- allowExplicitIndex
210+ ifPrimaryTerm
221211 );
222212 break ;
223213 case OPERATIONCONTAINER_NOT_SET :
@@ -246,8 +236,6 @@ public static DocWriteRequest<?>[] getDocWriteRequests(
246236 * @param ifSeqNo The default sequence number for optimistic concurrency control
247237 * @param ifPrimaryTerm The default primary term for optimistic concurrency control
248238 * @param requireAlias Whether the index must be an alias
249- * @param defaultIndex The default index from the request URL (for security check)
250- * @param allowExplicitIndex Whether explicit index specification is allowed
251239 * @return The constructed IndexRequest
252240 */
253241 public static IndexRequest buildCreateRequest (
@@ -261,15 +249,9 @@ public static IndexRequest buildCreateRequest(
261249 String pipeline ,
262250 long ifSeqNo ,
263251 long ifPrimaryTerm ,
264- boolean requireAlias ,
265- String defaultIndex ,
266- boolean allowExplicitIndex
252+ boolean requireAlias
267253 ) {
268- // Check explicit index (matches REST BulkRequestParser line 218-221)
269254 if (createOperation .hasXIndex ()) {
270- if (!allowExplicitIndex && defaultIndex != null ) {
271- throw new IllegalArgumentException ("explicit index in bulk is not allowed" );
272- }
273255 index = createOperation .getXIndex ();
274256 }
275257
@@ -307,8 +289,6 @@ public static IndexRequest buildCreateRequest(
307289 * @param ifSeqNo The default sequence number for optimistic concurrency control
308290 * @param ifPrimaryTerm The default primary term for optimistic concurrency control
309291 * @param requireAlias Whether the index must be an alias
310- * @param defaultIndex The default index from the request URL (for security check)
311- * @param allowExplicitIndex Whether explicit index specification is allowed
312292 * @return The constructed IndexRequest
313293 */
314294 public static IndexRequest buildIndexRequest (
@@ -323,17 +303,11 @@ public static IndexRequest buildIndexRequest(
323303 String pipeline ,
324304 long ifSeqNo ,
325305 long ifPrimaryTerm ,
326- boolean requireAlias ,
327- String defaultIndex ,
328- boolean allowExplicitIndex
306+ boolean requireAlias
329307 ) {
330308 opType = indexOperation .hasOpType () ? indexOperation .getOpType () : opType ;
331309
332- // Check explicit index (matches REST BulkRequestParser line 218-221)
333310 if (indexOperation .hasXIndex ()) {
334- if (!allowExplicitIndex && defaultIndex != null ) {
335- throw new IllegalArgumentException ("explicit index in bulk is not allowed" );
336- }
337311 index = indexOperation .getXIndex ();
338312 }
339313
@@ -390,8 +364,6 @@ public static IndexRequest buildIndexRequest(
390364 * @param ifSeqNo The default sequence number for optimistic concurrency control
391365 * @param ifPrimaryTerm The default primary term for optimistic concurrency control
392366 * @param requireAlias Whether the index must be an alias
393- * @param defaultIndex The default index from the request URL (for security check)
394- * @param allowExplicitIndex Whether explicit index specification is allowed
395367 * @return The constructed UpdateRequest
396368 */
397369 public static UpdateRequest buildUpdateRequest (
@@ -406,15 +378,9 @@ public static UpdateRequest buildUpdateRequest(
406378 String pipeline ,
407379 long ifSeqNo ,
408380 long ifPrimaryTerm ,
409- boolean requireAlias ,
410- String defaultIndex ,
411- boolean allowExplicitIndex
381+ boolean requireAlias
412382 ) {
413- // Check explicit index (matches REST BulkRequestParser line 218-221)
414383 if (updateOperation .hasXIndex ()) {
415- if (!allowExplicitIndex && defaultIndex != null ) {
416- throw new IllegalArgumentException ("explicit index in bulk is not allowed" );
417- }
418384 index = updateOperation .getXIndex ();
419385 }
420386
@@ -550,8 +516,6 @@ static UpdateRequest fromProto(
550516 * @param versionType The default version type
551517 * @param ifSeqNo The default sequence number for optimistic concurrency control
552518 * @param ifPrimaryTerm The default primary term for optimistic concurrency control
553- * @param defaultIndex The default index from the request URL (for security check)
554- * @param allowExplicitIndex Whether explicit index specification is allowed
555519 * @return The constructed DeleteRequest
556520 */
557521 public static DeleteRequest buildDeleteRequest (
@@ -562,15 +526,9 @@ public static DeleteRequest buildDeleteRequest(
562526 long version ,
563527 VersionType versionType ,
564528 long ifSeqNo ,
565- long ifPrimaryTerm ,
566- String defaultIndex ,
567- boolean allowExplicitIndex
529+ long ifPrimaryTerm
568530 ) {
569- // Check explicit index (matches REST BulkRequestParser line 218-221)
570531 if (deleteOperation .hasXIndex ()) {
571- if (!allowExplicitIndex && defaultIndex != null ) {
572- throw new IllegalArgumentException ("explicit index in bulk is not allowed" );
573- }
574532 index = deleteOperation .getXIndex ();
575533 }
576534
0 commit comments