cluster

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 19 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// ClusterName is the single node cluster name reported to ES clients.
	ClusterName = "zedsearch"
)

Variables

This section is empty.

Functions

func CatHealth

func CatHealth(c zhttp.Context)

CatHealth reports the cluster health like the ES _cat/health API

@Id CatHealth @Summary Get cluster health for compatible ES @security BasicAuth @Tags Cluster @Produce plain @Param format query string false "Response format, json or text" @Param v query string false "Show the column header" @Success 200 {object} []elastic.CatHealthResponse @Router /es/_cat/health [get]

func CatIndices

func CatIndices(c zhttp.Context)

CatIndices lists the indexes like the ES _cat/indices API

@Id CatIndices @Summary List indexes for compatible ES @security BasicAuth @Tags Cluster @Produce plain @Param index path string false "Index" @Param format query string false "Response format, json or text" @Param v query string false "Show the column header" @Success 200 {object} []elastic.CatIndexResponse @Router /es/_cat/indices [get]

func Health

func Health(c zhttp.Context)

Health returns the health of the cluster

A single node is always green. In a cluster an index is red while no live node owns it and yellow while it is replicated to fewer nodes than `zed_cluster_replicas`; the cluster reports its worst index.

@Id ClusterHealth @Summary Get cluster health for compatible ES @security BasicAuth @Tags Cluster @Produce json @Param index path string false "Index" @Success 200 {object} elastic.ClusterHealthResponse @Router /es/_cluster/health [get]

func InternalIndexes

func InternalIndexes(c zhttp.Context)

InternalIndexes lists the indexes known to this node

Used to resolve index patterns and to debug ownership.

@Id InternalIndexes @Summary List indexes known to this node @security BasicAuth @Tags Cluster @Produce json @Success 200 {object} InternalIndexesResponse @Router /api/_internal/indexes [get]

func InternalSearch

func InternalSearch(c zhttp.Context)

InternalSearch runs a search over the indexes this node owns

It is the node-to-node half of a scatter-gather search: the coordinating node splits the requested indexes by owner and merges the responses. The caller's Authorization header is forwarded, so the same permissions apply.

@Id InternalSearch @Summary Search indexes owned by this node @security BasicAuth @Tags Cluster @Accept json @Produce json @Param query body InternalSearchRequest true "Query" @Success 200 {object} meta.SearchResponse @Failure 400 {object} meta.HTTPResponseError @Failure 404 {object} meta.HTTPResponseError @Failure 503 {object} meta.HTTPResponseError @Router /api/_internal/search [post]

func Nodes

func Nodes(c zhttp.Context)

Nodes lists the members of the cluster

With clustering disabled the local process is reported as the single node, so dashboards do not need a special case.

@Id ClusterNodes @Summary List cluster nodes @security BasicAuth @Tags Cluster @Produce json @Success 200 {object} NodesResponse @Router /api/cluster/nodes [get]

func Partitions

func Partitions(c zhttp.Context)

Partitions reports the index ownership map

With `index` set only the partition of that index is returned, which is the quickest way to find out which node serves it.

@Id ClusterPartitions @Summary Get partition ownership @security BasicAuth @Tags Cluster @Produce json @Param index query string false "Index" @Success 200 {object} PartitionsResponse @Router /api/cluster/partitions [get]

func ReplicationRecover

func ReplicationRecover(c zhttp.Context)

ReplicationRecover makes this replica copy an index from its owner.

func ReplicationReplicate

func ReplicationReplicate(c zhttp.Context)

ReplicationReplicate applies a batch of operations shipped by the owner. 409 carries the replica's position when it cannot apply the batch.

func ReplicationSnapshot

func ReplicationSnapshot(c zhttp.Context)

ReplicationSnapshot streams a file copy of an owned index as a tar. POST carries a replication.SnapshotRequest, GET (older nodes) the checkpoint in the query and no held files.

Types

type IndexOwner

type IndexOwner struct {
	Name        string `json:"name"`
	StorageType string `json:"storage_type"`
	Partition   int    `json:"partition"`
	Owner       string `json:"owner,omitempty"`
	Local       bool   `json:"local"`
}

IndexOwner is one entry of GET /api/_internal/indexes.

type InternalIndexesResponse

type InternalIndexesResponse struct {
	Node    string       `json:"node"`
	Indexes []IndexOwner `json:"indexes"`
}

InternalIndexesResponse is the payload of GET /api/_internal/indexes.

type InternalSearchRequest

type InternalSearchRequest struct {
	Indexes []string `json:"indexes"`
	// Replica asks for copies this node replicates: 404 unless it may serve them.
	Replica bool `json:"replica,omitempty"`
	// SortKeys adds the `_sort_key` the coordinator merges top_hits by.
	SortKeys bool           `json:"sort_keys,omitempty"`
	Query    *meta.ZedQuery `json:"query"`
}

InternalSearchRequest is what a coordinating node sends to every owner during a scatter-gather search.

type NodesResponse

type NodesResponse struct {
	ClusterName string               `json:"cluster_name"`
	Enabled     bool                 `json:"enabled"`
	Nodes       []cluster.NodeStatus `json:"nodes"`
}

NodesResponse is the payload of GET /api/cluster/nodes.

type PartitionOwner

type PartitionOwner struct {
	Partition int    `json:"partition"`
	Owner     string `json:"owner"`
	Epoch     int64  `json:"epoch"`
	Local     bool   `json:"local"`
	Index     string `json:"index,omitempty"`
	// Replicas are the nodes holding a warm read replica, used for cold indexes.
	Replicas []string `json:"replicas,omitempty"`
}

PartitionOwner describes who owns one partition.

type PartitionsResponse

type PartitionsResponse struct {
	Enabled    bool             `json:"enabled"`
	Partitions int              `json:"partitions"`
	Owners     []PartitionOwner `json:"owners"`
}

PartitionsResponse is the payload of GET /api/cluster/partitions.

Jump to

Keyboard shortcuts

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