private ElasticClient GetConnection(DBType dBType, string index, string user, string pwd)
        {
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12;

            var    uris     = dBType.GetUris();
            string certPath = dBType.GetCert();

            if (certPath != null)
            {
                var connectionPool = new SniffingConnectionPool(uris);

                var settings = new ConnectionSettings(connectionPool);
                settings.RequestTimeout(TimeSpan.FromMinutes(10));

                if (certPath != "NOT_NEEDED")
                {
                    X509Certificate cert = new X509Certificate(certPath);
                    settings.ServerCertificateValidationCallback(CertificateValidations.AuthorityIsRoot(cert));
                }
                else
                {
                    ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return(true); });
                }

                if ((uris != null) && uris.Count() == 1)
                {
                    var pool         = new SingleNodeConnectionPool(uris.First());
                    var defaultIndex = index;
                    settings = new ConnectionSettings(pool);
                }

                settings.BasicAuthentication(user, pwd);
                settings.DefaultIndex(index);

                ElasticClient elkClient = new ElasticClient(settings);

                return(elkClient);
            }
            else
            {
                return(null);
            }
        }