예제 #1
0
        //String defaultIndex;
        public LLDatabase(string address, string index)
        {
            logger.debug("Creating client! Settings -> address: " + address + " index: " + index);
            var settings = new ConnectionConfiguration(new Uri("http://" + address))
                           .DisableDirectStreaming()
                           .ThrowExceptions()
                           .OnRequestCompleted(request =>
            {
                var builder = new StringBuilder();
                builder.AppendFormat("URL: {0}", request.Uri.ToString());
                if (request.RequestBodyInBytes != null)
                {
                    builder.AppendFormat("\r\nRequest:\r\n\t{0}", Encoding.UTF8.GetString(request.RequestBodyInBytes).Replace("\n", "\n\t"));
                }
                if (request.ResponseBodyInBytes != null)
                {
                    builder.AppendFormat("\r\nResponse:\r\n\t{0}", Encoding.UTF8.GetString(request.ResponseBodyInBytes).Replace("\n", "\n\t"));
                }
                Console.WriteLine(builder.ToString());
            });

            try {
                client = new ElasticLowLevelClient(settings);
                client.Ping <StringResponse>();
                valid = true;
                logger.debug("Creating client SUCCESS!");
            }
            catch (Exception e)
            {
                logger.error("Exception while trying to create a client! -> " + e.Message);
                valid = false;
            }
        }
예제 #2
0
 public void Ping_should_work()
 {
     var httpConnection = new AwsHttpConnection(TestConfig.AwsSettings);
     var pool = new SingleNodeConnectionPool(new Uri(TestConfig.Endpoint));
     var config = new ConnectionConfiguration(pool, httpConnection);
     var client = new ElasticLowLevelClient(config);
     var response = client.Ping<object>();
     Assert.AreEqual(200, response.HttpStatusCode.GetValueOrDefault(-1));
 }
예제 #3
0
        public void Ping_should_work()
        {
            var httpConnection = new AwsHttpConnection(Region, Credentials);
            var pool           = new SingleNodeConnectionPool(new Uri(TestConfig.Endpoint));
            var config         = new ConnectionConfiguration(pool, httpConnection);
            var client         = new ElasticLowLevelClient(config);
            var response       = client.Ping <object>();

            Assert.AreEqual(200, response.HttpStatusCode.GetValueOrDefault(-1));
        }