Problems with Scroll and Slice

Hello Com,
i have a problem with my Code. When i want to Scroll and Slice about 100.000 data, i get the following Error:

# Request:
{"scroll":"2m","scroll_id":"FGluY2x1ZGVfY29udGV4dF91dWlkDnF1ZXJ5VGhlbkZldGNoAhZvNUctQkZ5TVRUS0NNaEFtNGY4QWFBAAAAAAAKZuIWd3BLUERNT2FRSC0xa0Ztd09jVl9jdxZvNUctQkZ5TVRUS0NNaEFtNGY4QWFBAAAAAAAKZuMWd3BLUERNT2FRSC0xa0Ztd09jVl9jdw=="}
# Response:
{"error":{"root_cause":[{"type":"search_context_missing_exception","reason":"No search context found for id [681698]"},{"type":"search_context_missing_exception","reason":"No search context found for id [681699]"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":-1,"index":null,"reason":{"type":"search_context_missing_exception","reason":"No search context found for id [681698]"}},{"shard":-1,"index":null,"reason":{"type":"search_context_missing_exception","reason":"No search context found for id [681699]"}}],"caused_by":{"type":"search_context_missing_exception","reason":"No search context found for id [681699]"}},"status":404}
# Exception:
Elasticsearch.Net.ElasticsearchClientException: scrolling search on /_search/scroll with slice 2 was not valid on scroll iteration 1
int numberOfSlices = 9;
               long totalHits = 0;

               logDuration();

               Log.GetLog()
                   .Verbose($"MaxDegreeOfParallelism: {numberOfSlices}");
               var scrollAllMyOberversable = elasticClient.ScrollAll<IDictionary<string, object>>("2m",
                   numberOfSlices, sc => sc
                       .MaxDegreeOfParallelism(numberOfSlices)
                       .Search(s => s
                           .Query(q => searchRequest.Query)
                           .Size(searchRequest.Size)));
               var waitHandle = new ManualResetEvent(false);
               
               ExceptionDispatchInfo info = null;
               var scrollAllObserv = new ScrollAllObserver<IDictionary<string, object>>(
                   onNext: response =>
                   {
                       result.AddRange(response.SearchResponse.Documents);
                       totalHits += response.SearchResponse.Documents.Count;

                   },

                   onError: e =>
                   {
                       info = ExceptionDispatchInfo.Capture(e);
                       waitHandle.Set();
                   },
                   onCompleted: () =>
                   {
                       waitHandle.Set();
                       logDuration();
                   });
               scrollAllMyOberversable.Subscribe(scrollAllObserv);
               waitHandle.WaitOne();
               info?.Throw();

               logDuration();

               Log.GetLog()
                   .Verbose(
                       $"Result.Search: {durations.Sum(s => s.Value)}ms, {JsonConvert.SerializeObject(durations, Formatting.Indented)}");
               stopWatch.Restart();


Any Idea what i did wrong?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.