Documentation
¶
Index ¶
- func Count(client *elastic.Client, index string, tp string, query elastic.Query) (int64, error)
- func CreateBulk(client *elastic.Client, index string, tp string, objects chan interface{}) (err error)
- func CreateIndex(client *elastic.Client, index string, mapping interface{}) (created bool, err error)
- func DeleteBulk(client *elastic.Client, index string, tp string, query elastic.Query) (err error)
- func FetchObjects(client *elastic.Client, index string, tp string, query elastic.Query) <-chan *Object
- func FlushIndex(client *elastic.Client, indices ...string) (err error)
- func RefreshIndex(client *elastic.Client, indices ...string) (err error)
- func UpdateAll(client *elastic.Client, index string, tp string, script *elastic.Script) (err error)
- type HitInfo
- type Object
- func FetchObject(client *elastic.Client, index string, tp string, query elastic.Query, ...) (obj *Object, took *time.Duration, err error)
- func FetchOrCreateObject(client *elastic.Client, index string, tp string, query elastic.Query, ...) (obj *Object, created bool, err error)
- func NewObjectFromFields(client *elastic.Client, index string, tp string, Data interface{}) (obj *Object, err error)
- func NewObjectFromHit(client *elastic.Client, hit *elastic.SearchHit) (obj *Object, err error)
- func NewObjectFromID(client *elastic.Client, index string, tp string, id string) (obj *Object, err error)
- func (obj *Object) Delete() (err error)
- func (obj *Object) GetID() string
- func (obj *Object) Index() (err error)
- func (obj *Object) IsIndexed() bool
- func (obj *Object) Pack(v interface{}) (err error)
- func (obj *Object) Reload() (err error)
- func (obj *Object) Save() (err error)
- func (obj *Object) Unpack(v interface{}) (err error)
- func (obj *Object) UnpackFields() (fields map[string]interface{}, err error)
- type ResultsPage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBulk ¶
func CreateBulk(client *elastic.Client, index string, tp string, objects chan interface{}) (err error)
CreateBulk creates a lazily computed set of objects in bulk
func CreateIndex ¶
func CreateIndex(client *elastic.Client, index string, mapping interface{}) (created bool, err error)
CreateIndex creates an index unless it already exists
func DeleteBulk ¶
DeleteBulk deletes objects subject to a given query
func FetchObjects ¶
func FetchObjects(client *elastic.Client, index string, tp string, query elastic.Query) <-chan *Object
FetchObjects fetches objects subject to an exact query
func FlushIndex ¶
FlushIndex flushes an index
func RefreshIndex ¶
RefreshIndex refreshes an index
Types ¶
type HitInfo ¶
type HitInfo struct { Highlight *elastic.SearchHitHighlight Score *float64 }
HitInfo represents information about this object as a hit
type Object ¶
type Object struct { Source *json.RawMessage // the source of this object (if any) Hit *HitInfo // information about this object as a result (if available) // contains filtered or unexported fields }
Object represents an object within elasticsearch
func FetchObject ¶
func FetchObject(client *elastic.Client, index string, tp string, query elastic.Query, highlight *elastic.Highlight) (obj *Object, took *time.Duration, err error)
FetchObject fetches a single object from the database or returns nil
func FetchOrCreateObject ¶
func FetchOrCreateObject(client *elastic.Client, index string, tp string, query elastic.Query, Data interface{}) (obj *Object, created bool, err error)
FetchOrCreateObject fetches the object returned from the query, or creates a new one if no result is retrieved
func NewObjectFromFields ¶
func NewObjectFromFields(client *elastic.Client, index string, tp string, Data interface{}) (obj *Object, err error)
NewObjectFromFields creates a new ec object on the server
func NewObjectFromHit ¶
NewObjectFromHit creates a new object using a SearchHit
func NewObjectFromID ¶
func NewObjectFromID(client *elastic.Client, index string, tp string, id string) (obj *Object, err error)
NewObjectFromID fetches a new EC object from the server
func (*Object) UnpackFields ¶
UnpackFields unpacks this object into a set of fields
type ResultsPage ¶
ResultsPage represents a single page of results