Documentation
¶
Index ¶
- Constants
- func CatHealth(c zhttp.Context)
- func CatIndices(c zhttp.Context)
- func Health(c zhttp.Context)
- func InternalIndexes(c zhttp.Context)
- func InternalSearch(c zhttp.Context)
- func Nodes(c zhttp.Context)
- func Partitions(c zhttp.Context)
- func ReplicationRecover(c zhttp.Context)
- func ReplicationReplicate(c zhttp.Context)
- func ReplicationSnapshot(c zhttp.Context)
- type IndexOwner
- type InternalIndexesResponse
- type InternalSearchRequest
- type NodesResponse
- type PartitionOwner
- type PartitionsResponse
Constants ¶
const (
// ClusterName is the single node cluster name reported to ES clients.
ClusterName = "zedsearch"
)
Variables ¶
This section is empty.
Functions ¶
func CatHealth ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
ReplicationRecover makes this replica copy an index from its owner.
func ReplicationReplicate ¶
ReplicationReplicate applies a batch of operations shipped by the owner. 409 carries the replica's position when it cannot apply the batch.
func ReplicationSnapshot ¶
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.