File tree Expand file tree Collapse file tree 2 files changed +19
-13
lines changed
Nest.Tests.Integration/Search/Scroll Expand file tree Collapse file tree 2 files changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -22,14 +22,15 @@ public void SearchTypeScan()
2222 Assert . True ( scanResults . IsValid ) ;
2323 Assert . False ( scanResults . Documents . Any ( ) ) ;
2424 Assert . IsNotNullOrEmpty ( scanResults . ScrollId ) ;
25+
2526 var scrolls = 1 ;
26- var results = this . _client . Scroll ( "4s" , scanResults . ScrollId ) ;
27+ var results = this . _client . Scroll < ElasticSearchProject > ( "4s" , scanResults . ScrollId ) ;
2728 while ( results . Documents . Any ( ) )
2829 {
2930 Assert . True ( results . IsValid ) ;
3031 Assert . True ( results . Documents . Any ( ) ) ;
3132 Assert . IsNotNullOrEmpty ( results . ScrollId ) ;
32- results = this . _client . Scroll ( "4s" , results . ScrollId ) ;
33+ results = this . _client . Scroll < ElasticSearchProject > ( "4s" , results . ScrollId ) ;
3334 scrolls ++ ;
3435 }
3536 Assert . AreEqual ( 5 , scrolls ) ;
Original file line number Diff line number Diff line change @@ -11,17 +11,22 @@ public partial class ElasticClient
1111 /// </summary>
1212 public IQueryResponse < dynamic > Scroll ( string scrollTime , string scrollId )
1313 {
14- scrollId . ThrowIfNullOrEmpty ( "scrollId" ) ;
15- scrollTime . ThrowIfNullOrEmpty ( "scrollTime" ) ;
16-
17- scrollId = Uri . EscapeDataString ( scrollId ) ;
18- scrollTime = Uri . EscapeDataString ( scrollTime ) ;
19-
20- var path = "_search/scroll?scroll={0}&scroll_id={1}" . F ( scrollTime , scrollId ) ;
21-
22- ConnectionStatus status = this . Connection . GetSync ( path ) ;
23- var r = this . ToParsedResponse < QueryResponse < dynamic > > ( status ) ;
24- return r ;
14+ return Scroll < dynamic > ( scrollTime , scrollId ) ;
15+ }
16+
17+ public IQueryResponse < T > Scroll < T > ( string scrollTime , string scrollId ) where T : class
18+ {
19+ scrollId . ThrowIfNullOrEmpty ( "scrollId" ) ;
20+ scrollTime . ThrowIfNullOrEmpty ( "scrollTime" ) ;
21+
22+ scrollId = Uri . EscapeDataString ( scrollId ) ;
23+ scrollTime = Uri . EscapeDataString ( scrollTime ) ;
24+
25+ var path = "_search/scroll?scroll={0}&scroll_id={1}" . F ( scrollTime , scrollId ) ;
26+
27+ ConnectionStatus status = this . Connection . GetSync ( path ) ;
28+ var r = this . ToParsedResponse < QueryResponse < T > > ( status ) ;
29+ return r ;
2530 }
2631 }
2732}
You can’t perform that action at this time.
0 commit comments