elastic

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 11 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

Overview

Package elastic holds the ElasticSearch specific meta declarations and util functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDataStream

func GetDataStream(c zhttp.Context)

func MatchAnyPattern

func MatchAnyPattern(name string, patterns []string) bool

MatchAnyPattern reports whether name matches at least one of the patterns. An empty pattern list matches everything.

func MatchPattern

func MatchPattern(name, pattern string) bool

MatchPattern reports whether name matches the glob pattern. An empty pattern matches everything, an invalid pattern falls back to an exact comparison.

func PutDataStream

func PutDataStream(c zhttp.Context)

func SplitPatterns

func SplitPatterns(s string) []string

SplitPatterns splits a comma separated list of patterns, dropping empty ones.

Types

type CatHealthResponse

type CatHealthResponse struct {
	Epoch               string `json:"epoch"`
	Timestamp           string `json:"timestamp"`
	Cluster             string `json:"cluster"`
	Status              string `json:"status"`
	NodeTotal           string `json:"node.total"`
	NodeData            string `json:"node.data"`
	Shards              string `json:"shards"`
	Pri                 string `json:"pri"`
	Relo                string `json:"relo"`
	Init                string `json:"init"`
	Unassign            string `json:"unassign"`
	PendingTasks        string `json:"pending_tasks"`
	MaxTaskWaitTime     string `json:"max_task_wait_time"`
	ActiveShardsPercent string `json:"active_shards_percent"`
}

CatHealthResponse is one row of the ES compatible _cat/health API.

type CatIndexResponse

type CatIndexResponse struct {
	Health       string `json:"health"`
	Status       string `json:"status"`
	Index        string `json:"index"`
	UUID         string `json:"uuid"`
	Pri          string `json:"pri"`
	Rep          string `json:"rep"`
	DocsCount    string `json:"docs.count"`
	DocsDeleted  string `json:"docs.deleted"`
	StoreSize    string `json:"store.size"`
	PriStoreSize string `json:"pri.store.size"`
}

CatIndexResponse is one row of the ES compatible _cat/indices API. All values are strings, like elasticsearch renders them.

type ClusterHealthResponse

type ClusterHealthResponse struct {
	ClusterName                 string  `json:"cluster_name"`
	Status                      string  `json:"status"`
	TimedOut                    bool    `json:"timed_out"`
	NumberOfNodes               int     `json:"number_of_nodes"`
	NumberOfDataNodes           int     `json:"number_of_data_nodes"`
	ActivePrimaryShards         int64   `json:"active_primary_shards"`
	ActiveShards                int64   `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 float64 `json:"active_shards_percent_as_number"`
}

ClusterHealthResponse is the response of the ES compatible _cluster/health API. ZedSearch is single node, so the cluster is always green with one node.

type CountResponse

type CountResponse struct {
	Count  int64       `json:"count"`
	Shards meta.Shards `json:"_shards"`
}

CountResponse is the response of the ES compatible _count API.

type ESInfo

type ESInfo struct {
	Name        string        `json:"name"`
	ClusterName string        `json:"cluster_name"`
	ClusterUUID string        `json:"cluster_uuid"`
	Version     ESInfoVersion `json:"version"`
	Tagline     string        `json:"tagline"`
}

func NewESInfo

func NewESInfo(c zhttp.Context) *ESInfo

type ESInfoVersion

type ESInfoVersion struct {
	Number                    string `json:"number"`
	BuildFlavor               string `json:"build_flavor"`
	BuildHash                 string `json:"build_hash"`
	BuildDate                 string `json:"build_date"`
	BuildSnapshot             bool   `json:"build_snapshot"`
	LuceneVersion             string `json:"lucene_version"`
	MinimumWireVersion        string `json:"minimum_wire_version"`
	MinimumIndexCompatibility string `json:"minimum_index_compatibility"`
}

type ESLicense

type ESLicense struct {
	Status string `json:"status"`
}

func NewESLicense

func NewESLicense(_ zhttp.Context) *ESLicense

type ESXPack

type ESXPack struct {
	Build    map[string]bool `json:"build"`
	Features map[string]bool `json:"features"`
	License  ESLicense       `json:"license"`
}

func NewESXPack

func NewESXPack(_ zhttp.Context) *ESXPack

type FieldCap

type FieldCap struct {
	Type          string `json:"type"`
	MetadataField bool   `json:"metadata_field"`
	Searchable    bool   `json:"searchable"`
	Aggregatable  bool   `json:"aggregatable"`
}

FieldCap holds the capabilities of a single field for one field type.

type FieldCapsResponse

type FieldCapsResponse struct {
	Indices []string                       `json:"indices"`
	Fields  map[string]map[string]FieldCap `json:"fields"`
}

FieldCapsResponse is the response of the ES compatible _field_caps API.

type Mappings

type Mappings struct {

	// Properties holds the index properties.
	Properties map[string]Property `json:"properties,omitempty"`
	// contains filtered or unexported fields
}

Mappings holds the index mappings.

func NewMappings

func NewMappings() *Mappings

NewMappings returns a initialized Mappings object.

func (*Mappings) GetProperty

func (t *Mappings) GetProperty(field string) (Property, bool)

GetProperty returns the property by its field name. This function is concurrent safe.

func (*Mappings) Len

func (t *Mappings) Len() int

Len returns the number of properties stored. This function is concurrent safe.

func (*Mappings) ListProperty

func (t *Mappings) ListProperty() map[string]Property

ListProperty returns all properties of the mapping. This function is concurrent safe.

func (*Mappings) MarshalJSON

func (t *Mappings) MarshalJSON() ([]byte, error)

MarshalJSON overwrites the default marshaler. This function is concurrent safe.

func (*Mappings) SetProperty

func (t *Mappings) SetProperty(field string, prop Property)

SetProperty sets/ adds the given property to the mapping. This function is concurrent safe.

type Property

type Property struct {
	// Type holds the field type.
	// The type field may be empty, i.e., if the field represents an object.
	Type string `json:"type,omitempty"`
	// Properties holds the sub-properties of this property.
	Properties map[string]Property `json:"properties,omitempty"`
	// Fields the same string value to be indexed in multiple ways for different purposes,
	// such as one field for search and a multi-field for sorting and aggregations,
	// or the same string value analyzed by different analyzers.
	Fields map[string]Property `json:"fields,omitempty"`
	// IgnoreAbove prevents indexing of strings longer than the configured value.
	// TODO: Should this be supported by Zed?
	IgnoreAbove    uint   `json:"ignore_above,omitempty"`
	Analyzer       string `json:"analyzer,omitempty"`
	SearchAnalyzer string `json:"search_analyzer,omitempty"`
	// Format holds the property format.
	Format string `json:"format,omitempty"`
}

Property holds the property of a single field.

func NewProperty

func NewProperty(typ string) Property

NewProperty returns a new Property object.

type ReindexResponse

type ReindexResponse struct {
	Took                 int64                    `json:"took"`
	TimedOut             bool                     `json:"timed_out"`
	Total                int                      `json:"total"`
	Created              int                      `json:"created"`
	Updated              int                      `json:"updated"`
	Deleted              int                      `json:"deleted"`
	Batches              int                      `json:"batches"`
	VersionConflicts     int                      `json:"version_conflicts"`
	Noops                int                      `json:"noops"`
	Retries              meta.HttpRetriesResponse `json:"retries"`
	ThrottledMillis      int                      `json:"throttled_millis"`
	RequestsPerSecond    int                      `json:"requests_per_second"`
	ThrottledUntilMillis int                      `json:"throttled_until_millis"`
	Failures             []string                 `json:"failures"`
}

ReindexResponse is the response of the ES compatible _reindex API.

Jump to

Keyboard shortcuts

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