@@ -343,11 +343,7 @@ public void testEncodeFieldToMap() throws IOException {
343
343
ParsedDocument parsedDocument = getParsedDocumentWithFieldLimit (b -> b .field ("my_value" , value ));
344
344
IgnoredSourceFieldMapper .MappedNameValue mappedNameValue ;
345
345
var bytes = parsedDocument .rootDoc ().getField (IgnoredSourceFieldMapper .NAME ).binaryValue ();
346
- if (IgnoredSourceFieldMapper .COALESCE_IGNORED_SOURCE_ENTRIES .isEnabled ()) {
347
- mappedNameValue = IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .decodeAsMap (bytes ).getFirst ();
348
- } else {
349
- mappedNameValue = IgnoredSourceFieldMapper .LegacyIgnoredSourceEncoding .decodeAsMap (bytes );
350
- }
346
+ mappedNameValue = IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .decodeAsMap (bytes ).getFirst ();
351
347
assertEquals ("my_value" , mappedNameValue .nameValue ().name ());
352
348
assertEquals (value , mappedNameValue .map ().get ("my_value" ));
353
349
}
@@ -360,18 +356,10 @@ public void testEncodeObjectToMapAndDecode() throws IOException {
360
356
);
361
357
var bytes = parsedDocument .rootDoc ().getField (IgnoredSourceFieldMapper .NAME ).binaryValue ();
362
358
IgnoredSourceFieldMapper .MappedNameValue mappedNameValue ;
363
- if (IgnoredSourceFieldMapper .COALESCE_IGNORED_SOURCE_ENTRIES .isEnabled ()) {
364
- mappedNameValue = IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .decodeAsMap (bytes ).getFirst ();
365
- } else {
366
- mappedNameValue = IgnoredSourceFieldMapper .LegacyIgnoredSourceEncoding .decodeAsMap (bytes );
367
- }
359
+ mappedNameValue = IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .decodeAsMap (bytes ).getFirst ();
368
360
assertEquals ("my_object" , mappedNameValue .nameValue ().name ());
369
361
assertEquals (value , ((Map <String , ?>) mappedNameValue .map ().get ("my_object" )).get ("my_value" ));
370
- if (IgnoredSourceFieldMapper .COALESCE_IGNORED_SOURCE_ENTRIES .isEnabled ()) {
371
- assertEquals (bytes , IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .encodeFromMap (List .of (mappedNameValue )));
372
- } else {
373
- assertEquals (bytes , IgnoredSourceFieldMapper .LegacyIgnoredSourceEncoding .encodeFromMap (mappedNameValue ));
374
- }
362
+ assertEquals (bytes , IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .encodeFromMap (List .of (mappedNameValue )));
375
363
}
376
364
377
365
public void testEncodeArrayToMapAndDecode () throws IOException {
@@ -383,18 +371,10 @@ public void testEncodeArrayToMapAndDecode() throws IOException {
383
371
});
384
372
var bytes = parsedDocument .rootDoc ().getField (IgnoredSourceFieldMapper .NAME ).binaryValue ();
385
373
IgnoredSourceFieldMapper .MappedNameValue mappedNameValue ;
386
- if (IgnoredSourceFieldMapper .COALESCE_IGNORED_SOURCE_ENTRIES .isEnabled ()) {
387
- mappedNameValue = IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .decodeAsMap (bytes ).getFirst ();
388
- } else {
389
- mappedNameValue = IgnoredSourceFieldMapper .LegacyIgnoredSourceEncoding .decodeAsMap (bytes );
390
- }
374
+ mappedNameValue = IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .decodeAsMap (bytes ).getFirst ();
391
375
assertEquals ("my_array" , mappedNameValue .nameValue ().name ());
392
376
assertThat ((List <?>) mappedNameValue .map ().get ("my_array" ), Matchers .contains (Map .of ("int_value" , 10 ), Map .of ("int_value" , 20 )));
393
- if (IgnoredSourceFieldMapper .COALESCE_IGNORED_SOURCE_ENTRIES .isEnabled ()) {
394
- assertEquals (bytes , IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .encodeFromMap (List .of (mappedNameValue )));
395
- } else {
396
- assertEquals (bytes , IgnoredSourceFieldMapper .LegacyIgnoredSourceEncoding .encodeFromMap (mappedNameValue ));
397
- }
377
+ assertEquals (bytes , IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .encodeFromMap (List .of (mappedNameValue )));
398
378
}
399
379
400
380
public void testMultipleIgnoredFieldsRootObject () throws IOException {
0 commit comments