I have code performing scrolling query that works fine under .Net Framework 7.4.2 but when rebuild under .Net Core and executed in that environment raise an Elastic exception as shown below.
Is there any difference between using ScrollAll under .Net Framework and .Net core ?
I use NEST 7.2.1, .Net standard library 2.0.3
-- Exception --
Elasticsearch.Net.ElasticsearchClientException
HResult=0x80131500
Message=scrolling search on /coint%2A/_search?typed_keys=true&scroll=5m with slice 0 was not valid on scroll iteration 0
Source=Nest
StackTrace:
at Nest.BlockingSubscribeExtensions.WaitOnObservable[TObservable,TObserve,TObserver](TObservable observable, TimeSpan maximumRunTime, Func3 factory) at Nest.BlockingSubscribeExtensions.Wait[T](IObservable
1 observable, TimeSpan maximumRunTime, Action`1 onNext)
at Slb.Prism.DevTool.Library.RollupFlowCalls.Search.getList(ElasticClient esClient, String index, ILogger log) in D:<blabla>\DevTool.Service.ControlFlow\RollupFlowCalls\Search.cs:line 53
at ConsoleTestCore.Program.Main(String args) in D:<blabla>\ControlFlow\ConsoleTestCore\Program.cs:line 15
--- Code ---
public static List<Record> getList(ElasticClient esClient, string index, ILogger log)
{
if (log != null) log.LogInformation($"Entersearch");
var seenDocuments = 0;
var doccuments = new ConcurrentBag<IReadOnlyCollection<Source>>();
DateTime gteTime = DateTime.Now.AddMinutes(-10);
DateTime ltTime = DateTime.Now;
List<Record> indexedList = new List<Record>();
int para = 6;
if (log != null) log.LogInformation($"Start search");
esClient.ScrollAll<Source>("5m", para, s => s
.MaxDegreeOfParallelism(para / 2)
.Search(w => w
.Index(index)
.Source(true)
.From(0)
.Size(500)
.Query(q => q
.Bool(b => b
.Filter(bf => bf
.DateRange(dr => dr
.Field(f => f.timestamp)
.GreaterThanOrEquals(gteTime)
.LessThan(ltTime)))
.Must(mu => mu
.Match(ma => ma
.Field(fi => fi.level)
.Query("Stack")))))))
.Wait(TimeSpan.FromMinutes(5), r =>
{
if (log != null) log.LogInformation($"In wait");
doccuments.Add(r.SearchResponse.Documents);
Interlocked.Add(ref seenDocuments, r.SearchResponse.Hits.Count);
});
if (log != null) log.LogInformation($"Out wait");