- .NET Clients: other versions:
- Introduction
- Breaking changes
- API Conventions
- Elasticsearch.Net - Low level client
- NEST - High level client
- Troubleshooting
- Search
- Query DSL
- Full text queries
- Term level queries
- Exists Query Usage
- Fuzzy Date Query Usage
- Fuzzy Numeric Query Usage
- Fuzzy Query Usage
- Ids Query Usage
- Prefix Query Usage
- Date Range Query Usage
- Long Range Query Usage
- Numeric Range Query Usage
- Term Range Query Usage
- Regexp Query Usage
- Term Query Usage
- Terms List Query Usage
- Terms Lookup Query Usage
- Terms Query Usage
- Terms Set Query Usage
- Type Query Usage
- Wildcard Query Usage
- Compound queries
- Joining queries
- Geo queries
- Geo Bounding Box Query Usage
- Geo Distance Query Usage
- Geo Polygon Query Usage
- Geo Shape Circle Query Usage
- Geo Shape Envelope Query Usage
- Geo Shape Geometry Collection Query Usage
- Geo Shape Indexed Shape Query Usage
- Geo Shape Line String Query Usage
- Geo Shape Multi Line String Query Usage
- Geo Shape Multi Point Query Usage
- Geo Shape Multi Polygon Query Usage
- Geo Shape Point Query Usage
- Geo Shape Polygon Query Usage
- Specialized queries
- Span queries
- NEST specific queries
- Aggregations
- Metric Aggregations
- Average Aggregation Usage
- Cardinality Aggregation Usage
- Extended Stats Aggregation Usage
- Geo Bounds Aggregation Usage
- Geo Centroid Aggregation Usage
- Max Aggregation Usage
- Median Absolute Deviation Aggregation Usage
- Min Aggregation Usage
- Percentile Ranks Aggregation Usage
- Percentiles Aggregation Usage
- Scripted Metric Aggregation Usage
- Stats Aggregation Usage
- Sum Aggregation Usage
- Top Hits Aggregation Usage
- Value Count Aggregation Usage
- Weighted Average Aggregation Usage
- Bucket Aggregations
- Adjacency Matrix Usage
- Auto Date Histogram Aggregation Usage
- Children Aggregation Usage
- Composite Aggregation Usage
- Date Histogram Aggregation Usage
- Date Range Aggregation Usage
- Filter Aggregation Usage
- Filters Aggregation Usage
- Geo Distance Aggregation Usage
- Geo Hash Grid Aggregation Usage
- Global Aggregation Usage
- Histogram Aggregation Usage
- Ip Range Aggregation Usage
- Missing Aggregation Usage
- Nested Aggregation Usage
- Parent Aggregation Usage
- Range Aggregation Usage
- Reverse Nested Aggregation Usage
- Sampler Aggregation Usage
- Significant Terms Aggregation Usage
- Significant Text Aggregation Usage
- Terms Aggregation Usage
- Pipeline Aggregations
- Average Bucket Aggregation Usage
- Bucket Script Aggregation Usage
- Bucket Selector Aggregation Usage
- Bucket Sort Aggregation Usage
- Cumulative Sum Aggregation Usage
- Derivative Aggregation Usage
- Extended Stats Bucket Aggregation Usage
- Max Bucket Aggregation Usage
- Min Bucket Aggregation Usage
- Moving Average Ewma Aggregation Usage
- Moving Average Holt Linear Aggregation Usage
- Moving Average Holt Winters Aggregation Usage
- Moving Average Linear Aggregation Usage
- Moving Average Simple Aggregation Usage
- Moving Function Aggregation Usage
- Percentiles Bucket Aggregation Usage
- Serial Differencing Aggregation Usage
- Stats Bucket Aggregation Usage
- Sum Bucket Aggregation Usage
- Matrix Aggregations
- Metric Aggregations
NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Keeping track of nodes
editKeeping track of nodes
editCreating a Node
editA Node
can be instantiated by passing it a Uri
var node = new Node(new Uri("http://localhost:9200")); node.Uri.Should().NotBeNull(); node.Uri.Port.Should().Be(9200);
By default master eligible and holds data is presumed to be true *
node.MasterEligible.Should().BeTrue(); node.HoldsData.Should().BeTrue();
Is resurrected is true on first usage, hints to the transport that a ping might be useful
node.IsResurrected.Should().BeTrue();
Building a Node path
editpassing a node with a path should be preserved. Sometimes an Elasticsearch node lives behind a proxy
var node = new Node(new Uri("http://test.example/elasticsearch")); node.Uri.Port.Should().Be(80); node.Uri.AbsolutePath.Should().Be("/elasticsearch/");
We force paths to end with a forward slash so that they can later be safely combined
var combinedPath = new Uri(node.Uri, "index/type/_search"); combinedPath.AbsolutePath.Should().Be("/elasticsearch/index/type/_search");
which is exactly what the CreatePath
method does on Node
combinedPath = node.CreatePath("index/type/_search"); combinedPath.AbsolutePath.Should().Be("/elasticsearch/index/type/_search");
Marking Nodes
editvar node = new Node(new Uri("http://localhost:9200")); node.FailedAttempts.Should().Be(0); node.IsAlive.Should().BeTrue();
every time a node is marked dead, the number of attempts should increase and the passed datetime should be exposed.
for(var i = 0; i<10;i++) { var deadUntil = DateTime.Now.AddMinutes(1); node.MarkDead(deadUntil); node.FailedAttempts.Should().Be(i + 1); node.IsAlive.Should().BeFalse(); node.DeadUntil.Should().Be(deadUntil); }
however when marking a node alive, the DeadUntil
property should be reset and FailedAttempts
reset to 0
node.MarkAlive(); node.FailedAttempts.Should().Be(0); node.DeadUntil.Should().Be(default(DateTime)); node.IsAlive.Should().BeTrue();
Node Equality
editNodes are considered equal if they have the same endpoint, no matter what other metadata is associated
var node = new Node(new Uri("http://localhost:9200")) { MasterEligible = false }; var nodeAsMaster = new Node(new Uri("http://localhost:9200")) { MasterEligible = true }; (node == nodeAsMaster).Should().BeTrue(); (node != nodeAsMaster).Should().BeFalse(); var uri = new Uri("http://localhost:9200"); (node == uri).Should().BeTrue(); var differentUri = new Uri("http://localhost:9201"); (node != differentUri).Should().BeTrue(); node.Should().Be(nodeAsMaster);