コード例 #1
0
        public BulkElasticSuggestiveIndex Post(BulkElasticSuggestiveIndex t)
        {
            const int batchCount     = 2000;
            var       timerStopwatch = new Stopwatch();

            timerStopwatch.Start();
            var i = 0;

            Console.WriteLine(@"Elastic suggestive indexing started - ");

            CreateMapping();

            foreach (var elasticTitle in t.ElasticSuggestive.Batch(batchCount))
            {
                i++;
                timerStopwatch.Restart();
                Console.WriteLine(Environment.NewLine);
                Console.WriteLine(@"indexed records - " + i * batchCount);
                ElasticSearch.BulkIndex(elasticTitle.ToList());
                Console.WriteLine(@"iteration {0} took - {1} ms", i, timerStopwatch.ElapsedMilliseconds);
            }
            Console.WriteLine(@"Elastic suggestive indexing finished at - " + timerStopwatch.ElapsedMilliseconds);
            timerStopwatch.Stop();
            return(t);
        }
コード例 #2
0
 public BulkElasticMagazineIndex Post(BulkElasticMagazineIndex t)
 {
     ConsoleProcess.Start(t.GetType());
     CreateMapping();
     foreach (var elasticMagazine in t.ElasticMagazine.Batch(5000))
     {
         ConsoleProcess.Increment();
         ElasticSearch.BulkIndex(elasticMagazine.ToList());
     }
     return(t);
 }
コード例 #3
0
 public BulkElasticOrderHistory Post(BulkElasticOrderHistory t)
 {
     ConsoleProcess.Start(t.GetType());
     CreateMapping();
     foreach (var elasticTitle in t.OrderHistories.Batch(5000))
     {
         ConsoleProcess.Increment();
         ElasticSearch.BulkIndex(elasticTitle.ToList());
     }
     return(t);
 }
コード例 #4
0
        public BulkElasticGroupedTitleIndex Post(BulkElasticGroupedTitleIndex t)
        {
            const int batchCount = 500;

            ConsoleProcess.Start(t.GetType());
            CreateMapping();
            var i = 0;

            foreach (var elasticTitle in t.ElasticGroupedTitles.Batch(batchCount))
            {
                i++;
                ConsoleProcess.Restart();
                ElasticSearch.BulkIndex(elasticTitle.ToList());
                Console.WriteLine(Environment.NewLine);
                Console.WriteLine(@"iteration for {0} took - {1} ms", i * batchCount, ConsoleProcess.ElapsedMilliseconds());
            }
            ConsoleProcess.End(t.GetType());
            return(t);
        }