api

package
v0.0.0-...-054c023 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2014 License: Apache-2.0 Imports: 14 Imported by: 6

Documentation

Index

Constants

View Source
const (
	Version         = "0.0.2"
	DefaultProtocol = "http"
	DefaultDomain   = "localhost"
	DefaultPort     = "9200"
	// A decay duration of zero results in the default behaviour
	DefaultDecayDuration = 0
)

Variables

View Source
var (

	// Maintain these for backwards compatibility
	Protocol       string    = DefaultProtocol
	Domain         string    = DefaultDomain
	ClusterDomains [1]string = [1]string{DefaultDomain}
	Port           string    = DefaultPort
	Username       string
	Password       string
	// Store a slice of hosts in a hostpool
	Hosts []string

	// To compute the weighting scores, we perform a weighted average of recent response times,
	// over the course of `DecayDuration`. DecayDuration may be set to 0 to use the default
	// value of 5 minutes. The EpsilonValueCalculator uses this to calculate a score
	// from the weighted average response time.
	DecayDuration time.Duration = time.Duration(DefaultDecayDuration * time.Second)
)

Functions

func DoCommand

func DoCommand(method string, url string, args map[string]interface{}, data interface{}) ([]byte, error)

func QueryString

func QueryString(args map[string]interface{}) (s string, err error)

func Scroll

func Scroll(duration string) string

func SetHosts

func SetHosts(newhosts []string)

Types

type BaseResponse

type BaseResponse struct {
	Ok      bool        `json:"ok"`
	Index   string      `json:"_index,omitempty"`
	Type    string      `json:"_type,omitempty"`
	Id      string      `json:"_id,omitempty"`
	Source  interface{} `json:"_source,omitempty"` // depends on the schema you've defined
	Version int         `json:"_version,omitempty"`
	Found   bool        `json:"found,omitempty"`
	Exists  bool        `json:"exists,omitempty"`
	Matches []string    `json:"matches,omitempty"` // percolate matches
}

func Exists

func Exists(index string, _type string, id string, args map[string]interface{}) (BaseResponse, error)

Exists allows the caller to check for the existance of a document using HEAD This appears to be broken in the current version of elasticsearch 0.19.10, currently returning nothing

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 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"`
}

type ClusterStateMetadataResponse

type ClusterStateMetadataResponse struct {
}

type ClusterStateNodeReponse

type ClusterStateNodeReponse struct {
	Name             string `json:"name"`
	TransportAddress string `json:"transport_address"`
}

type ClusterStateResponse

type ClusterStateResponse struct {
	ClusterName string                             `json:"cluster_name"`
	MasterNode  string                             `json:"master_node"`
	Nodes       map[string]ClusterStateNodeReponse `json:"nodes"`
}

type ClusterStateRoutingTableResponse

type ClusterStateRoutingTableResponse struct {
}

type ESError

type ESError struct {
	When time.Time
	What string
	Code int
}

ESError is an error implementation that includes a time, message, and code.

func (ESError) Error

func (e ESError) Error() string

type Explanation

type Explanation struct {
	Value       float32       `json:"value"`
	Description string        `json:"description"`
	Details     []Explanation `json:"details,omitempty"`
}

type ExtendedStatus

type ExtendedStatus struct {
	Ok           bool   `json:"ok"`
	ShardsStatus Status `json:"_shards"`
}

type Facets

type Facets struct {
	Tag Terms `json:"tag"`
}

type Filter

type Filter struct {
	Term Term `json:"term"`
}

type Match

type Match struct {
	OK          bool        `json:"ok"`
	Matches     []string    `json:"matches"`
	Explanation Explanation `json:"explanation,omitempty"`
}

type NodeStatsFSDataResponse

type NodeStatsFSDataResponse struct {
	Path          string `json:"path"`
	Mount         string `json:"mount"`
	Device        string `json:"dev"`
	Total         int64  `json:"total_in_bytes"`
	Free          int64  `json:"free_in_bytes"`
	Available     int64  `json:"available_in_bytes"`
	DiskReads     int64  `json:"disk_reads"`
	DiskWrites    int64  `json:"disk_writes"`
	DiskReadSize  int64  `json:"disk_read_size_in_bytes"`
	DiskWriteSize int64  `json:"disk_write_size_in_bytes"`
}

type NodeStatsFSResponse

type NodeStatsFSResponse struct {
	Timestamp int64                              `json:"timestamp"`
	Data      map[string]NodeStatsFSDataResponse `json:"data"`
}

type NodeStatsHTTPResponse

type NodeStatsHTTPResponse struct {
	CurrentOpen int64 `json:"current_open"`
	TotalOpen   int64 `json:"total_open"`
}

type NodeStatsIndicesDocsResponse

type NodeStatsIndicesDocsResponse struct {
	Count   int64 `json:"count"`
	Deleted int64 `json:"deleted"`
}

type NodeStatsIndicesGetResponse

type NodeStatsIndicesGetResponse struct {
	Total        int64 `json:"total"`
	Time         int64 `json:"time_in_millis"`
	ExistsTotal  int64 `json:"exists_total"`
	ExistsTime   int64 `json:"exists_time_in_millis"`
	MissingTotal int64 `json:"missing_total"`
	MissingTime  int64 `json:"missing_time_in_millis"`
	Current      int64 `json:"current"`
}

type NodeStatsIndicesIndexingResponse

type NodeStatsIndicesIndexingResponse struct {
	IndexTotal    int64 `json:"index_total"`
	IndexTime     int64 `json:"index_time_in_millis"`
	IndexCurrent  int64 `json:"index_current"`
	DeleteTotal   int64 `json:"delete_total"`
	DeleteTime    int64 `json:"delete_time_in_millis"`
	DeleteCurrent int64 `json:"delete_current"`
}

type NodeStatsIndicesSearchResponse

type NodeStatsIndicesSearchResponse struct {
	OpenContext  int64 `json:"open_contexts"`
	QueryTotal   int64 `json:"query_total"`
	QueryTime    int64 `json:"query_time_in_millis"`
	QueryCurrent int64 `json:"query_current"`
	FetchTotal   int64 `json:"fetch_total"`
	FetchTime    int64 `json:"fetch_time_in_millis"`
	FetchCurrent int64 `json:"fetch_current"`
}

type NodeStatsIndicesStoreResponse

type NodeStatsIndicesStoreResponse struct {
	Size         int64 `json:"size_in_bytes"`
	ThrottleTime int64 `json:"throttle_time_in_millis"`
}

type NodeStatsNetworkResponse

type NodeStatsNetworkResponse struct {
	TCP NodeStatsTCPResponse `json:"tcp"`
}

type NodeStatsNodeResponse

type NodeStatsNodeResponse struct {
	Name             string                                     `json:"name"`
	Timestamp        int64                                      `json:"timestamp"`
	TransportAddress string                                     `json:"transport_address"`
	Hostname         string                                     `json:"hostname"`
	Indices          NodeStatsIndicesResponse                   `json:"indices"`
	OS               NodeStatsOSResponse                        `json:"os"`
	Network          NodeStatsNetworkResponse                   `json:"network"`
	ThreadPool       map[string]NodeStatsThreadPoolPoolResponse `json:"thread_pool"`
}

type NodeStatsOSCPUResponse

type NodeStatsOSCPUResponse struct {
	Sys   int64 `json:"sys"`
	User  int64 `json:"user"`
	Idle  int64 `json:"idle"`
	Steal int64 `json:"stolen"`
}

type NodeStatsOSMemResponse

type NodeStatsOSMemResponse struct {
	Free       int64 `json:"free_in_bytes"`
	Used       int64 `json:"used_in_bytes"`
	ActualFree int64 `json:"actual_free_in_bytes"`
	ActualUsed int64 `json:"actual_used_in_bytes"`
}

type NodeStatsOSResponse

type NodeStatsOSResponse struct {
	Timestamp int64                   `json:"timestamp"`
	Uptime    int64                   `json:"uptime_in_millis"`
	LoadAvg   []float64               `json:"load_average"`
	CPU       NodeStatsOSCPUResponse  `json:"cpu"`
	Mem       NodeStatsOSMemResponse  `json:"mem"`
	Swap      NodeStatsOSSwapResponse `json:"swap"`
}

type NodeStatsOSSwapResponse

type NodeStatsOSSwapResponse struct {
	Used int64 `json:"used_in_bytes"`
	Free int64 `json:"free_in_bytes"`
}

type NodeStatsProcessCPUResponse

type NodeStatsProcessCPUResponse struct {
	Percent int64 `json:"percent"`
	Sys     int64 `json:"sys_in_millis"`
	User    int64 `json:"user_in_millis"`
	Total   int64 `json:"total_in_millis"`
}

type NodeStatsProcessMemResponse

type NodeStatsProcessMemResponse struct {
	Resident     int64 `json:"resident_in_bytes"`
	Share        int64 `json:"share_in_bytes"`
	TotalVirtual int64 `json:"total_virtual_in_bytes"`
}

type NodeStatsProcessResponse

type NodeStatsProcessResponse struct {
	Timestamp int64                       `json:"timestamp"`
	OpenFD    int64                       `json:"open_file_descriptors"`
	CPU       NodeStatsProcessCPUResponse `json:"cpu"`
	Memory    NodeStatsProcessMemResponse `json:"mem"`
}

type NodeStatsReponse

type NodeStatsReponse struct {
	ClusterName string `json:"cluster_name"`
	Nodes       map[string]NodeStatsNodeResponse
}

type NodeStatsTCPResponse

type NodeStatsTCPResponse struct {
	ActiveOpens  int64 `json:"active_opens"`
	PassiveOpens int64 `json:"passive_opens"`
	CurrEstab    int64 `json:"curr_estab"`
	InSegs       int64 `json:"in_segs"`
	OutSegs      int64 `json:"out_segs"`
	RetransSegs  int64 `json:"retrans_segs"`
	EstabResets  int64 `json:"estab_resets"`
	AttemptFails int64 `json:"attempt_fails"`
	InErrs       int64 `json:"in_errs"`
	OutRsts      int64 `json:"out_rsts"`
}

type NodeStatsThreadPoolPoolResponse

type NodeStatsThreadPoolPoolResponse struct {
	Threads   int64 `json:"threads"`
	Queue     int64 `json:"queue"`
	Active    int64 `json:"active"`
	Rejected  int64 `json:"rejected"`
	Largest   int64 `json:"largest"`
	Completed int64 `json:"completed"`
}

type NodeStatsTransportResponse

type NodeStatsTransportResponse struct {
	ServerOpen int64 `json:"server_open"`
	RxCount    int64 `json:"rx_count"`
	RxSize     int64 `json:"rx_size_in_bytes"`
	TxCount    int64 `json:"tx_count"`
	TxSize     int64 `json:"tx_size_in_bytes"`
}

type Query

type Query struct {
	Query Term `json:"query"`
}

type Request

type Request struct {
	*http.Request
	// contains filtered or unexported fields
}

func ElasticSearchRequest

func ElasticSearchRequest(method, path, query string) (*Request, error)

func (*Request) Do

func (r *Request) Do(v interface{}) (int, []byte, error)

func (*Request) DoResponse

func (r *Request) DoResponse(v interface{}) (*http.Response, []byte, error)

func (*Request) SetBody

func (r *Request) SetBody(body io.Reader)

func (*Request) SetBodyBytes

func (r *Request) SetBodyBytes(body []byte)

func (*Request) SetBodyJson

func (r *Request) SetBodyJson(data interface{}) error

func (*Request) SetBodyString

func (r *Request) SetBodyString(body string)

type SearchRequest

type SearchRequest struct {
	From   int    `json:"from,omitempty"`
	Size   int    `json:"size,omitempty"`
	Query  Query  `json:"query,omitempty"`
	Filter Filter `json:"filter,omitempty"`
}

type Status

type Status struct {
	Total      int `json:"total"`
	Successful int `json:"successful"`
	Failed     int `json:"failed"`
}

type Term

type Term struct {
	Term string `json:"term"`
}

type Terms

type Terms struct {
	Terms string `json:"terms"`
}

Jump to

Keyboard shortcuts

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