Documentation
¶
Index ¶
- Constants
- Variables
- func NewJson(fn ObjectFunc) *bytes.Buffer
- func NewJsonString(s string) *bytes.Buffer
- type Aggregations
- type Client
- func (c *Client) Count() *CountReq
- func (c *Client) CreateIndex(index string) *CreateIndexReq
- func (c *Client) CreateMapping(index, ty string) *CreateMappingReq
- func (c *Client) Debug(debug bool)
- func (c *Client) Delete(index string) *DeleteReq
- func (c *Client) DeleteMapping(index, ty string) *DeleteMappingReq
- func (c *Client) ExistIndex(index string) *ExistIndexReq
- func (c *Client) GetMapping(index, ty string) *GetMappingReq
- func (c *Client) Index(index string) *IndexReq
- func (c *Client) Pretty(pretty bool)
- func (c *Client) Request(method, path string, query *Query, body *bytes.Buffer) (*http.Response, error)
- func (c *Client) Search() *SearchReq
- func (c *Client) Update(index, ty string) *UpdateReq
- func (c *Client) UpdatePartial(index, ty, id string) *UpdatePartialReq
- type CountReq
- type CountResp
- type CreateIndexReq
- type CreateIndexResp
- type CreateMappingReq
- type CreateMappingResp
- type DeleteMappingReq
- type DeleteMappingResp
- type DeleteReq
- type DeleteResp
- type ErrorResp
- type ExistIndexReq
- type GetMappingReq
- type IndexReq
- type IndexResp
- type Json
- func (j *Json) AF(key string, prec int, vals ...float64)
- func (j *Json) AI(key string, vals ...int)
- func (j *Json) AO(key string, fns ...ObjectFunc)
- func (j *Json) AS(key string, vals ...string)
- func (j *Json) B(key string, val bool)
- func (j *Json) F(key string, val float64, prec int)
- func (j *Json) I(key string, val int)
- func (j *Json) O(key string, fn ObjectFunc)
- func (j *Json) S(key, val string)
- type ObjectFunc
- type Query
- type SearchExplanation
- type SearchFacet
- type SearchFacetEntry
- type SearchFacetRange
- type SearchFacetTerm
- type SearchFacets
- type SearchHit
- type SearchHitHighlight
- type SearchHits
- type SearchReq
- func (req *SearchReq) Analyzer(a string) *SearchReq
- func (req *SearchReq) Body(body *bytes.Buffer) *SearchReq
- func (req *SearchReq) Do() (*SearchResp, error)
- func (req *SearchReq) Index(index string) *SearchReq
- func (req *SearchReq) Source(s string) *SearchReq
- func (req *SearchReq) Type(ty string) *SearchReq
- type SearchResp
- type SearchSuggest
- type SearchSuggestion
- type SearchSuggestionOption
- type UpdatePartialReq
- type UpdatePartialResp
- type UpdateReq
- type UpdateResp
Constants ¶
View Source
const ( GET = "GET" POST = "POST" PUT = "PUT" DELETE = "DELETE" HEAD = "HEAD" )
Variables ¶
View Source
var (
ErrUnableConnect = errors2.NewInternal("unable to connect elastic search")
)
Functions ¶
func NewJson ¶
func NewJson(fn ObjectFunc) *bytes.Buffer
func NewJsonString ¶
Types ¶
type Aggregations ¶
type Aggregations map[string]*json.RawMessage
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateIndex ¶
func (c *Client) CreateIndex(index string) *CreateIndexReq
func (*Client) CreateMapping ¶
func (c *Client) CreateMapping(index, ty string) *CreateMappingReq
func (*Client) DeleteMapping ¶
func (c *Client) DeleteMapping(index, ty string) *DeleteMappingReq
func (*Client) ExistIndex ¶
func (c *Client) ExistIndex(index string) *ExistIndexReq
func (*Client) GetMapping ¶
func (c *Client) GetMapping(index, ty string) *GetMappingReq
func (*Client) UpdatePartial ¶
func (c *Client) UpdatePartial(index, ty, id string) *UpdatePartialReq
type CreateIndexReq ¶
type CreateIndexReq struct {
// contains filtered or unexported fields
}
func NewCreateIndex ¶
func NewCreateIndex(client *Client, index string) *CreateIndexReq
func (*CreateIndexReq) Body ¶
func (req *CreateIndexReq) Body(body *bytes.Buffer) *CreateIndexReq
func (*CreateIndexReq) Do ¶
func (req *CreateIndexReq) Do() (*CreateIndexResp, error)
type CreateIndexResp ¶
type CreateIndexResp struct {
Acknowledged bool `json:"acknowledged"`
}
type CreateMappingReq ¶
type CreateMappingReq struct {
// contains filtered or unexported fields
}
func NewCreateMapping ¶
func NewCreateMapping(client *Client, index, ty string) *CreateMappingReq
func (*CreateMappingReq) Body ¶
func (req *CreateMappingReq) Body(body *bytes.Buffer) *CreateMappingReq
func (*CreateMappingReq) Do ¶
func (req *CreateMappingReq) Do() (*CreateMappingResp, error)
type CreateMappingResp ¶
type CreateMappingResp struct {
Acknowledged bool `json:"acknowledged"`
}
type DeleteMappingReq ¶
type DeleteMappingReq struct {
// contains filtered or unexported fields
}
func NewDeleteMapping ¶
func NewDeleteMapping(client *Client, index, ty string) *DeleteMappingReq
func (*DeleteMappingReq) Do ¶
func (req *DeleteMappingReq) Do() (*DeleteMappingResp, error)
type DeleteMappingResp ¶
type DeleteMappingResp struct {
Acknowledged bool `json:"acknowledged"`
}
type DeleteReq ¶
type DeleteReq struct {
// contains filtered or unexported fields
}
func (*DeleteReq) Do ¶
func (req *DeleteReq) Do() (*DeleteResp, error)
type DeleteResp ¶
type DeleteResp struct {
Acknowledged bool `json:"acknowledged"`
}
type ExistIndexReq ¶
type ExistIndexReq struct {
// contains filtered or unexported fields
}
func NewExistIndex ¶
func NewExistIndex(client *Client, index string) *ExistIndexReq
func (*ExistIndexReq) Do ¶
func (req *ExistIndexReq) Do() (bool, error)
func (*ExistIndexReq) Type ¶
func (req *ExistIndexReq) Type(ty string) *ExistIndexReq
type GetMappingReq ¶
type GetMappingReq struct {
// contains filtered or unexported fields
}
func NewGetMapping ¶
func NewGetMapping(client *Client, index, ty string) *GetMappingReq
func (*GetMappingReq) Do ¶
func (req *GetMappingReq) Do() (map[string]interface{}, error)
type Json ¶
type Json struct {
// contains filtered or unexported fields
}
func (*Json) AO ¶
func (j *Json) AO(key string, fns ...ObjectFunc)
func (*Json) O ¶
func (j *Json) O(key string, fn ObjectFunc)
type ObjectFunc ¶
type ObjectFunc func(j *Json)
type SearchExplanation ¶
type SearchExplanation struct {
Value float64 `json:"value"` // e.g. 1.0
Description string `json:"description"` // e.g. "boost" or "ConstantScore(*:*), product of:"
Details []*SearchExplanation `json:"details,omitempty"` // recursive details
}
type SearchFacet ¶
type SearchFacet struct {
Type string `json:"_type"`
Missing int `json:"missing"`
Total int `json:"total"`
Other int `json:"other"`
Terms []*SearchFacetTerm `json:"terms"`
Ranges []*SearchFacetRange `json:"ranges"`
Entries []*SearchFacetEntry `json:"entries"`
}
type SearchFacetEntry ¶
type SearchFacetEntry struct {
// Key for this facet, e.g. in histograms
Key interface{} `json:"key"`
// Date histograms contain the number of milliseconds as date:
// If e.Time = 1293840000000, then: Time.at(1293840000000/1000) => 2011-01-01
Time int64 `json:"time"`
// Number of hits for this facet
Count int `json:"count"`
// Min is either a string like "Infinity" or a float64.
// This is returned with some DateHistogram facets.
Min interface{} `json:"min,omitempty"`
// Max is either a string like "-Infinity" or a float64
// This is returned with some DateHistogram facets.
Max interface{} `json:"max,omitempty"`
// Total is the sum of all entries on the recorded Time
// This is returned with some DateHistogram facets.
Total float64 `json:"total,omitempty"`
// TotalCount is the number of entries for Total
// This is returned with some DateHistogram facets.
TotalCount int `json:"total_count,omitempty"`
// Mean is the mean value
// This is returned with some DateHistogram facets.
Mean float64 `json:"mean,omitempty"`
}
type SearchFacetRange ¶
type SearchFacetRange struct {
From float64 `json:"from"`
FromStr string `json:"from_str"`
To float64 `json:"to"`
ToStr string `json:"to_str"`
Count int `json:"count"`
Min float64 `json:"min"`
Max float64 `json:"max"`
TotalCount int `json:"total_count"`
Total float64 `json:"total"`
Mean float64 `json:"mean"`
}
type SearchFacetTerm ¶
type SearchFacets ¶
type SearchFacets map[string]*SearchFacet
type SearchHit ¶
type SearchHit struct {
Score float64 `json:"_score"` // computed score
Index string `json:"_index"` // index name
ID string `json:"_id"` // external or internal
Type string `json:"_type"` // type
Version int64 `json:"_version"` // version number, when Version is set to true in SearchService
Sort []interface{} `json:"sort"` // sort information
Highlight SearchHitHighlight `json:"highlight"` // highlighter information
Source *json.RawMessage `json:"_source"` // stored document source
Fields map[string]interface{} `json:"fields"` // returned fields
Explanation *SearchExplanation `json:"_explanation"` // explains how the score was computed
}
type SearchHitHighlight ¶
type SearchHits ¶
type SearchReq ¶
type SearchReq struct {
Query *Query
// contains filtered or unexported fields
}
func (*SearchReq) Do ¶
func (req *SearchReq) Do() (*SearchResp, error)
type SearchResp ¶
type SearchResp struct {
Took int64 `json:"took"` // search time in milliseconds
ScrollID string `json:"_scroll_id"` // only used with Scroll and Scan operations
Hits *SearchHits `json:"hits"` // the actual search hits
Suggest SearchSuggest `json:"suggest"` // results from suggesters
Facets SearchFacets `json:"facets"` // results from facets
Aggregations Aggregations `json:"aggregations"` // results from aggregations
TimedOut bool `json:"timed_out"` // true if the search timed out
Error string `json:"error,omitempty"` // used in MultiSearch only
}
type SearchSuggest ¶
type SearchSuggest map[string][]*SearchSuggestion
type SearchSuggestion ¶
type SearchSuggestion struct {
Text string `json:"text"`
Offset int `json:"offset"`
Length int `json:"length"`
Options []*SearchSuggestionOption `json:"options"`
}
type SearchSuggestionOption ¶
type UpdatePartialReq ¶
type UpdatePartialReq struct {
Query *Query
// contains filtered or unexported fields
}
func NewUpdatePartial ¶
func NewUpdatePartial(client *Client, index, ty, id string) *UpdatePartialReq
func (*UpdatePartialReq) Body ¶
func (req *UpdatePartialReq) Body(body *bytes.Buffer) *UpdatePartialReq
func (*UpdatePartialReq) Do ¶
func (req *UpdatePartialReq) Do() (*UpdatePartialResp, error)
type UpdatePartialResp ¶
Click to show internal directories.
Click to hide internal directories.