| 1 |
// Copyright 2012-present Oliver Eilhard. All rights reserved. |
| 2 |
// Use of this source code is governed by a MIT-license. |
| 3 |
// See http://olivere.mit-license.org/license.txt for details. |
| 4 |
|
| 5 |
package elastic |
| 6 |
|
| 7 |
import ( |
| 8 |
"context" |
| 9 |
"encoding/json" |
| 10 |
"fmt" |
| 11 |
"net/url" |
| 12 |
"strings" |
| 13 |
|
| 14 |
"gopkg.in/olivere/elastic.v5/uritemplates" |
| 15 |
) |
| 16 |
|
| 17 |
// NodesStatsService returns node statistics. |
| 18 |
// See http://www.elastic.co/guide/en/elasticsearch/reference/5.2/cluster-nodes-stats.html |
| 19 |
// for details. |
| 20 |
type NodesStatsService struct { |
| 21 |
client *Client |
| 22 |
pretty bool |
| 23 |
metric []string |
| 24 |
indexMetric []string |
| 25 |
nodeId []string |
| 26 |
completionFields []string |
| 27 |
fielddataFields []string |
| 28 |
fields []string |
| 29 |
groups *bool |
| 30 |
human *bool |
| 31 |
level string |
| 32 |
timeout string |
| 33 |
types []string |
| 34 |
} |
| 35 |
|
| 36 |
// NewNodesStatsService creates a new NodesStatsService. |
| 37 |
func NewNodesStatsService(client *Client) *NodesStatsService { |
| 38 |
return &NodesStatsService{ |
| 39 |
client: client, |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
// Metric limits the information returned to the specified metrics. |
| 44 |
func (s *NodesStatsService) Metric(metric ...string) *NodesStatsService { |
| 45 |
s.metric = append(s.metric, metric...) |
| 46 |
return s |
| 47 |
} |
| 48 |
|
| 49 |
// IndexMetric limits the information returned for `indices` metric |
| 50 |
// to the specific index metrics. Isn't used if `indices` (or `all`) |
| 51 |
// metric isn't specified.. |
| 52 |
func (s *NodesStatsService) IndexMetric(indexMetric ...string) *NodesStatsService { |
| 53 |
s.indexMetric = append(s.indexMetric, indexMetric...) |
| 54 |
return s |
| 55 |
} |
| 56 |
|
| 57 |
// NodeId is a list of node IDs or names to limit the returned information; |
| 58 |
// use `_local` to return information from the node you're connecting to, |
| 59 |
// leave empty to get information from all nodes. |
| 60 |
func (s *NodesStatsService) NodeId(nodeId ...string) *NodesStatsService { |
| 61 |
s.nodeId = append(s.nodeId, nodeId...) |
| 62 |
return s |
| 63 |
} |
| 64 |
|
| 65 |
// CompletionFields is a list of fields for `fielddata` and `suggest` |
| 66 |
// index metric (supports wildcards). |
| 67 |
func (s *NodesStatsService) CompletionFields(completionFields ...string) *NodesStatsService { |
| 68 |
s.completionFields = append(s.completionFields, completionFields...) |
| 69 |
return s |
| 70 |
} |
| 71 |
|
| 72 |
// FielddataFields is a list of fields for `fielddata` index metric (supports wildcards). |
| 73 |
func (s *NodesStatsService) FielddataFields(fielddataFields ...string) *NodesStatsService { |
| 74 |
s.fielddataFields = append(s.fielddataFields, fielddataFields...) |
| 75 |
return s |
| 76 |
} |
| 77 |
|
| 78 |
// Fields is a list of fields for `fielddata` and `completion` index metric (supports wildcards). |
| 79 |
func (s *NodesStatsService) Fields(fields ...string) *NodesStatsService { |
| 80 |
s.fields = append(s.fields, fields...) |
| 81 |
return s |
| 82 |
} |
| 83 |
|
| 84 |
// Groups is a list of search groups for `search` index metric. |
| 85 |
func (s *NodesStatsService) Groups(groups bool) *NodesStatsService { |
| 86 |
s.groups = &groups |
| 87 |
return s |
| 88 |
} |
| 89 |
|
| 90 |
// Human indicates whether to return time and byte values in human-readable format. |
| 91 |
func (s *NodesStatsService) Human(human bool) *NodesStatsService { |
| 92 |
s.human = &human |
| 93 |
return s |
| 94 |
} |
| 95 |
|
| 96 |
// Level specifies whether to return indices stats aggregated at node, index or shard level. |
| 97 |
func (s *NodesStatsService) Level(level string) *NodesStatsService { |
| 98 |
s.level = level |
| 99 |
return s |
| 100 |
} |
| 101 |
|
| 102 |
// Timeout specifies an explicit operation timeout. |
| 103 |
func (s *NodesStatsService) Timeout(timeout string) *NodesStatsService { |
| 104 |
s.timeout = timeout |
| 105 |
return s |
| 106 |
} |
| 107 |
|
| 108 |
// Types a list of document types for the `indexing` index metric. |
| 109 |
func (s *NodesStatsService) Types(types ...string) *NodesStatsService { |
| 110 |
s.types = append(s.types, types...) |
| 111 |
return s |
| 112 |
} |
| 113 |
|
| 114 |
// Pretty indicates that the JSON response be indented and human readable. |
| 115 |
func (s *NodesStatsService) Pretty(pretty bool) *NodesStatsService { |
| 116 |
s.pretty = pretty |
| 117 |
return s |
| 118 |
} |
| 119 |
|
| 120 |
// buildURL builds the URL for the operation. |
| 121 |
func (s *NodesStatsService) buildURL() (string, url.Values, error) { |
| 122 |
var err error |
| 123 |
var path string |
| 124 |
|
| 125 |
if len(s.nodeId) > 0 && len(s.metric) > 0 && len(s.indexMetric) > 0 { |
| 126 |
path, err = uritemplates.Expand("/_nodes/{node_id}/stats/{metric}/{index_metric}", map[string]string{ |
| 127 |
"index_metric": strings.Join(s.indexMetric, ","), |
| 128 |
"node_id": strings.Join(s.nodeId, ","), |
| 129 |
"metric": strings.Join(s.metric, ","), |
| 130 |
}) |
| 131 |
} else if len(s.nodeId) > 0 && len(s.metric) > 0 && len(s.indexMetric) == 0 { |
| 132 |
path, err = uritemplates.Expand("/_nodes/{node_id}/stats/{metric}", map[string]string{ |
| 133 |
"node_id": strings.Join(s.nodeId, ","), |
| 134 |
"metric": strings.Join(s.metric, ","), |
| 135 |
}) |
| 136 |
} else if len(s.nodeId) > 0 && len(s.metric) == 0 && len(s.indexMetric) > 0 { |
| 137 |
path, err = uritemplates.Expand("/_nodes/{node_id}/stats/_all/{index_metric}", map[string]string{ |
| 138 |
"index_metric": strings.Join(s.indexMetric, ","), |
| 139 |
"node_id": strings.Join(s.nodeId, ","), |
| 140 |
}) |
| 141 |
} else if len(s.nodeId) > 0 && len(s.metric) == 0 && len(s.indexMetric) == 0 { |
| 142 |
path, err = uritemplates.Expand("/_nodes/{node_id}/stats", map[string]string{ |
| 143 |
"node_id": strings.Join(s.nodeId, ","), |
| 144 |
}) |
| 145 |
} else if len(s.nodeId) == 0 && len(s.metric) > 0 && len(s.indexMetric) > 0 { |
| 146 |
path, err = uritemplates.Expand("/_nodes/stats/{metric}/{index_metric}", map[string]string{ |
| 147 |
"index_metric": strings.Join(s.indexMetric, ","), |
| 148 |
"metric": strings.Join(s.metric, ","), |
| 149 |
}) |
| 150 |
} else if len(s.nodeId) == 0 && len(s.metric) > 0 && len(s.indexMetric) == 0 { |
| 151 |
path, err = uritemplates.Expand("/_nodes/stats/{metric}", map[string]string{ |
| 152 |
"metric": strings.Join(s.metric, ","), |
| 153 |
}) |
| 154 |
} else if len(s.nodeId) == 0 && len(s.metric) == 0 && len(s.indexMetric) > 0 { |
| 155 |
path, err = uritemplates.Expand("/_nodes/stats/_all/{index_metric}", map[string]string{ |
| 156 |
"index_metric": strings.Join(s.indexMetric, ","), |
| 157 |
}) |
| 158 |
} else { // if len(s.nodeId) == 0 && len(s.metric) == 0 && len(s.indexMetric) == 0 { |
| 159 |
path = "/_nodes/stats" |
| 160 |
} |
| 161 |
if err != nil { |
| 162 |
return "", url.Values{}, err |
| 163 |
} |
| 164 |
|
| 165 |
// Add query string parameters |
| 166 |
params := url.Values{} |
| 167 |
if s.pretty { |
| 168 |
params.Set("pretty", "1") |
| 169 |
} |
| 170 |
if len(s.completionFields) > 0 { |
| 171 |
params.Set("completion_fields", strings.Join(s.completionFields, ",")) |
| 172 |
} |
| 173 |
if len(s.fielddataFields) > 0 { |
| 174 |
params.Set("fielddata_fields", strings.Join(s.fielddataFields, ",")) |
| 175 |
} |
| 176 |
if len(s.fields) > 0 { |
| 177 |
params.Set("fields", strings.Join(s.fields, ",")) |
| 178 |
} |
| 179 |
if s.groups != nil { |
| 180 |
params.Set("groups", fmt.Sprintf("%v", *s.groups)) |
| 181 |
} |
| 182 |
if s.human != nil { |
| 183 |
params.Set("human", fmt.Sprintf("%v", *s.human)) |
| 184 |
} |
| 185 |
if s.level != "" { |
| 186 |
params.Set("level", s.level) |
| 187 |
} |
| 188 |
if s.timeout != "" { |
| 189 |
params.Set("timeout", s.timeout) |
| 190 |
} |
| 191 |
if len(s.types) > 0 { |
| 192 |
params.Set("types", strings.Join(s.types, ",")) |
| 193 |
} |
| 194 |
return path, params, nil |
| 195 |
} |
| 196 |
|
| 197 |
// Validate checks if the operation is valid. |
| 198 |
func (s *NodesStatsService) Validate() error { |
| 199 |
return nil |
| 200 |
} |
| 201 |
|
| 202 |
// Do executes the operation. |
| 203 |
func (s *NodesStatsService) Do(ctx context.Context) (*NodesStatsResponse, error) { |
| 204 |
// Check pre-conditions |
| 205 |
if err := s.Validate(); err != nil { |
| 206 |
return nil, err |
| 207 |
} |
| 208 |
|
| 209 |
// Get URL for request |
| 210 |
path, params, err := s.buildURL() |
| 211 |
if err != nil { |
| 212 |
return nil, err |
| 213 |
} |
| 214 |
|
| 215 |
// Get HTTP response |
| 216 |
res, err := s.client.PerformRequest(ctx, "GET", path, params, nil) |
| 217 |
if err != nil { |
| 218 |
return nil, err |
| 219 |
} |
| 220 |
|
| 221 |
// Return operation response |
| 222 |
ret := new(NodesStatsResponse) |
| 223 |
if err := json.Unmarshal(res.Body, ret); err != nil { |
| 224 |
return nil, err |
| 225 |
} |
| 226 |
return ret, nil |
| 227 |
} |
| 228 |
|
| 229 |
// NodesStatsResponse is the response of NodesStatsService.Do. |
| 230 |
type NodesStatsResponse struct { |
| 231 |
ClusterName string `json:"cluster_name"` |
| 232 |
Nodes map[string]*NodesStatsNode `json:"nodes"` |
| 233 |
} |
| 234 |
|
| 235 |
type NodesStatsNode struct { |
| 236 |
// Timestamp when these stats we're gathered. |
| 237 |
Timestamp int64 `json:"timestamp"` |
| 238 |
// Name of the node, e.g. "Mister Fear" |
| 239 |
Name string `json:"name"` |
| 240 |
// TransportAddress, e.g. "127.0.0.1:9300" |
| 241 |
TransportAddress string `json:"transport_address"` |
| 242 |
// Host is the host name, e.g. "macbookair" |
| 243 |
Host string `json:"host"` |
| 244 |
// IP is an IP address, e.g. "192.168.1.2" |
| 245 |
IP string `json:"ip"` |
| 246 |
// Roles is a list of the roles of the node, e.g. master, data, ingest. |
| 247 |
Roles []string `json:"roles"` |
| 248 |
|
| 249 |
// Attributes of the node. |
| 250 |
Attributes map[string]interface{} `json:"attributes"` |
| 251 |
|
| 252 |
// Indices returns index information. |
| 253 |
Indices *NodesStatsIndex `json:"indices"` |
| 254 |
|
| 255 |
// OS information, e.g. CPU and memory. |
| 256 |
OS *NodesStatsNodeOS `json:"os"` |
| 257 |
|
| 258 |
// Process information, e.g. max file descriptors. |
| 259 |
Process *NodesStatsNodeProcess `json:"process"` |
| 260 |
|
| 261 |
// JVM information, e.g. VM version. |
| 262 |
JVM *NodesStatsNodeJVM `json:"jvm"` |
| 263 |
|
| 264 |
// ThreadPool information. |
| 265 |
ThreadPool map[string]*NodesStatsNodeThreadPool `json:"thread_pool"` |
| 266 |
|
| 267 |
// FS returns information about the filesystem. |
| 268 |
FS *NodesStatsNodeFS `json:"fs"` |
| 269 |
|
| 270 |
// Network information. |
| 271 |
Transport *NodesStatsNodeTransport `json:"transport"` |
| 272 |
|
| 273 |
// HTTP information. |
| 274 |
HTTP *NodesStatsNodeHTTP `json:"http"` |
| 275 |
|
| 276 |
// Breaker contains information about circuit breakers. |
| 277 |
Breaker map[string]*NodesStatsBreaker `json:"breakers"` |
| 278 |
|
| 279 |
// ScriptStats information. |
| 280 |
ScriptStats *NodesStatsScriptStats `json:"script"` |
| 281 |
|
| 282 |
// Discovery information. |
| 283 |
Discovery *NodesStatsDiscovery `json:"discovery"` |
| 284 |
|
| 285 |
// Ingest information |
| 286 |
Ingest *NodesStatsIngest `json:"ingest"` |
| 287 |
} |
| 288 |
|
| 289 |
type NodesStatsIndex struct { |
| 290 |
Docs *NodesStatsDocsStats `json:"docs"` |
| 291 |
Store *NodesStatsStoreStats `json:"store"` |
| 292 |
Indexing *NodesStatsIndexingStats `json:"indexing"` |
| 293 |
Get *NodesStatsGetStats `json:"get"` |
| 294 |
Search *NodesStatsSearchStats `json:"search"` |
| 295 |
Merges *NodesStatsMergeStats `json:"merges"` |
| 296 |
Refresh *NodesStatsRefreshStats `json:"refresh"` |
| 297 |
Flush *NodesStatsFlushStats `json:"flush"` |
| 298 |
Warmer *NodesStatsWarmerStats `json:"warmer"` |
| 299 |
QueryCache *NodesStatsQueryCacheStats `json:"query_cache"` |
| 300 |
Fielddata *NodesStatsFielddataStats `json:"fielddata"` |
| 301 |
Percolate *NodesStatsPercolateStats `json:"percolate"` |
| 302 |
Completion *NodesStatsCompletionStats `json:"completion"` |
| 303 |
Segments *NodesStatsSegmentsStats `json:"segments"` |
| 304 |
Translog *NodesStatsTranslogStats `json:"translog"` |
| 305 |
Suggest *NodesStatsSuggestStats `json:"suggest"` |
| 306 |
RequestCache *NodesStatsRequestCacheStats `json:"request_cache"` |
| 307 |
Recovery NodesStatsRecoveryStats `json:"recovery"` |
| 308 |
|
| 309 |
Indices map[string]*NodesStatsIndex `json:"indices"` // for level=indices |
| 310 |
Shards map[string]*NodesStatsIndex `json:"shards"` // for level=shards |
| 311 |
} |
| 312 |
|
| 313 |
type NodesStatsDocsStats struct { |
| 314 |
Count int64 `json:"count"` |
| 315 |
Deleted int64 `json:"deleted"` |
| 316 |
} |
| 317 |
|
| 318 |
type NodesStatsStoreStats struct { |
| 319 |
Size string `json:"size"` |
| 320 |
SizeInBytes int64 `json:"size_in_bytes"` |
| 321 |
ThrottleTime string `json:"throttle_time"` |
| 322 |
ThrottleTimeInMillis int64 `json:"throttle_time_in_millis"` |
| 323 |
} |
| 324 |
|
| 325 |
type NodesStatsIndexingStats struct { |
| 326 |
IndexTotal int64 `json:"index_total"` |
| 327 |
IndexTime string `json:"index_time"` |
| 328 |
IndexTimeInMillis int64 `json:"index_time_in_millis"` |
| 329 |
IndexCurrent int64 `json:"index_current"` |
| 330 |
IndexFailed int64 `json:"index_failed"` |
| 331 |
DeleteTotal int64 `json:"delete_total"` |
| 332 |
DeleteTime string `json:"delete_time"` |
| 333 |
DeleteTimeInMillis int64 `json:"delete_time_in_millis"` |
| 334 |
DeleteCurrent int64 `json:"delete_current"` |
| 335 |
NoopUpdateTotal int64 `json:"noop_update_total"` |
| 336 |
IsThrottled bool `json:"is_throttled"` |
| 337 |
ThrottleTime string `json:"throttle_time"` |
| 338 |
ThrottleTimeInMillis int64 `json:"throttle_time_in_millis"` |
| 339 |
|
| 340 |
Types map[string]*NodesStatsIndexingStats `json:"types"` // stats for individual types |
| 341 |
} |
| 342 |
|
| 343 |
type NodesStatsGetStats struct { |
| 344 |
Total int64 `json:"total"` |
| 345 |
Time string `json:"get_time"` |
| 346 |
TimeInMillis int64 `json:"time_in_millis"` |
| 347 |
Exists int64 `json:"exists"` |
| 348 |
ExistsTime string `json:"exists_time"` |
| 349 |
ExistsTimeInMillis int64 `json:"exists_in_millis"` |
| 350 |
Missing int64 `json:"missing"` |
| 351 |
MissingTime string `json:"missing_time"` |
| 352 |
MissingTimeInMillis int64 `json:"missing_in_millis"` |
| 353 |
Current int64 `json:"current"` |
| 354 |
} |
| 355 |
|
| 356 |
type NodesStatsSearchStats struct { |
| 357 |
OpenContexts int64 `json:"open_contexts"` |
| 358 |
QueryTotal int64 `json:"query_total"` |
| 359 |
QueryTime string `json:"query_time"` |
| 360 |
QueryTimeInMillis int64 `json:"query_time_in_millis"` |
| 361 |
QueryCurrent int64 `json:"query_current"` |
| 362 |
FetchTotal int64 `json:"fetch_total"` |
| 363 |
FetchTime string `json:"fetch_time"` |
| 364 |
FetchTimeInMillis int64 `json:"fetch_time_in_millis"` |
| 365 |
FetchCurrent int64 `json:"fetch_current"` |
| 366 |
ScrollTotal int64 `json:"scroll_total"` |
| 367 |
ScrollTime string `json:"scroll_time"` |
| 368 |
ScrollTimeInMillis int64 `json:"scroll_time_in_millis"` |
| 369 |
ScrollCurrent int64 `json:"scroll_current"` |
| 370 |
|
| 371 |
Groups map[string]*NodesStatsSearchStats `json:"groups"` // stats for individual groups |
| 372 |
} |
| 373 |
|
| 374 |
type NodesStatsMergeStats struct { |
| 375 |
Current int64 `json:"current"` |
| 376 |
CurrentDocs int64 `json:"current_docs"` |
| 377 |
CurrentSize string `json:"current_size"` |
| 378 |
CurrentSizeInBytes int64 `json:"current_size_in_bytes"` |
| 379 |
Total int64 `json:"total"` |
| 380 |
TotalTime string `json:"total_time"` |
| 381 |
TotalTimeInMillis int64 `json:"total_time_in_millis"` |
| 382 |
TotalDocs int64 `json:"total_docs"` |
| 383 |
TotalSize string `json:"total_size"` |
| 384 |
TotalSizeInBytes int64 `json:"total_size_in_bytes"` |
| 385 |
TotalStoppedTime string `json:"total_stopped_time"` |
| 386 |
TotalStoppedTimeInMillis int64 `json:"total_stopped_time_in_millis"` |
| 387 |
TotalThrottledTime string `json:"total_throttled_time"` |
| 388 |
TotalThrottledTimeInMillis int64 `json:"total_throttled_time_in_millis"` |
| 389 |
TotalThrottleBytes string `json:"total_auto_throttle"` |
| 390 |
TotalThrottleBytesInBytes int64 `json:"total_auto_throttle_in_bytes"` |
| 391 |
} |
| 392 |
|
| 393 |
type NodesStatsRefreshStats struct { |
| 394 |
Total int64 `json:"total"` |
| 395 |
TotalTime string `json:"total_time"` |
| 396 |
TotalTimeInMillis int64 `json:"total_time_in_millis"` |
| 397 |
} |
| 398 |
|
| 399 |
type NodesStatsFlushStats struct { |
| 400 |
Total int64 `json:"total"` |
| 401 |
TotalTime string `json:"total_time"` |
| 402 |
TotalTimeInMillis int64 `json:"total_time_in_millis"` |
| 403 |
} |
| 404 |
|
| 405 |
type NodesStatsWarmerStats struct { |
| 406 |
Current int64 `json:"current"` |
| 407 |
Total int64 `json:"total"` |
| 408 |
TotalTime string `json:"total_time"` |
| 409 |
TotalTimeInMillis int64 `json:"total_time_in_millis"` |
| 410 |
} |
| 411 |
|
| 412 |
type NodesStatsQueryCacheStats struct { |
| 413 |
MemorySize string `json:"memory_size"` |
| 414 |
MemorySizeInBytes int64 `json:"memory_size_in_bytes"` |
| 415 |
TotalCount int64 `json:"total_count"` |
| 416 |
HitCount int64 `json:"hit_count"` |
| 417 |
MissCount int64 `json:"miss_count"` |
| 418 |
CacheSize int64 `json:"cache_size"` |
| 419 |
CacheCount int64 `json:"cache_count"` |
| 420 |
Evictions int64 `json:"evictions"` |
| 421 |
} |
| 422 |
|
| 423 |
type NodesStatsFielddataStats struct { |
| 424 |
MemorySize string `json:"memory_size"` |
| 425 |
MemorySizeInBytes int64 `json:"memory_size_in_bytes"` |
| 426 |
Evictions int64 `json:"evictions"` |
| 427 |
Fields map[string]struct { |
| 428 |
MemorySize string `json:"memory_size"` |
| 429 |
MemorySizeInBytes int64 `json:"memory_size_in_bytes"` |
| 430 |
} `json:"fields"` |
| 431 |
} |
| 432 |
|
| 433 |
type NodesStatsPercolateStats struct { |
| 434 |
Total int64 `json:"total"` |
| 435 |
Time string `json:"time"` |
| 436 |
TimeInMillis int64 `json:"time_in_millis"` |
| 437 |
Current int64 `json:"current"` |
| 438 |
MemorySize string `json:"memory_size"` |
| 439 |
MemorySizeInBytes int64 `json:"memory_size_in_bytes"` |
| 440 |
Queries int64 `json:"queries"` |
| 441 |
} |
| 442 |
|
| 443 |
type NodesStatsCompletionStats struct { |
| 444 |
Size string `json:"size"` |
| 445 |
SizeInBytes int64 `json:"size_in_bytes"` |
| 446 |
Fields map[string]struct { |
| 447 |
Size string `json:"size"` |
| 448 |
SizeInBytes int64 `json:"size_in_bytes"` |
| 449 |
} `json:"fields"` |
| 450 |
} |
| 451 |
|
| 452 |
type NodesStatsSegmentsStats struct { |
| 453 |
Count int64 `json:"count"` |
| 454 |
Memory string `json:"memory"` |
| 455 |
MemoryInBytes int64 `json:"memory_in_bytes"` |
| 456 |
TermsMemory string `json:"terms_memory"` |
| 457 |
TermsMemoryInBytes int64 `json:"terms_memory_in_bytes"` |
| 458 |
StoredFieldsMemory string `json:"stored_fields_memory"` |
| 459 |
StoredFieldsMemoryInBytes int64 `json:"stored_fields_memory_in_bytes"` |
| 460 |
TermVectorsMemory string `json:"term_vectors_memory"` |
| 461 |
TermVectorsMemoryInBytes int64 `json:"term_vectors_memory_in_bytes"` |
| 462 |
NormsMemory string `json:"norms_memory"` |
| 463 |
NormsMemoryInBytes int64 `json:"norms_memory_in_bytes"` |
| 464 |
DocValuesMemory string `json:"doc_values_memory"` |
| 465 |
DocValuesMemoryInBytes int64 `json:"doc_values_memory_in_bytes"` |
| 466 |
IndexWriterMemory string `json:"index_writer_memory"` |
| 467 |
IndexWriterMemoryInBytes int64 `json:"index_writer_memory_in_bytes"` |
| 468 |
IndexWriterMaxMemory string `json:"index_writer_max_memory"` |
| 469 |
IndexWriterMaxMemoryInBytes int64 `json:"index_writer_max_memory_in_bytes"` |
| 470 |
VersionMapMemory string `json:"version_map_memory"` |
| 471 |
VersionMapMemoryInBytes int64 `json:"version_map_memory_in_bytes"` |
| 472 |
FixedBitSetMemory string `json:"fixed_bit_set"` // not a typo |
| 473 |
FixedBitSetMemoryInBytes int64 `json:"fixed_bit_set_memory_in_bytes"` |
| 474 |
} |
| 475 |
|
| 476 |
type NodesStatsTranslogStats struct { |
| 477 |
Operations int64 `json:"operations"` |
| 478 |
Size string `json:"size"` |
| 479 |
SizeInBytes int64 `json:"size_in_bytes"` |
| 480 |
} |
| 481 |
|
| 482 |
type NodesStatsSuggestStats struct { |
| 483 |
Total int64 `json:"total"` |
| 484 |
TotalTime string `json:"total_time"` |
| 485 |
TotalTimeInMillis int64 `json:"total_time_in_millis"` |
| 486 |
Current int64 `json:"current"` |
| 487 |
} |
| 488 |
|
| 489 |
type NodesStatsRequestCacheStats struct { |
| 490 |
MemorySize string `json:"memory_size"` |
| 491 |
MemorySizeInBytes int64 `json:"memory_size_in_bytes"` |
| 492 |
Evictions int64 `json:"evictions"` |
| 493 |
HitCount int64 `json:"hit_count"` |
| 494 |
MissCount int64 `json:"miss_count"` |
| 495 |
} |
| 496 |
|
| 497 |
type NodesStatsRecoveryStats struct { |
| 498 |
CurrentAsSource int `json:"current_as_source"` |
| 499 |
CurrentAsTarget int `json:"current_as_target"` |
| 500 |
ThrottleTime string `json:"throttle_time"` |
| 501 |
ThrottleTimeInMillis int64 `json:"throttle_time_in_millis"` |
| 502 |
} |
| 503 |
|
| 504 |
type NodesStatsNodeOS struct { |
| 505 |
Timestamp int64 `json:"timestamp"` |
| 506 |
CPU *NodesStatsNodeOSCPU `json:"cpu"` |
| 507 |
Mem *NodesStatsNodeOSMem `json:"mem"` |
| 508 |
Swap *NodesStatsNodeOSSwap `json:"swap"` |
| 509 |
} |
| 510 |
|
| 511 |
type NodesStatsNodeOSCPU struct { |
| 512 |
Percent int `json:"percent"` |
| 513 |
LoadAverage map[string]float64 `json:"load_average"` // keys are: 1m, 5m, and 15m |
| 514 |
} |
| 515 |
|
| 516 |
type NodesStatsNodeOSMem struct { |
| 517 |
Total string `json:"total"` |
| 518 |
TotalInBytes int64 `json:"total_in_bytes"` |
| 519 |
Free string `json:"free"` |
| 520 |
FreeInBytes int64 `json:"free_in_bytes"` |
| 521 |
Used string `json:"used"` |
| 522 |
UsedInBytes int64 `json:"used_in_bytes"` |
| 523 |
FreePercent int `json:"free_percent"` |
| 524 |
UsedPercent int `json:"used_percent"` |
| 525 |
} |
| 526 |
|
| 527 |
type NodesStatsNodeOSSwap struct { |
| 528 |
Total string `json:"total"` |
| 529 |
TotalInBytes int64 `json:"total_in_bytes"` |
| 530 |
Free string `json:"free"` |
| 531 |
FreeInBytes int64 `json:"free_in_bytes"` |
| 532 |
Used string `json:"used"` |
| 533 |
UsedInBytes int64 `json:"used_in_bytes"` |
| 534 |
} |
| 535 |
|
| 536 |
type NodesStatsNodeProcess struct { |
| 537 |
Timestamp int64 `json:"timestamp"` |
| 538 |
OpenFileDescriptors int64 `json:"open_file_descriptors"` |
| 539 |
MaxFileDescriptors int64 `json:"max_file_descriptors"` |
| 540 |
CPU struct { |
| 541 |
Percent int `json:"percent"` |
| 542 |
Total string `json:"total"` |
| 543 |
TotalInMillis int64 `json:"total_in_millis"` |
| 544 |
} `json:"cpu"` |
| 545 |
Mem struct { |
| 546 |
TotalVirtual string `json:"total_virtual"` |
| 547 |
TotalVirtualInBytes int64 `json:"total_virtual_in_bytes"` |
| 548 |
} `json:"mem"` |
| 549 |
} |
| 550 |
|
| 551 |
type NodesStatsNodeJVM struct { |
| 552 |
Timestamp int64 `json:"timestamp"` |
| 553 |
Uptime string `json:"uptime"` |
| 554 |
UptimeInMillis int64 `json:"uptime_in_millis"` |
| 555 |
Mem *NodesStatsNodeJVMMem `json:"mem"` |
| 556 |
Threads *NodesStatsNodeJVMThreads `json:"threads"` |
| 557 |
GC *NodesStatsNodeJVMGC `json:"gc"` |
| 558 |
BufferPools map[string]*NodesStatsNodeJVMBufferPool `json:"buffer_pools"` |
| 559 |
Classes *NodesStatsNodeJVMClasses `json:"classes"` |
| 560 |
} |
| 561 |
|
| 562 |
type NodesStatsNodeJVMMem struct { |
| 563 |
HeapUsed string `json:"heap_used"` |
| 564 |
HeapUsedInBytes int64 `json:"heap_used_in_bytes"` |
| 565 |
HeapUsedPercent int `json:"heap_used_percent"` |
| 566 |
HeapCommitted string `json:"heap_committed"` |
| 567 |
HeapCommittedInBytes int64 `json:"heap_committed_in_bytes"` |
| 568 |
HeapMax string `json:"heap_max"` |
| 569 |
HeapMaxInBytes int64 `json:"heap_max_in_bytes"` |
| 570 |
NonHeapUsed string `json:"non_heap_used"` |
| 571 |
NonHeapUsedInBytes int64 `json:"non_heap_used_in_bytes"` |
| 572 |
NonHeapCommitted string `json:"non_heap_committed"` |
| 573 |
NonHeapCommittedInBytes int64 `json:"non_heap_committed_in_bytes"` |
| 574 |
Pools map[string]struct { |
| 575 |
Used string `json:"used"` |
| 576 |
UsedInBytes int64 `json:"used_in_bytes"` |
| 577 |
Max string `json:"max"` |
| 578 |
MaxInBytes int64 `json:"max_in_bytes"` |
| 579 |
PeakUsed string `json:"peak_used"` |
| 580 |
PeakUsedInBytes int64 `json:"peak_used_in_bytes"` |
| 581 |
PeakMax string `json:"peak_max"` |
| 582 |
PeakMaxInBytes int64 `json:"peak_max_in_bytes"` |
| 583 |
} `json:"pools"` |
| 584 |
} |
| 585 |
|
| 586 |
type NodesStatsNodeJVMThreads struct { |
| 587 |
Count int64 `json:"count"` |
| 588 |
PeakCount int64 `json:"peak_count"` |
| 589 |
} |
| 590 |
|
| 591 |
type NodesStatsNodeJVMGC struct { |
| 592 |
Collectors map[string]*NodesStatsNodeJVMGCCollector `json:"collectors"` |
| 593 |
} |
| 594 |
|
| 595 |
type NodesStatsNodeJVMGCCollector struct { |
| 596 |
CollectionCount int64 `json:"collection_count"` |
| 597 |
CollectionTime string `json:"collection_time"` |
| 598 |
CollectionTimeInMillis int64 `json:"collection_time_in_millis"` |
| 599 |
} |
| 600 |
|
| 601 |
type NodesStatsNodeJVMBufferPool struct { |
| 602 |
Count int64 `json:"count"` |
| 603 |
TotalCapacity string `json:"total_capacity"` |
| 604 |
TotalCapacityInBytes int64 `json:"total_capacity_in_bytes"` |
| 605 |
} |
| 606 |
|
| 607 |
type NodesStatsNodeJVMClasses struct { |
| 608 |
CurrentLoadedCount int64 `json:"current_loaded_count"` |
| 609 |
TotalLoadedCount int64 `json:"total_loaded_count"` |
| 610 |
TotalUnloadedCount int64 `json:"total_unloaded_count"` |
| 611 |
} |
| 612 |
|
| 613 |
type NodesStatsNodeThreadPool struct { |
| 614 |
Threads int `json:"threads"` |
| 615 |
Queue int `json:"queue"` |
| 616 |
Active int `json:"active"` |
| 617 |
Rejected int64 `json:"rejected"` |
| 618 |
Largest int `json:"largest"` |
| 619 |
Completed int64 `json:"completed"` |
| 620 |
} |
| 621 |
|
| 622 |
type NodesStatsNodeFS struct { |
| 623 |
Timestamp int64 `json:"timestamp"` |
| 624 |
Total *NodesStatsNodeFSEntry `json:"total"` |
| 625 |
Data []*NodesStatsNodeFSEntry `json:"data"` |
| 626 |
IOStats *NodesStatsNodeFSIOStats `json:"io_stats"` |
| 627 |
} |
| 628 |
|
| 629 |
type NodesStatsNodeFSEntry struct { |
| 630 |
Path string `json:"path"` |
| 631 |
Mount string `json:"mount"` |
| 632 |
Type string `json:"type"` |
| 633 |
Total string `json:"total"` |
| 634 |
TotalInBytes int64 `json:"total_in_bytes"` |
| 635 |
Free string `json:"free"` |
| 636 |
FreeInBytes int64 `json:"free_in_bytes"` |
| 637 |
Available string `json:"available"` |
| 638 |
AvailableInBytes int64 `json:"available_in_bytes"` |
| 639 |
Spins string `json:"spins"` |
| 640 |
} |
| 641 |
|
| 642 |
type NodesStatsNodeFSIOStats struct { |
| 643 |
Devices []*NodesStatsNodeFSIOStatsEntry `json:"devices"` |
| 644 |
Total *NodesStatsNodeFSIOStatsEntry `json:"total"` |
| 645 |
} |
| 646 |
|
| 647 |
type NodesStatsNodeFSIOStatsEntry struct { |
| 648 |
DeviceName string `json:"device_name"` |
| 649 |
Operations int64 `json:"operations"` |
| 650 |
ReadOperations int64 `json:"read_operations"` |
| 651 |
WriteOperations int64 `json:"write_operations"` |
| 652 |
ReadKilobytes int64 `json:"read_kilobytes"` |
| 653 |
WriteKilobytes int64 `json:"write_kilobytes"` |
| 654 |
} |
| 655 |
|
| 656 |
type NodesStatsNodeTransport struct { |
| 657 |
ServerOpen int `json:"server_open"` |
| 658 |
RxCount int64 `json:"rx_count"` |
| 659 |
RxSize string `json:"rx_size"` |
| 660 |
RxSizeInBytes int64 `json:"rx_size_in_bytes"` |
| 661 |
TxCount int64 `json:"tx_count"` |
| 662 |
TxSize string `json:"tx_size"` |
| 663 |
TxSizeInBytes int64 `json:"tx_size_in_bytes"` |
| 664 |
} |
| 665 |
|
| 666 |
type NodesStatsNodeHTTP struct { |
| 667 |
CurrentOpen int `json:"current_open"` |
| 668 |
TotalOpened int `json:"total_opened"` |
| 669 |
} |
| 670 |
|
| 671 |
type NodesStatsBreaker struct { |
| 672 |
LimitSize string `json:"limit_size"` |
| 673 |
LimitSizeInBytes int64 `json:"limit_size_in_bytes"` |
| 674 |
EstimatedSize string `json:"estimated_size"` |
| 675 |
EstimatedSizeInBytes int64 `json:"estimated_size_in_bytes"` |
| 676 |
Overhead float64 `json:"overhead"` |
| 677 |
Tripped int64 `json:"tripped"` |
| 678 |
} |
| 679 |
|
| 680 |
type NodesStatsScriptStats struct { |
| 681 |
Compilations int64 `json:"compilations"` |
| 682 |
CacheEvictions int64 `json:"cache_evictions"` |
| 683 |
} |
| 684 |
|
| 685 |
type NodesStatsDiscovery struct { |
| 686 |
ClusterStateQueue *NodesStatsDiscoveryStats `json:"cluster_state_queue"` |
| 687 |
} |
| 688 |
|
| 689 |
type NodesStatsDiscoveryStats struct { |
| 690 |
Total int64 `json:"total"` |
| 691 |
Pending int64 `json:"pending"` |
| 692 |
Committed int64 `json:"committed"` |
| 693 |
} |
| 694 |
|
| 695 |
type NodesStatsIngest struct { |
| 696 |
Total *NodesStatsIngestStats `json:"total"` |
| 697 |
Pipelines interface{} `json:"pipelines"` |
| 698 |
} |
| 699 |
|
| 700 |
type NodesStatsIngestStats struct { |
| 701 |
Count int64 `json:"count"` |
| 702 |
Time string `json:"time"` |
| 703 |
TimeInMillis int64 `json:"time_in_millis"` |
| 704 |
Current int64 `json:"current"` |
| 705 |
Failed int64 `json:"failed"` |
| 706 |
} |