public ElasticSearch(Configuration _configuration)
 {
     configuration = _configuration;
     _Index        = Index.Core.GetValueAttribute();
     if (configuration != null)
     {
         if (configuration.ElasticSearchUrl != null)
         {
             ElasticDomain   = configuration.ElasticSearchUrl;
             ElasticLogin    = configuration.ElasticSearchLogin;
             ElasticPassword = configuration.ElasticSearchPassword;
             Node            = new Uri(ElasticDomain);
             Config          = new ConnectionConfiguration(Node);
             Config.DisableDirectStreaming(true);
             Envirment = configuration.ElasticSearchEnvirment;
             Domain    = LocalIPAddress().ToString();
             Check     = bool.Parse(configuration.ElasticSearchCheck);
             if (ElasticLogin != null && ElasticLogin != "" && ElasticPassword != null && ElasticPassword != "")
             {
                 Config.BasicAuthentication(ElasticLogin, ElasticPassword);
             }
             Client = new ElasticLowLevelClient(Config);
         }
     }
 }
        public void Setup()
        {
            var httpConnection = new AwsHttpConnection(Region);
            var pool           = new SingleNodeConnectionPool(new Uri(TestConfig.Endpoint));
            var config         = new ConnectionConfiguration(pool, httpConnection);

            config.DisableDirectStreaming();
            _client    = new ElasticLowLevelClient(config);
            _indexName = $"unittest_{Guid.NewGuid().ToString("n")}";
        }
        public void Ping_should_work()
        {
            var httpConnection = new AwsHttpConnection(Region);
            var pool           = new SingleNodeConnectionPool(new Uri(TestConfig.Endpoint));
            var config         = new ConnectionConfiguration(pool, httpConnection);

            config.DisableDirectStreaming();
            var client   = new ElasticLowLevelClient(config);
            var response = client.Ping <VoidResponse>();

            Assert.AreEqual(200, response.HttpStatusCode.GetValueOrDefault(-1));
        }
Exemple #4
0
 /// <summary>
 /// Enabling configuration settings prior to receive internal API call timings.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="configuration"></param>
 internal static void ApplyConfigurationSettings <T>(ConnectionConfiguration <T> configuration) where T : ConnectionConfiguration <T>
 {
     configuration.DisableDirectStreaming();
 }