Exemple #1
0
        public string QueryElasticById(string id)
        {
            var     response = client.Get <BytesResponse>(indexname, id);
            dynamic obj      = JsonConvert.DeserializeObject(System.Text.Encoding.UTF8.GetString(response.Body));

            return(JsonConvert.SerializeObject(obj._source));
        }
 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));
 }
Exemple #3
0
        public void Asterisk_encoded_url_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.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));
 }
Exemple #5
0
        public void Random_encoded_url_should_work()
        {
            var randomString   = Guid.NewGuid().ToString("N");
            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.Get <Stream>(randomString, string.Join(",", Enumerable.Repeat(randomString, 2)), randomString);

            Assert.AreEqual(404, response.HttpStatusCode.GetValueOrDefault(-1));
        }
Exemple #6
0
        public void SearchById(string id)
        {
            var response = elastic.Get <BytesResponse>(_index, id);
            //byte[] responseBytes = nResponse.Body;

            /*
             * var name = response.Fields.FieldValue<string>(p => p.Name);
             * var id = response.Fields.FieldValue<int>(p => p.Id);
             * var doubleValue = response.Fields.FieldValue<double>(p => p.DoubleValue);
             */
        }
Exemple #7
0
        public void SimplePost_should_work()
        {
            var id       = Guid.NewGuid().ToString("n");
            var response = _client.Create <VoidResponse>(_indexName, "test", id, PostData.Serializable(new { message = "Hello, World!" }));

            Assert.AreEqual(true, response.Success);
            var getResponse = _client.Get <StringResponse>(_indexName, "test", id);

            Assert.AreEqual(true, getResponse.Success);
            StringAssert.Contains("Hello, World!", getResponse.Body);
        }