@@ -166,6 +166,7 @@ public void setupSuiteScopeCluster() throws Exception {
166
166
.field (SORT_FIELD , i + 1 )
167
167
.field ("text" , "some text to entertain" )
168
168
.field ("field1" , 5 )
169
+ .field ("field2" , 2.71 )
169
170
.endObject ()));
170
171
}
171
172
@@ -315,7 +316,7 @@ public void testBasics() throws Exception {
315
316
assertThat ((Long ) hits .getAt (1 ).getSortValues ()[0 ], equalTo (higestSortValue - 1 ));
316
317
assertThat ((Long ) hits .getAt (2 ).getSortValues ()[0 ], equalTo (higestSortValue - 2 ));
317
318
318
- assertThat (hits .getAt (0 ).getSourceAsMap ().size (), equalTo (4 ));
319
+ assertThat (hits .getAt (0 ).getSourceAsMap ().size (), equalTo (5 ));
319
320
}
320
321
}
321
322
@@ -402,7 +403,7 @@ public void testBreadthFirstWithScoreNeeded() throws Exception {
402
403
assertThat (hits .getTotalHits ().value , equalTo (10L ));
403
404
assertThat (hits .getHits ().length , equalTo (3 ));
404
405
405
- assertThat (hits .getAt (0 ).getSourceAsMap ().size (), equalTo (4 ));
406
+ assertThat (hits .getAt (0 ).getSourceAsMap ().size (), equalTo (5 ));
406
407
}
407
408
}
408
409
@@ -433,7 +434,7 @@ public void testBreadthFirstWithAggOrderAndScoreNeeded() throws Exception {
433
434
assertThat (hits .getTotalHits ().value , equalTo (10L ));
434
435
assertThat (hits .getHits ().length , equalTo (3 ));
435
436
436
- assertThat (hits .getAt (0 ).getSourceAsMap ().size (), equalTo (4 ));
437
+ assertThat (hits .getAt (0 ).getSourceAsMap ().size (), equalTo (5 ));
437
438
id --;
438
439
}
439
440
}
@@ -597,6 +598,7 @@ public void testFetchFeatures() {
597
598
.explain (true )
598
599
.storedField ("text" )
599
600
.docValueField ("field1" )
601
+ .fetchField ("field2" )
600
602
.scriptField ("script" ,
601
603
new Script (ScriptType .INLINE , MockScriptEngine .NAME , "5" , Collections .emptyMap ()))
602
604
.fetchSource ("text" , null )
@@ -639,13 +641,16 @@ public void testFetchFeatures() {
639
641
640
642
assertThat (hit .getMatchedQueries ()[0 ], equalTo ("test" ));
641
643
642
- DocumentField field = hit .field ("field1" );
643
- assertThat (field .getValue ().toString (), equalTo ("5" ));
644
+ DocumentField field1 = hit .field ("field1" );
645
+ assertThat (field1 .getValue (), equalTo (5L ));
646
+
647
+ DocumentField field2 = hit .field ("field2" );
648
+ assertThat (field2 .getValue (), equalTo (2.71f ));
644
649
645
650
assertThat (hit .getSourceAsMap ().get ("text" ).toString (), equalTo ("some text to entertain" ));
646
651
647
- field = hit .field ("script" );
648
- assertThat (field .getValue ().toString (), equalTo ("5" ));
652
+ field2 = hit .field ("script" );
653
+ assertThat (field2 .getValue ().toString (), equalTo ("5" ));
649
654
650
655
assertThat (hit .getSourceAsMap ().size (), equalTo (1 ));
651
656
assertThat (hit .getSourceAsMap ().get ("text" ).toString (), equalTo ("some text to entertain" ));
0 commit comments