79
79
import org .opensearch .index .mapper .NumberFieldMapper ;
80
80
import org .opensearch .index .mapper .ObjectMapper ;
81
81
import org .opensearch .index .mapper .SourceFieldMapper ;
82
- import org .opensearch .index .recovery .RemoteStoreRestoreService ;
83
82
import org .opensearch .index .shard .IndexShard ;
84
83
import org .opensearch .search .DocValueFormat ;
85
84
import org .opensearch .search .SearchContextSourcePrinter ;
@@ -382,6 +381,13 @@ private HitContext prepareNonNestedHitContext(
382
381
}
383
382
} catch (Exception e ) {
384
383
logger .error ("Error while building source from doc values" , e );
384
+ logger .info ("Original Source : \n " );
385
+ try {
386
+ Map <String , Object > originalSource = XContentHelper .convertToMap (fieldsVisitor .source (), false ).v2 ();
387
+ originalSource .forEach ((k , v ) -> logger .info ("{ " + k + " : " + v .toString () + " }" ));
388
+ } catch (Exception ex ) {
389
+ logger .error ("Error while logging original source values" , ex );
390
+ }
385
391
}
386
392
//}
387
393
return hitContext ;
@@ -465,7 +471,12 @@ private static Map<String, Object> buildUsingDocValues(int docId, LeafReader rea
465
471
int size = doubleValues .docValueCount ();
466
472
double [] vals = new double [size ];
467
473
for (int i = 0 ; i < size ; i ++) {
468
- vals [i ] = doubleValues .nextValue ();
474
+ try {
475
+ vals [i ] = doubleValues .nextValue ();
476
+ } catch (Exception e ) {
477
+ logger .info ("Exception while reading value from SNDV\n Doc Id : " + docId + ", DocValueCountSize : " + size + ", i : " + i );
478
+ throw e ;
479
+ }
469
480
}
470
481
if (size > 1 ) {
471
482
docValues .put (fieldName , vals );
@@ -481,7 +492,12 @@ private static Map<String, Object> buildUsingDocValues(int docId, LeafReader rea
481
492
int size = sndv .docValueCount ();
482
493
long [] vals = new long [size ];
483
494
for (int i = 0 ; i < size ; i ++) {
484
- vals [i ] = sndv .nextValue ();
495
+ try {
496
+ vals [i ] = sndv .nextValue ();
497
+ } catch (Exception e ) {
498
+ logger .info ("Exception while reading value from SNDV\n Doc Id : " + docId + ", DocValueCountSize : " + size + ", i : " + i );
499
+ throw e ;
500
+ }
485
501
}
486
502
if (size > 1 ) {
487
503
docValues .put (fieldName , vals );
@@ -496,7 +512,12 @@ private static Map<String, Object> buildUsingDocValues(int docId, LeafReader rea
496
512
int size = sndv .docValueCount ();
497
513
String [] vals = new String [size ];
498
514
for (int i = 0 ; i < size ; i ++) {
499
- vals [i ] = dateFormatter .formatMillis (sndv .nextValue ());
515
+ try {
516
+ vals [i ] = dateFormatter .formatMillis (sndv .nextValue ());
517
+ } catch (Exception e ) {
518
+ logger .info ("Exception while reading value from SNDV\n Doc Id : " + docId + ", DocValueCountSize : " + size + ", i : " + i );
519
+ throw e ;
520
+ }
500
521
}
501
522
if (size > 1 ) {
502
523
docValues .put (fieldName , vals );
0 commit comments