Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 2.19 KB

requests.asciidoc

File metadata and controls

50 lines (36 loc) · 2.19 KB

Requests

Combining base URI with the API path results in a URI that respects the relative path defined in base URI

var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var settings = new ConnectionSettings(pool, new InMemoryConnection());
var client = new ElasticClient(settings);
var searchResponse = client.Search<Project>(s => s.AllIndices());

searchResponse.ApiCall.Uri.ToString().Should().Be("http://localhost:9200/_all/_search?typed_keys=true");

var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200/"));
var settings = new ConnectionSettings(pool, new InMemoryConnection());
var client = new ElasticClient(settings);
var searchResponse = client.Search<Project>(s => s.AllIndices());

searchResponse.ApiCall.Uri.ToString().Should().Be("http://localhost:9200/_all/_search?typed_keys=true");

var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200/elasticsearch"));
var settings = new ConnectionSettings(pool, new InMemoryConnection("elasticsearch"));
var client = new ElasticClient(settings);
var searchResponse = client.Search<Project>(s => s.AllIndices());

searchResponse.ApiCall.Uri.ToString().Should().Be("http://localhost:9200/elasticsearch/_all/_search?typed_keys=true");

var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200/elasticsearch/"));
var settings = new ConnectionSettings(pool, new InMemoryConnection("elasticsearch/"));
var client = new ElasticClient(settings);
var searchResponse = client.Search<Project>(s => s.AllIndices());

searchResponse.ApiCall.Uri.ToString().Should().Be("http://localhost:9200/elasticsearch/_all/_search?typed_keys=true");