Ejemplo n.º 1
0
        /// <summary>
        /// Split the list into sub-lists of batch size, and insert
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="items"></param>
        /// <param name="batchSize"></param>
        /// <param name="index"></param>
        private void InsertInYearBatches <T>(List <T> items, string index) where T : Reading
        {
            var now = DateTime.UtcNow;

            foreach (var x in items)
            {
                x.ingestionTimeStamp = now;
            }

            Utils.Log($"Bulk inserting {items.Count()} for {index}...");
            EsClient.BulkInsert(index, items);
        }