api

package
v0.0.0-...-56f2276 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	Version         = "0.0.2"
	DefaultProtocol = "http"
	DefaultDomain   = "localhost"
	DefaultPort     = "9200"
)

Variables

View Source
var (
	Protocol       string    = DefaultProtocol
	Domain         string    = DefaultDomain
	ClusterDomains [1]string = [1]string{DefaultDomain}
	Port           string    = DefaultPort
	HttpClient               = &http.Client{}
)

Functions

func DoCommand

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

func Pretty

func Pretty(pretty bool) string

func Scan

func Scan(scan int) string

func Scroll

func Scroll(duration string) 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"`
}

func Exists

func Exists(pretty bool, index string, _type string, id string) (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 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 Explaination

type Explaination struct {
	Value       float32        `json:"value"`
	Description string         `json:"description"`
	Details     []Explaination `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"`
	Explaination Explaination `json:"explaination,omitempty"`
}

type Query

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

type Request

type Request http.Request

func ElasticSearchRequest

func ElasticSearchRequest(method, path 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) 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