Documentation ¶
Overview ¶
go-appbase is a data streams library for Go
Compatible with Elasticsearch.
To use the data streaming facilities of the library, create an account at https://appbase.io/
Checkout the examples to learn more.
Example ¶
client, _ := NewClient("https://scalr.api.appbase.io", "dW9DQYdot", "40d5db8b-36c8-41ac-b6e9-d26d7e34ce1e", "testapp2") err := client.Ping() if err != nil { log.Fatalln(err) } fmt.Println("Client created")
Output: Client created
Index ¶
- type Client
- func (c *Client) Delete() *actions.DeleteService
- func (c *Client) Get() *actions.GetService
- func (c *Client) GetStream() *actions.GetStreamService
- func (c *Client) Index() *actions.IndexService
- func (c *Client) Ping() error
- func (c *Client) Search() *actions.SearchService
- func (c *Client) SearchStream() *actions.SearchStreamService
- func (c *Client) Update() *actions.UpdateService
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Delete ¶
func (c *Client) Delete() *actions.DeleteService
Delete returns a DeleteService which is used to delete a document
func (*Client) Get ¶
func (c *Client) Get() *actions.GetService
Get returns a GetService which is used to retrieve a document
func (*Client) GetStream ¶
func (c *Client) GetStream() *actions.GetStreamService
GetStream is used to start a stream of updates corresponding to a document
func (*Client) Index ¶
func (c *Client) Index() *actions.IndexService
Index returns an IndexService which is used to index a document
Example ¶
res, err := client.Index().Type(testtype).Id("1").Body(tweet1).Do() if err != nil { log.Fatalln(err) return } fmt.Println(res.Id)
Output: 1
func (*Client) Search ¶
func (c *Client) Search() *actions.SearchService
Search provides access to Elasticsearch's search functionality
Example ¶
res, err := client.Search().Type(testtype).Body(query1).Do() if err != nil { log.Fatalln(err) return } fmt.Println(res.Hits.TotalHits > 0)
Output: true
func (*Client) SearchStream ¶
func (c *Client) SearchStream() *actions.SearchStreamService
SearchStream is used to get updates corresponding to a query
Example ¶
searchStreamResponse, err := client.SearchStream().Type(testtype).Body(query1).Do() if err != nil { log.Fatalln(err) return } _, err = client.Index().Type(testtype).Id("1").Body(tweet2).Do() if err != nil { log.Fatalln(err) return } docResponse, err := searchStreamResponse.Next() if err != nil { log.Fatalln(err) return } fmt.Println(docResponse.Id)
Output: 1
Example (Streamonly) ¶
params := make(url.Values) params.Set("streamonly", "true") searchStreamResponse, err := client.SearchStream().Type(testtype).URLParams(params).Body(query1).Do() if err != nil { log.Fatalln(err) return } _, err = client.Index().Type(testtype).Id("1").Body(tweet2).Do() if err != nil { log.Fatalln(err) return } docResponse, err := searchStreamResponse.Next() if err != nil { log.Fatalln(err) return } fmt.Println(docResponse.Id)
Output: 1
func (*Client) Update ¶
func (c *Client) Update() *actions.UpdateService
Update returns an UpdateService which is used to update a document
Example ¶
res, err := client.Update().Type(testtype).Id("1").Body(fmt.Sprintf(`{ "doc": %s }`, tweet2)).Do() if err != nil { log.Fatalln(err) return } fmt.Println(res.Id)
Output: 1
Directories ¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/gopkg.in/olivere/elastic.v3
Package elastic provides an interface to the Elasticsearch server (http://www.elasticsearch.org/).
|
Package elastic provides an interface to the Elasticsearch server (http://www.elasticsearch.org/). |
_workspace/src/gopkg.in/olivere/elastic.v3/uritemplates
Package uritemplates is a level 4 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570).
|
Package uritemplates is a level 4 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570). |
Click to show internal directories.
Click to hide internal directories.