es

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package es implements additional services that are missing from https://github.com/olivere/elastic .

Index

Constants

View Source
const (
	// ShardAllocExcludeSetting is the JSON path to the shard
	// allocation exclusions in the settings returned by
	// the Elasticsearch GET /_cluster/settings API.
	ShardAllocExcludeSetting = "cluster.routing.allocation.exclude"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CatShardsResponse

type CatShardsResponse []CatShardsResponseRow

CatShardsResponse is the outcome of CatShardsService.Do.

type CatShardsResponseRow

type CatShardsResponseRow struct {
	CompletionSize                 *string    `json:"completion.size"`                // size of completion
	Docs                           *int       `json:"docs,string"`                    // number of docs in shard
	FieldDataEvictions             *int       `json:"fielddata.evictions,string"`     // fielddata evictions
	FieldDataMemorySize            *string    `json:"fielddata.memory_size"`          // used fielddata cache
	FlushTotal                     *int       `json:"flush.total,string"`             // number of flushes
	FlushTotalTime                 *string    `json:"flush.total_time"`               // time spent in flush
	GetCurrent                     *int       `json:"get.current,string"`             // number of current get ops
	GetExistsTime                  *string    `json:"get.exists_time"`                // time spent in successful gets
	GetExistsTotal                 *int       `json:"get.exists_total,string"`        // number of successful gets
	GetMissingTime                 *string    `json:"get.missing_time"`               // time spent in failed gets
	GetMissingTotal                *int       `json:"get.missing_total,string"`       // number of failed gets
	GetTime                        *string    `json:"get.time"`                       // time spent in get
	GetTotal                       *int       `json:"get.total,string"`               // number of get ops
	ID                             *string    `json:"id"`                             // unique id of node where it lives
	Index                          string     `json:"index"`                          // index name
	IndexingDeleteCurrent          *int       `json:"indexing.delete_current,string"` // number of current deletions
	IndexingDeleteTotal            *int       `json:"indexing.delete_total,string"`   // number of delete ops
	IndexingDeleteTime             *string    `json:"indexing.delete_time"`           // time spent in deletions
	IndexingIndexCurrent           *int       `json:"indexing.index_current,string"`  // number of current indexing ops
	IndexingIndexFailed            *int       `json:"indexing.index_failed,string"`   // number of failed indexing ops
	IndexingIndexTime              *string    `json:"indexing.index_time"`            // time spent in indexing
	IndexingIndexTotal             *int       `json:"indexing.index_total,string"`    // number of indexing ops
	IP                             *string    `json:"ip"`                             // ip of node where it lives
	MergesCurrent                  *int       `json:"merges.current,string"`          // number of current merges
	MergesCurrentDocs              *int       `json:"merges.current_docs,string"`     // number of current merging docs
	MergesCurrentSize              *string    `json:"merges.current_size"`            // size of current merges
	MergesTotal                    *int       `json:"merges.total,string"`            // number of completed merge ops
	MergesTotalDocs                *int       `json:"merges.total_docs,string"`       // docs merged
	MergesTotalSize                *string    `json:"merges.total_size"`              // size merged
	MergesTotalTime                *string    `json:"merges.total_time"`              // time spent in merges
	Node                           *string    `json:"node"`                           // name of node where it lives
	PrimaryOrReplica               string     `json:"prirep"`                         // primary ("p") or replica ("r")
	QueryCacheEvictions            *int       `json:"query_cache.evictions,string"`   // query cache evictions
	QueryCacheMemorySize           *string    `json:"query_cache.memory_size"`        // used query cache
	RecoverySourceType             *string    `json:"recoverysource.type"`            // recovery source type
	RefreshListeners               *int       `json:"refresh.listeners,string"`       // number of pending refresh listeners
	RefreshTime                    *string    `json:"refresh.time"`                   // time spent in refreshes
	RefreshTotal                   *int       `json:"refresh.total,string"`           // total refreshes
	SearchFetchCurrent             *int       `json:"search.fetch_current,string"`    // current fetch phase ops
	SearchFetchTime                *string    `json:"search.fetch_time"`              // time spent in fetch phase
	SearchFetchTotal               *int       `json:"search.fetch_total,string"`      // total fetch ops
	SearchOpenContexts             *int       `json:"search.open_contexts,string"`    // open search contexts
	SearchQueryCurrent             *int       `json:"search.query_current,string"`    // current query phase ops
	SearchQueryTime                *string    `json:"search.query_time"`              // time spent in query phase
	SearchQueryTotal               *int       `json:"search.query_total,string"`      // total query phase ops
	SearchScrollCurrent            *int       `json:"search.scroll_current,string"`   // open scroll contexts
	SearchScrollTime               *string    `json:"search.scroll_time"`             // time scroll contexts held open
	SearchScrollTotal              *int       `json:"search.scroll_total,string"`     // completed scroll contexts
	SegmentsCount                  *int       `json:"segments.count,string"`          // number of segments
	SegmentsFixedBitsetMemory      *string    `json:"segments.fixed_bitset_memory"`   // memory used by fixed bit sets for nested object field types and type filters for types referred in _parent fields
	SegmentsIndexWriterMemory      *string    `json:"segments.index_writer_memory"`   // memory used by index writer
	SegmentsMemory                 *string    `json:"segments.memory"`                // memory used by segments
	SegmentsVersionMapMemory       *string    `json:"segments.version_map_memory"`    // memory used by version map
	SequenceNumberGlobalCheckpoint *string    `json:"seq_no.global_checkpoint"`       // global checkpoint
	SequenceNumberLocalCheckpoint  *string    `json:"seq_no.local_checkpoint"`        // local checkpoint
	SequenceNumberMax              *string    `json:"seq_no.max"`                     // max sequence number
	Shard                          string     `json:"shard"`                          // shard name
	State                          string     `json:"state"`                          // shard state
	Store                          *string    `json:"store"`                          // store size of shard (how much disk it uses)
	SyncID                         *string    `json:"sync_id"`                        // sync id
	UnassignedAt                   *time.Time `json:"unassigned.at"`                  // time shard became unassigned (UTC)
	UnassignedDeatils              *string    `json:"unassigned.details"`             // additional details as to why the shard became unassigned
	UnassignedFor                  *string    `json:"unassigned.for"`                 // time has been unassigned
	UnassignedReason               *string    `json:"unassigned.reason"`              // reason shard is unassigned (https://www.elastic.co/guide/en/elasticsearch/reference/7.0/cat-shards.html#reason-unassigned)
	WarmerCurrent                  *int       `json:"warmer.current,string"`          // current warmer ops
	WarmerTotal                    *int       `json:"warmer.total,string"`            // total warmer ops
	WarmerTotalTime                *string    `json:"warmer.total_time"`              // time spent in warmers
}

CatShardsResponseRow specifies the data returned for one shard of a CatShardsResponse. Notice that not all of these fields might be filled; that depends on the number of columns chose in the request (see CatShardsService.Columns).

type CatShardsService

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

CatShardsService returns the list of shards plus some additional information about them.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/cat-shards.html for details.

func NewCatShardsService

func NewCatShardsService(client *elastic.Client) *CatShardsService

NewCatShardsService creates a new CatShardsService.

func (*CatShardsService) Bytes

func (s *CatShardsService) Bytes(bytes string) *CatShardsService

Bytes represents the unit in which to display byte values. Valid values are: "b", "k", "m", or "g".

func (*CatShardsService) Columns

func (s *CatShardsService) Columns(columns ...string) *CatShardsService

Columns to return in the response. To get a list of all possible columns to return, run the following command in your terminal:

Example:

curl 'http://localhost:9200/_cat/shards?help'

Please use the long names for columns (i.e. `completion.size`) for JSON unmarshalling to work correctly. You can use Columns("*") to return all possible columns. That might take a little longer than the default set of columns.

func (*CatShardsService) Do

Do executes the operation.

func (*CatShardsService) Index

func (s *CatShardsService) Index(index string) *CatShardsService

Index limits the response to shards of this index pattern (by default all indices are returned).

func (*CatShardsService) Local

func (s *CatShardsService) Local(local bool) *CatShardsService

Local indicates to return local information, i.e. do not retrieve the state from master node (default: false).

func (*CatShardsService) MasterTimeout

func (s *CatShardsService) MasterTimeout(masterTimeout string) *CatShardsService

MasterTimeout is the explicit operation timeout for connection to master node.

func (*CatShardsService) Pretty

func (s *CatShardsService) Pretty(pretty bool) *CatShardsService

Pretty indicates that the JSON response be indented and human readable.

func (*CatShardsService) Sort

func (s *CatShardsService) Sort(fields ...string) *CatShardsService

Sort is a list of fields to sort by.

type ClusterDeleteVotingConfigExclusion

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

ClusterDeleteVotingConfigExclusion removes all voting configuration exclusions, allowing any node to return to the voting configuration in the future.

See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/voting-config-exclusions.html

func NewClusterDeleteVotingConfigExclusion

func NewClusterDeleteVotingConfigExclusion(c *elastic.Client) *ClusterDeleteVotingConfigExclusion

NewClusterDeleteVotingConfigExclusion returns a new ClusterDeleteVotingConfigExclusion.

func (*ClusterDeleteVotingConfigExclusion) Do

Do executes the operation.

func (*ClusterDeleteVotingConfigExclusion) Validate

Validate checks if the operation is valid.

func (*ClusterDeleteVotingConfigExclusion) Wait

Wait (if true) for all the nodes with voting configuration exclusions to be removed from the cluster, and then remove the exclusions.

type ClusterDeleteVotingConfigExclusionResponse

type ClusterDeleteVotingConfigExclusionResponse struct{}

ClusterDeleteVotingConfigExclusionResponse represents the response from ClusterDeleteVotingConfigExclusion.

type ClusterGetSettingsResponse

type ClusterGetSettingsResponse struct {
	Persistent *gjson.Result
	Transient  *gjson.Result
	Defaults   *gjson.Result
}

ClusterGetSettingsResponse represents the response from the Elasticsearch `GET /_cluster/settings` API.

type ClusterGetSettingsService

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

ClusterGetSettingsService gets the settings of an Elasticsearch cluster. I can't believe github.com/olivere/elastic doesn't have this but aparently not.

func NewClusterGetSettingsService

func NewClusterGetSettingsService(client *elastic.Client) *ClusterGetSettingsService

NewClusterGetSettingsService returns a new ClusterGetSettingsService.

func (*ClusterGetSettingsService) Defaults

Defaults indicates if Elasticsearch should include default settings values in the response.

func (*ClusterGetSettingsService) Do

Do executes the operation.

func (*ClusterGetSettingsService) FilterPath

func (s *ClusterGetSettingsService) FilterPath(filterPath ...string) *ClusterGetSettingsService

FilterPath allows reducing the response, a mechanism known as response filtering and described here: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/common-options.html#common-options-response-filtering.

func (*ClusterGetSettingsService) Human

Human indicates whether to return version and creation date values in human-readable format (default: false).

func (*ClusterGetSettingsService) Pretty

Pretty enables the caller to indent the JSON output.

func (*ClusterGetSettingsService) Validate

func (s *ClusterGetSettingsService) Validate() error

Validate checks if the operation is valid. Just cargo-culting from elastic here.

type ClusterPostVotingConfigExclusion

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

ClusterPostVotingConfigExclusion removes all voting configuration exclusions, allowing any node to return to the voting configuration in the future.

See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/voting-config-exclusions.html

func NewClusterPostVotingConfigExclusion

func NewClusterPostVotingConfigExclusion(c *elastic.Client) *ClusterPostVotingConfigExclusion

NewClusterPostVotingConfigExclusion returns a new ClusterPostVotingConfigExclusion.

func (*ClusterPostVotingConfigExclusion) Do

Do executes the operation.

func (*ClusterPostVotingConfigExclusion) Node

Node sets the node(s) that should be excluded from voting configuration.

func (*ClusterPostVotingConfigExclusion) Timeout

Timeout sets how long to wait for the system to auto-reconfigure the node out of the voting configuration. The default is 30 seconds.

func (*ClusterPostVotingConfigExclusion) Validate

Validate checks if the operation is valid.

type ClusterPostVotingConfigExclusionResponse

type ClusterPostVotingConfigExclusionResponse struct{}

ClusterPostVotingConfigExclusionResponse represents the response from ClusterPostVotingConfigExclusion.

type ClusterPutSettingsResponse

type ClusterPutSettingsResponse struct {
	// Persistent hold the Elasticsearch settings that persist between cluster restarts.
	Persistent *gjson.Result

	// Transient hold the Elasticsearch settings that do not persist between cluster restarts.
	Transient *gjson.Result
}

ClusterPutSettingsResponse represents the response from the Elasticsearch `PUT /_cluster/settings` API. It contains the new values of the changed settings.

type ClusterPutSettingsService

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

ClusterPutSettingsService updates the settings of an Elasticsearch cluster. I can't believe github.com/olivere/elastic doesn't have this but aparently not.

func NewClusterPutSettingsService

func NewClusterPutSettingsService(client *elastic.Client) *ClusterPutSettingsService

NewClusterPutSettingsService returns a new ClusterPutSettingsService.

func (*ClusterPutSettingsService) BodyJSON

func (s *ClusterPutSettingsService) BodyJSON(body interface{}) *ClusterPutSettingsService

BodyJSON is documented as: The index settings to be updated.

func (*ClusterPutSettingsService) BodyString

BodyString is documented as: The index settings to be updated.

func (*ClusterPutSettingsService) Do

Do executes the operation.

func (*ClusterPutSettingsService) FlatSettings

func (s *ClusterPutSettingsService) FlatSettings(flatSettings bool) *ClusterPutSettingsService

FlatSettings indicates whether to return settings in flat format (default: false).

func (*ClusterPutSettingsService) MasterTimeout

func (s *ClusterPutSettingsService) MasterTimeout(masterTimeout string) *ClusterPutSettingsService

MasterTimeout is the timeout for connection to master.

func (*ClusterPutSettingsService) Persistent

func (s *ClusterPutSettingsService) Persistent(setting string, value interface{}) *ClusterPutSettingsService

Persistent adds a persistent settings to the request.

func (*ClusterPutSettingsService) Pretty

Pretty indicates that the JSON response be indented and human readable.

func (*ClusterPutSettingsService) Transient

func (s *ClusterPutSettingsService) Transient(setting string, value interface{}) *ClusterPutSettingsService

Transient adds a transient settings to the request.

func (*ClusterPutSettingsService) Validate

func (s *ClusterPutSettingsService) Validate() error

Validate checks if the operation is valid.

type IndicesRecoveryResponse

type IndicesRecoveryResponse map[string]IndicesRecoveryResponseIndex

IndicesRecoveryResponse represents the response from IndicesRecoveryService. Keys are index names.

type IndicesRecoveryResponseIndex

type IndicesRecoveryResponseIndex struct {
	Shards []*IndicesRecoveryResponseShard `json:"shards"`
}

IndicesRecoveryResponseIndex represents the recovery of an index.

type IndicesRecoveryResponseShard

type IndicesRecoveryResponseShard struct {
	ID                int                                     `json:"id"`
	Type              string                                  `json:"type"`  // One of: "store", "snapshot", "replica", "relocating"
	Stage             string                                  `json:"stage"` // One of: "init", "index", "start", "translog", "finalize", "done"
	Primary           bool                                    `json:"primary"`
	StartTime         *time.Time                              `json:"start_time"`
	StartTimeInMillis int64                                   `json:"start_time_in_millis"`
	StopTime          *time.Time                              `json:"stop_time"`
	StopTimeInMillis  int64                                   `json:"stop_time_in_millis"`
	TotalTime         string                                  `json:"total_time"` // e.g. 2.1s
	TotalTimeInMillis int64                                   `json:"total_time_in_millis"`
	Source            map[string]interface{}                  `json:"source"`
	Target            IndicesRecoveryResponseShardTarget      `json:"target"`
	Index             IndicesRecoveryResponseShardIndex       `json:"index"`
	Translog          IndicesRecoveryResponseShardTranslog    `json:"translog"`
	VerifyIndex       IndicesRecoveryResponseShardVerifyIndex `json:"verify_index"`
}

IndicesRecoveryResponseShard represents the recovery of a shard within an index.

type IndicesRecoveryResponseShardIndex

type IndicesRecoveryResponseShardIndex struct {
	Size                       IndicesRecoveryResponseShardIndexSize  `json:"size"`
	Files                      IndicesRecoveryResponseShardIndexFiles `json:"files"`
	TotalTime                  string                                 `json:"total_time"` // e.g. 2.1s
	TotalTimeInMillis          int64                                  `json:"total_time_in_millis"`
	SourceThrottleTime         string                                 `json:"source_throttle_time"` // e.g. 2.1s
	SourceThrottleTimeInMillis int64                                  `json:"source_throttle_time_in_millis"`
	TargetThrottleTime         string                                 `json:"target_throttle_time"` // e.g. 2.1s
	TargetThrottleTimeInMillis int64                                  `json:"target_throttle_time_in_millis"`
}

IndicesRecoveryResponseShardIndex represents statistics about physical index recovery.

type IndicesRecoveryResponseShardIndexFiles

type IndicesRecoveryResponseShardIndexFiles struct {
	Total     int    `json:"total"`
	Reused    int    `json:"reused"`
	Recovered int64  `json:"recovered"`
	Percent   string `json:"percent"` // e.g. 100.0%
	Details   []struct {
		Name      string `json:"name"`
		Length    int64  `json:"length"`
		Recovered int64  `json:"recovered"`
	} `json:"details"`
}

IndicesRecoveryResponseShardIndexFiles represents info about the recovery of individual files within a shard.

type IndicesRecoveryResponseShardIndexSize

type IndicesRecoveryResponseShardIndexSize struct {
	Total            string `json:"total"` // e.g. 2.1gb
	TotalInBytes     int64  `json:"total_in_bytes"`
	Reused           string `json:"reused"` // e.g. 2.1gb
	ReusedInBytes    int64  `json:"reused_in_bytes"`
	Recovered        string `json:"recovered"` // e.g. 2.1gb
	RecoveredInBytes int64  `json:"recovered_in_bytes"`
	Percent          string `json:"percent"` // e.g. 100.0%
}

IndicesRecoveryResponseShardIndexSize represents the size of a recovering shard.

type IndicesRecoveryResponseShardTarget

type IndicesRecoveryResponseShardTarget struct {
	ID               string `json:"id"`
	Host             string `json:"host"`
	TransportAddress string `json:"transport_address"`
	IP               string `json:"ip"`
	Name             string `json:"name"`
}

IndicesRecoveryResponseShardTarget represents information about where a shard is being recovered to.

type IndicesRecoveryResponseShardTranslog

type IndicesRecoveryResponseShardTranslog struct {
	Recovered         int    `json:"recovered"`
	Total             int    `json:"total"`
	Percent           string `json:"percent"` // e.g. 100.0%
	TotalOnStart      int    `json:"total_on_start"`
	TotalTime         string `json:"total_time"` // e.g. 2.1s
	TotalTimeInMillis int64  `json:"total_time_in_millis"`
}

IndicesRecoveryResponseShardTranslog represents statistics about translog recovery.

type IndicesRecoveryResponseShardVerifyIndex

type IndicesRecoveryResponseShardVerifyIndex struct {
	CheckIndexTime         int    `json:"check_index_time"`
	CheckIndexTimeInMillis int64  `json:"check_index_time_in_millis"`
	TotalTime              string `json:"total_time"` // e.g. 2.1s
	TotalTimeInMillis      int64  `json:"total_time_in_millis"`
}

IndicesRecoveryResponseShardVerifyIndex represents the progress verifing an index recovery.

type IndicesRecoveryService

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

IndicesRecoveryService gets information about on-going and completed index shard recoveries.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/indices-recovery.html for details.

func NewIndicesRecoveryService

func NewIndicesRecoveryService(client *elastic.Client) *IndicesRecoveryService

NewIndicesRecoveryService returns a new IndicesRecoveryService.

func (*IndicesRecoveryService) ActiveOnly

func (s *IndicesRecoveryService) ActiveOnly(activeOnly bool) *IndicesRecoveryService

ActiveOnly limits the response to only on-going recoveries.

func (*IndicesRecoveryService) Detailed

func (s *IndicesRecoveryService) Detailed(detailed bool) *IndicesRecoveryService

Detailed returns extra detail with the response, such as a list of physical files in recovery

func (*IndicesRecoveryService) Do

Do executes the operation.

func (*IndicesRecoveryService) Index

Index limits the response to these indices. By default all indices are returned.

func (*IndicesRecoveryService) Validate

func (s *IndicesRecoveryService) Validate() error

Validate checks if the operation is valid.

type ShardAllocationExcludeSettings

type ShardAllocationExcludeSettings struct {
	Name, Host, IP []string
	Attr           map[string][]string
}

ShardAllocationExcludeSettings represents the shard allocation exclusion settings of an Elasticsearch cluster.

func NewShardAllocationExcludeSettings

func NewShardAllocationExcludeSettings(settings *gjson.Result) *ShardAllocationExcludeSettings

NewShardAllocationExcludeSettings creates a new shardAllocationExcludeSettings.

func (*ShardAllocationExcludeSettings) HasAttr

func (s *ShardAllocationExcludeSettings) HasAttr(attr, value string) bool

HasAttr returns true if the given attribute value is excluded.

func (*ShardAllocationExcludeSettings) HasHost

func (s *ShardAllocationExcludeSettings) HasHost(host string) bool

HasHost returns true if the given hostname is excluded.

func (*ShardAllocationExcludeSettings) HasIP

HasIP returns true if the given IP address is excluded.

func (*ShardAllocationExcludeSettings) HasName

func (s *ShardAllocationExcludeSettings) HasName(name string) bool

HasName returns true if the given node name is excluded.

func (*ShardAllocationExcludeSettings) Map

Jump to

Keyboard shortcuts

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