Encapsulates an IConnection that works with AWS's Elasticsearch service.
Inheritance: HttpConnection
 public void NestPing_should_work()
 {
     var httpConnection = new AwsHttpConnection(TestConfig.AwsSettings);
     var pool = new SingleNodeConnectionPool(new Uri(TestConfig.Endpoint));
     var config = new Nest.ConnectionSettings(pool, httpConnection);
     var client = new Nest.ElasticClient(config);
     var response = client.Ping();
     Assert.AreEqual(true, response.IsValid);
 }
 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));
 }
 public void Asterisk_encoded_url_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.Get<Stream>("index*", "type", "id");
     Assert.AreEqual(404, response.HttpStatusCode.GetValueOrDefault(-1));
 }
 public void Random_encoded_url_should_work()
 {
     var randomString = Guid.NewGuid().ToString("N");
     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.Get<Stream>(randomString, string.Join(",", Enumerable.Repeat(randomString, 2)), randomString);
     Assert.AreEqual(404, response.HttpStatusCode.GetValueOrDefault(-1));
 }
Beispiel #5
-4
        /// <summary>
        /// Connects to server.
        /// </summary>
        protected override void ConnectToServer()
        {
            if ( GetAttributeValue( "NodeUrl" ).IsNotNullOrWhitespace() )
            {
                try {
                    var node = new Uri( GetAttributeValue( "NodeUrl" ) );
                    var region = GetAttributeValue( "Region" );
                    var accessKey = GetAttributeValue( "AccessKey" );
                    var secretKey = GetAttributeValue( "SecretKey" );

                    var httpConnection = new AwsHttpConnection( new AwsSettings
                    {
                        AccessKey = accessKey,
                        SecretKey = secretKey,
                        Region = region,
                    } );

                    var pool = new SingleNodeConnectionPool( node );
                    var config = new ConnectionSettings( pool, httpConnection );
                    _client = new ElasticClient( config );
                }
                catch { }
            }
        }