Documentation
¶
Overview ¶
Package es implements a simple Elasticsearch client.
Index ¶
- type Client
- func (es *Client) Get(url string) (int, []byte, error)
- func (es *Client) Post(url string, data []byte) (int, Result, *ErrorResponse, error)
- func (es *Client) PostObj(url string, dataObj interface{}) (int, Result, *ErrorResponse, error)
- func (es *Client) PostObjUnmarshal(url string, dataObj interface{}, retObj interface{}) (int, *ErrorResponse, error)
- func (es *Client) Put(url string, data []byte) (int, Result, *ErrorResponse, error)
- func (es *Client) PutObj(url string, dataObj interface{}) (int, Result, *ErrorResponse, error)
- func (es *Client) SendEsMapping(mapping IndexTemplate) (int, Result, *ErrorResponse, error)
- type Config
- type ErrorCause
- type ErrorResponse
- type HitsMeta
- type IndexTemplate
- type Obj
- type Result
- type SearchResults
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Config
}
Client
func CreateClient ¶
CreateClient returns an Elasticsearch client object
func (*Client) Get ¶
Get uses HTTP Get method to retrieve data from elasticsearch returns a byte array that may be used to unmarshal into a specific type depending on the returned code.
func (*Client) PostObjUnmarshal ¶
func (es *Client) PostObjUnmarshal(url string, dataObj interface{}, retObj interface{}) (int, *ErrorResponse, error)
PostObjUnmarshal Unmarshals results to retObj, likely a overridden es.SearchResults struct
func (*Client) SendEsMapping ¶
func (es *Client) SendEsMapping(mapping IndexTemplate) (int, Result, *ErrorResponse, error)
SendEsMapping
type ErrorCause ¶
type ErrorCause struct {
RootCause []ErrorCause `json:"root_cause"`
Type string `json:"type"`
Reason string `json:"reason"`
ResourceType string `json:"resource.type"`
ResourceId string `json:"resource.id"`
IndexUuid string `json:"index_uuid"`
Index string `json:"index"`
}
ErrorCause
type HitsMeta ¶
type HitsMeta struct {
Total int `json:"total"`
MaxScore float64 `json:"max_score"`
Hits []Result `json:"hits"`
}
HitsMeta
type Result ¶
type Result struct {
Index string `json:"_index"`
Type string `json:"_type"`
Id string `json:"_id"`
Version int `json:"_version"`
ResultType string `json:"result"`
Found bool `json:"found"`
Shards struct {
Total int `json:"total"`
Successful int `json:"successful"`
Failed int `json:"failed"`
} `json:"_shards"`
SeqNo int `json:"_seq_no"`
PrimaryTerm int `json:"_primary_term"`
Source map[string]interface{} `json:"_source"`
Error string `json:"error"`
Status int `json:"status"`
}
Result
type SearchResults ¶
type SearchResults struct {
Took int `json:"took"`
TimedOut bool `json:"timed_out"`
Shards struct {
Total int `json:"total"`
Successful int `json:"successful"`
Skipped int `json:"skipped"`
Failed int `json:"failed"`
} `json:"_shards"`
Hits HitsMeta `json:"hits"`
Error string `json:"error"`
Status int `json:"status"`
}
SearchResults
Click to show internal directories.
Click to hide internal directories.
