Movatterモバイル変換


[0]ホーム

URL:


Notice  The highest tagged major version isv9.

state

package
v8.19.1Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2025 License:Apache-2.0Imports:12Imported by:4

Details

Repository

github.com/elastic/go-elasticsearch

Links

Documentation

Overview

Get the cluster state.Get comprehensive information about the state of the cluster.

The cluster state is an internal data structure which keeps track of avariety of information needed by every node, including the identity andattributes of the other nodes in the cluster; cluster-wide settings; indexmetadata, including the mapping and settings for each index; the location andstatus of every shard copy in the cluster.

The elected master node ensures that every node in the cluster has a copy ofthe same cluster state.This API lets you retrieve a representation of this internal state fordebugging or diagnostic purposes.You may need to consult the Elasticsearch source code to determine theprecise meaning of the response.

By default the API will route requests to the elected master node since thisnode is the authoritative source of cluster states.You can also retrieve the cluster state held on the node handling the APIrequest by adding the `?local=true` query parameter.

Elasticsearch may need to expend significant effort to compute a response tothis API in larger clusters, and the response may comprise a very largequantity of data.If you use this API repeatedly, your cluster may become unstable.

WARNING: The response is a representation of an internal data structure.Its format is not subject to the same compatibility guarantees as other morestable APIs and may change from version to version.Do not query this API using external monitoring tools.Instead, obtain the information you require using other more stable clusterAPIs.

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildPath =errors.New("cannot build path, check for missing path parameters")

ErrBuildPath is returned in case of missing parameters within the build of the request.

Functions

This section is empty.

Types

typeNewState

type NewState func() *State

NewState type alias for index.

funcNewStateFunc

func NewStateFunc(tpelastictransport.Interface)NewState

NewStateFunc returns a new instance of State with the provided transport.Used in the index of the library this allows to retrieve every apis in once place.

typeResponseadded inv8.7.0

type Response =json.RawMessage

funcNewResponseadded inv8.7.1

func NewResponse() *Response

typeState

type State struct {// contains filtered or unexported fields}

funcNew

Get the cluster state.Get comprehensive information about the state of the cluster.

The cluster state is an internal data structure which keeps track of avariety of information needed by every node, including the identity andattributes of the other nodes in the cluster; cluster-wide settings; indexmetadata, including the mapping and settings for each index; the location andstatus of every shard copy in the cluster.

The elected master node ensures that every node in the cluster has a copy ofthe same cluster state.This API lets you retrieve a representation of this internal state fordebugging or diagnostic purposes.You may need to consult the Elasticsearch source code to determine theprecise meaning of the response.

By default the API will route requests to the elected master node since thisnode is the authoritative source of cluster states.You can also retrieve the cluster state held on the node handling the APIrequest by adding the `?local=true` query parameter.

Elasticsearch may need to expend significant effort to compute a response tothis API in larger clusters, and the response may comprise a very largequantity of data.If you use this API repeatedly, your cluster may become unstable.

WARNING: The response is a representation of an internal data structure.Its format is not subject to the same compatibility guarantees as other morestable APIs and may change from version to version.Do not query this API using external monitoring tools.Instead, obtain the information you require using other more stable clusterAPIs.

https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-state.html

func (*State)AllowNoIndices

func (r *State) AllowNoIndices(allownoindicesbool) *State

AllowNoIndices Whether to ignore if a wildcard indices expression resolves into no concreteindices. (This includes `_all` string or when no indices have been specified)API name: allow_no_indices

func (State)Do

func (rState) Do(providedCtxcontext.Context) (Response,error)

Do runs the request through the transport, handle the response and returns a state.Response

func (*State)ErrorTraceadded inv8.14.0

func (r *State) ErrorTrace(errortracebool) *State

ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errorswhen they occur.API name: error_trace

func (*State)ExpandWildcards

func (r *State) ExpandWildcards(expandwildcards ...expandwildcard.ExpandWildcard) *State

ExpandWildcards Whether to expand wildcard expression to concrete indices that are open,closed or both.API name: expand_wildcards

func (*State)FilterPathadded inv8.14.0

func (r *State) FilterPath(filterpaths ...string) *State

FilterPath Comma-separated list of filters in dot notation which reduce the responsereturned by Elasticsearch.API name: filter_path

func (*State)FlatSettings

func (r *State) FlatSettings(flatsettingsbool) *State

FlatSettings Return settings in flat format (default: false)API name: flat_settings

func (*State)Header

func (r *State) Header(key, valuestring) *State

Header set a key, value pair in the State headers map.

func (*State)HttpRequest

func (r *State) HttpRequest(ctxcontext.Context) (*http.Request,error)

HttpRequest returns the http.Request object built from thegiven parameters.

func (*State)Humanadded inv8.14.0

func (r *State) Human(humanbool) *State

Human When set to `true` will return statistics in a format suitable for humans.For example `"exists_time": "1h"` for humans and`"eixsts_time_in_millis": 3600000` for computers. When disabled the humanreadable values will be omitted. This makes sense for responses beingconsumedonly by machines.API name: human

func (*State)IgnoreUnavailable

func (r *State) IgnoreUnavailable(ignoreunavailablebool) *State

IgnoreUnavailable Whether specified concrete indices should be ignored when unavailable(missing or closed)API name: ignore_unavailable

func (*State)Index

func (r *State) Index(indexstring) *State

Index A comma-separated list of index names; use `_all` or empty string to performthe operation on all indicesAPI Name: index

func (State)IsSuccess

func (rState) IsSuccess(providedCtxcontext.Context) (bool,error)

IsSuccess allows to run a query with a context and retrieve the result as a boolean.This only exists for endpoints without a request payload and allows for quick control flow.

func (*State)Local

func (r *State) Local(localbool) *State

Local Return local information, do not retrieve the state from master node(default: false)API name: local

func (*State)MasterTimeout

func (r *State) MasterTimeout(durationstring) *State

MasterTimeout Specify timeout for connection to masterAPI name: master_timeout

func (*State)Metric

func (r *State) Metric(metricstring) *State

Metric Limit the information returned to the specified metricsAPI Name: metric

func (State)Performadded inv8.7.0

func (rState) Perform(providedCtxcontext.Context) (*http.Response,error)

Perform runs the http.Request through the provided transport and returns an http.Response.

func (*State)Prettyadded inv8.14.0

func (r *State) Pretty(prettybool) *State

Pretty If set to `true` the returned JSON will be "pretty-formatted". Only usethis option for debugging only.API name: pretty

func (*State)WaitForMetadataVersion

func (r *State) WaitForMetadataVersion(versionnumberstring) *State

WaitForMetadataVersion Wait for the metadata version to be equal or greater than the specifiedmetadata versionAPI name: wait_for_metadata_version

func (*State)WaitForTimeout

func (r *State) WaitForTimeout(durationstring) *State

WaitForTimeout The maximum time to wait for wait_for_metadata_version before timing outAPI name: wait_for_timeout

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp