public void Initialize()
        {
            // Get elasticsearch configuration from external file.
            var config = new ConfigurationBuilder()
                         .AddJsonFile("elasticsearchstoragesettings.json")
                         .Build();

            var elasticsearchStorageOptions = new ElasticsearchStorageOptions
            {
                ElasticsearchEndpoint = new Uri(config["Endpoint"]),
                UserName  = config["UserName"],
                Password  = config["Password"],
                IndexName = config["IndexName"],
                IndexMappingDepthLimit = int.Parse(config["IndexMappingDepthLimit"])
            };

            elasticsearchEndpoint = config["Endpoint"];

            storage = new ElasticsearchStorage(elasticsearchStorageOptions);
        }
        public async Task TestCleanUp()
        {
            if (storage != null)
            {
                // Get elasticsearch configuration from external file.
                var config = new ConfigurationBuilder()
                             .AddJsonFile("elasticsearchstoragesettings.json")
                             .Build();

                var elasticsearchStorageOptions = new ElasticsearchStorageOptions
                {
                    ElasticsearchEndpoint = new Uri(config["Endpoint"]),
                    UserName  = config["UserName"],
                    Password  = config["Password"],
                    IndexName = config["IndexName"],
                    IndexMappingDepthLimit = int.Parse(config["IndexMappingDepthLimit"])
                };
                var connectionPool     = new SingleNodeConnectionPool(elasticsearchStorageOptions.ElasticsearchEndpoint);
                var connectionSettings = new ConnectionSettings(connectionPool, sourceSerializer: JsonNetSerializer.Default);

                if (!string.IsNullOrEmpty(elasticsearchStorageOptions.UserName) && !string.IsNullOrEmpty(elasticsearchStorageOptions.Password))
                {
                    connectionSettings = connectionSettings.BasicAuthentication(elasticsearchStorageOptions.UserName, elasticsearchStorageOptions.Password);
                }

                var client = new ElasticClient(connectionSettings);
                try
                {
                    await client.Indices.DeleteAsync(Indices.Index(config["IndexName"] + "-" + DateTime.Now.ToString("MM-dd-yyyy")));
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("Error cleaning up resources: {0}", ex.ToString());
                }
            }
        }