public static int TransferAsyncAll(int size, Action<object> process) { var scanResults = ConnectionManager.RemoteClient.Search<Object>(s => s .Index(SrcIndexName) .Type(SrcIndexType) .From(0) .Size(size) .MatchAll() .SearchType(SearchType.Scan) .Scroll(ScrollTime) ); if (scanResults == null) return 0; TransferHandler handler = new TransferHandler(TransferCall); AnsycState state = new AnsycState { Handler = handler, Process = process }; if (string.IsNullOrEmpty(scanResults.ScrollId)) return 0; handler.BeginInvoke(scanResults.ScrollId, process, TransferCallback, state); return Convert.ToInt32(scanResults.Total); }
public static int TransferAsync(int size, DateTime from,DateTime to,Action<object> process) { //from = from.AddHours(-8); //to = to.AddHours(-8); var scanResults = ConnectionManager.RemoteClient.Search<Object>(s => s .Index(SrcIndexName) .Type(SrcIndexType) .From(0) .Size(size) .Query(q=>q.Range(r=>r.OnField("TimeStamp").Greater(from).LowerOrEquals(to))) .SearchType(SearchType.Scan) .Scroll(ScrollTime) ); if (scanResults == null) return 0; TransferHandler handler = new TransferHandler(TransferCall); AnsycState state = new AnsycState { Handler = handler, Process = process }; if (string.IsNullOrEmpty(scanResults.ScrollId)) return 0; handler.BeginInvoke(scanResults.ScrollId, process, TransferCallback, state); return Convert.ToInt32(scanResults.Total); }