Reputation: 431
I wanted to loop and scroll thru the data using the scrollid then I've upgraded to NEST 5.5 and trying to remediate this block of code:
scrollGetSearch = client.Raw.ScrollGet(scrollId, x => x
.AddQueryString("scroll", "1m")
.AddQueryString("size", "1000"));
Tried using using .Scroll
but can't find the correct arguments for the scroll method:
scrollGetSearch = client.Scroll("1m",scrollId)
Getting the Error
The type arguments for method 'Nest.ElasticClient.Scroll(Nest.Time, string, System.Func,Nest.IScrollRequest>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
Upvotes: 0
Views: 490
Reputation: 125488
Your first request uses the low level client, Elasticsearch.Net, whilst the second request uses the high level client.
To perform the same low level request in NEST 5.x would be
ElasticsearchResponse<T> lowLevelScrollResponse = client.LowLevel.ScrollGet<T>(x => x
.AddQueryString("scroll_id", scrollId)
.AddQueryString("scroll", "1m"));
The generic parameter T
should be the type that the body of the response should be deserialized into e.g. string
, byte[]
or because you're using the low level client exposed on the high level client, the high level response, SearchResponse<TDocument>
, where TDocument
is the type that each _source
should be deserialized into. There's no need to specify size
on a scroll request as the size is configured on the first scroll call to _search
endpoint.
To perform the same search with the high level client
ISearchResponse<T> scrollResponse = client.Scroll<T>("1m", scrollId);
Upvotes: 1