public void Can_insert_data() { using (var elasticsearch = new Elasticsearch()) { ////Arrange var client = new ElasticClient(new ConnectionSettings(elasticsearch.Url)); ////Act client.Index(new { id = "tester"}, i => i.Index("test-index")); ////Assert var result = client.Get<dynamic>("tester", "test-index"); Assert.That(result, Is.Not.Null); } }
public static OsobaES Get(string idOsoby) { try { var response = _esClient.Get <OsobaES>(idOsoby); return(response.IsValid ? response.Source : null); } catch (Exception) { throw; } }
public Dotace Get(string idDotace) { try { // použít get místo search. // var searchResponse = _esClient.Search<Dotace>(s => s.From(0).Size(1).Query(q => q.Term(t => t.Field(p => p.IdObdobi).Value(idRozhodnuti)))); var response = _esClient.Get <Dotace>(idDotace); return(response.IsValid ? response.Source : null); } catch (Exception) { throw; } }