0

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.

1 Answer 1

1

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);
Sign up to request clarification or add additional context in comments.

2 Comments

What is the difference between high level and low level client?
Take a look at the documentation on the clients which covers the differences: elastic.co/guide/en/elasticsearch/client/net-api/current/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.