elasticsearch

package
v0.16.6 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocationExclude

type AllocationExclude struct {
	Name string `json:"_name,omitempty"`
}

type AllocationSettings

type AllocationSettings struct {
	Cluster ClusterRoutingSettings `json:"cluster,omitempty"`

} // TODO awareness settings

AllocationSettings model a subset of the supported attributes for dynamic Elasticsearch cluster settings.

func (AllocationSettings) IsShardsAllocationEnabled

func (s AllocationSettings) IsShardsAllocationEnabled() bool

type ClusterRoutingAllocation

type ClusterRoutingAllocation struct {
	Transient AllocationSettings `json:"transient,omitempty"`
}

ClusterRoutingAllocation models a subset of transient allocation settings for an Elasticsearch cluster.

type ClusterRoutingSettings

type ClusterRoutingSettings struct {
	Routing RoutingSettings `json:"routing,omitempty"`
}

type ClusterStateNode

type ClusterStateNode struct {
	Name             string `json:"name"`
	EphemeralID      string `json:"ephemeral_id"`
	TransportAddress string `json:"transport_address"`
	Attributes       struct {
		MlMachineMemory string `json:"ml.machine_memory"`
		MlMaxOpenJobs   string `json:"ml.max_open_jobs"`
		XpackInstalled  string `json:"xpack.installed"`
		MlEnabled       string `json:"ml.enabled"`
	} `json:"attributes"`
}

ClusterStateNode represents an element in the `node` structure in Elasticsearch cluster state.

type DiscoveryZen

type DiscoveryZen struct {
	MinimumMasterNodes int `json:"discovery.zen.minimum_master_nodes"`
}

DiscoveryZen set minimum number of master eligible nodes that must be visible to form a cluster.

type DiscoveryZenSettings

type DiscoveryZenSettings struct {
	Transient  DiscoveryZen `json:"transient"`
	Persistent DiscoveryZen `json:"persistent"`
}

DiscoveryZenSettings are cluster settings related to the zen discovery mechanism.

type ErrorResponse

type ErrorResponse struct {
	Status int `json:"status"`
	Error  struct {
		CausedBy struct {
			Reason string `json:"reason"`
			Type   string `json:"type"`
		} `json:"caused_by"`
		Reason    string `json:"reason"`
		Type      string `json:"type"`
		RootCause []struct {
			Reason string `json:"reason"`
			Type   string `json:"type"`
		} `json:"root_cause"`
	} `json:"error"`
}

ErrorResponse is a Elasticsearch error response.

type Health

type Health struct {
	ClusterName                 string       `json:"cluster_name"`
	Status                      HealthString `json:"status"`
	TimedOut                    bool         `json:"timed_out"`
	NumberOfNodes               int          `json:"number_of_nodes"`
	NumberOfDataNodes           int          `json:"number_of_data_nodes"`
	ActivePrimaryShards         int          `json:"active_primary_shards"`
	ActiveShards                int          `json:"active_shards"`
	RelocatingShards            int          `json:"relocating_shards"`
	InitializingShards          int          `json:"initializing_shards"`
	UnassignedShards            int          `json:"unassigned_shards"`
	DelayedUnassignedShards     int          `json:"delayed_unassigned_shards"`
	NumberOfPendingTasks        int          `json:"number_of_pending_tasks"`
	NumberOfInFlightFetch       int          `json:"number_of_in_flight_fetch"`
	TaskMaxWaitingInQueueMillis int          `json:"task_max_waiting_in_queue_millis"`
	ActiveShardsPercentAsNumber float32      `json:"active_shards_percent_as_number"`
}

Health represents the response from _cluster/health

func (Health) String

func (h Health) String() string

type HealthString

type HealthString string

Health is the health of the cluster as returned by the health API.

const (
	RedHealth     HealthString = "red"
	YellowHealth  HealthString = "yellow"
	GreenHealth   HealthString = "green"
	UnknownHealth HealthString = "unknown"
)

Possible traffic light states Elasticsearch health can have.

type Hit

type Hit struct {
	Index  string                 `json:"_index"`
	Type   string                 `json:"_type"`
	ID     string                 `json:"_id"`
	Score  float64                `json:"_score"`
	Source map[string]interface{} `json:"_source"`
}

Hit represents a single search hit.

type Hits

type Hits struct {
	Total json.RawMessage // model when needed
	Hits  []Hit           `json:"hits"`
}

Hits are the collections of search hits.

type Info

type Info struct {
	ClusterName string `json:"cluster_name"`
	ClusterUUID string `json:"cluster_uuid"`
	Version     struct {
		Number string `json:"number"`
	} `json:"version"`
}

Info represents the response from /

type Node

type Node struct {
	Name    string   `json:"name"`
	Version string   `json:"version"`
	Roles   []string `json:"roles"`
	JVM     struct {
		StartTimeInMillis int64 `json:"start_time_in_millis"`
		Mem               struct {
			HeapMaxInBytes int `json:"heap_max_in_bytes"`
		} `json:"mem"`
	} `json:"jvm"`
}

Node partially models an Elasticsearch node retrieved from /_nodes

type NodeStats

type NodeStats struct {
	Name string `json:"name"`
	OS   struct {
		CGroup struct {
			Memory struct {
				LimitInBytes string `json:"limit_in_bytes"`
			} `json:"memory"`
		} `json:"cgroup"`
	} `json:"os"`
}

NodeStats partially models an Elasticsearch node retrieved from /_nodes/stats

type Nodes

type Nodes struct {
	Nodes map[string]Node `json:"nodes"`
}

Nodes partially models the response from a request to /_nodes

func (Nodes) Names

func (n Nodes) Names() []string

type NodesStats

type NodesStats struct {
	Nodes map[string]NodeStats `json:"nodes"`
}

NodesStats partially models the response from a request to /_nodes/stats

type RemoteCluster

type RemoteCluster struct {
	Seeds []string `json:"seeds"`
}

RemoteClusterSeeds is the set of seeds to use in a remote cluster setting.

type RemoteClusters

type RemoteClusters struct {
	RemoteClusters map[string]RemoteCluster `json:"remote,omitempty"`
}

RemoteClusters models the configuration of the remote clusters.

type RemoteClustersSettings

type RemoteClustersSettings struct {
	PersistentSettings *SettingsGroup `json:"persistent,omitempty"`
}

RemoteClustersSettings is used to build a request to update remote clusters.

type RoutingAllocationSettings

type RoutingAllocationSettings struct {
	Exclude AllocationExclude `json:"exclude,omitempty"`
	Enable  string            `json:"enable,omitempty"`
}

type RoutingSettings

type RoutingSettings struct {
	Allocation RoutingAllocationSettings `json:"allocation,omitempty"`
}

type RoutingTable

type RoutingTable struct {
	Indices map[string]Shards `json:"indices"`
}

type SearchResults

type SearchResults struct {
	Took   int
	Hits   Hits                       `json:"hits"`
	Shards json.RawMessage            // model when needed
	Aggs   map[string]json.RawMessage // model when needed
}

SearchResults are the results returned from a _search.

type SettingsGroup

type SettingsGroup struct {
	Cluster RemoteClusters `json:"cluster,omitempty"`
}

SettingsGroup is a group of persistent settings.

type Shard

type Shard struct {
	Index    string     `json:"index"`
	Shard    string     `json:"shard"`
	State    ShardState `json:"state"`
	NodeName string     `json:"node"`
	Type     ShardType  `json:"prirep"`
}

Shard partially models Elasticsearch cluster shard.

func (Shard) IsInitializing

func (s Shard) IsInitializing() bool

IsInitializing is true if the shard is currently initializing on the node.

func (Shard) IsPrimary

func (s Shard) IsPrimary() bool

IsPrimary is true if the shard is a primary shard.

func (Shard) IsRelocating

func (s Shard) IsRelocating() bool

IsRelocating is true if the shard is relocating to another node.

func (Shard) IsReplica

func (s Shard) IsReplica() bool

IsReplica is true if the shard is a replica.

func (Shard) IsStarted

func (s Shard) IsStarted() bool

IsStarted is true if the shard is started on its current node.

func (Shard) Key

func (s Shard) Key() string

Key is a composite key of index name and shard number that identifies all copies of a shard across nodes.

type ShardState

type ShardState string
const (
	STARTED      ShardState = "STARTED"
	INITIALIZING ShardState = "INITIALIZING"
	RELOCATING   ShardState = "RELOCATING"
	UNASSIGNED   ShardState = "UNASSIGNED"
)

These are possible shard states

type ShardType

type ShardType string
const (
	Primary ShardType = "p"
	Replica ShardType = "r"
)

type Shards

type Shards []Shard

Shards contains the shards in the Elasticsearch cluster

func (Shards) GetShardsByNode

func (s Shards) GetShardsByNode() map[string]Shards

GetShardsByNode returns shards by node. The result is a map with the name of the nodes as keys and the list of shards on the nodes as values.

func (*Shards) UnmarshalJSON

func (s *Shards) UnmarshalJSON(data []byte) error

Strip extra information from the nodeName field eg. "cluster-node-2 -> 10.56.2.33 8DqGuLtrSNyMfE2EfKNDgg" becomes "cluster-node-2" see https://github.com/elastic/cloud-on-k8s/issues/1796

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL