Documentation
¶
Index ¶
- Constants
- type BulkRequest
- type BulkResponse
- type BulkResponseItem
- type Client
- func (c *Client) Bulk(items []*BulkRequest) (*BulkResponse, error)
- func (c *Client) CreateMapping(index string, docType string, mapping map[string]interface{}) error
- func (c *Client) Delete(index string, docType string, id string) error
- func (c *Client) DeleteIndex(index string) error
- func (c *Client) Do(method string, url string, body map[string]interface{}) (*Response, error)
- func (c *Client) DoBulk(url string, items []*BulkRequest) (*BulkResponse, error)
- func (c *Client) DoRequest(method string, url string, body *bytes.Buffer) (*http.Response, error)
- func (c *Client) Exists(index string, docType string, id string) (bool, error)
- func (c *Client) Get(index string, docType string, id string) (*Response, error)
- func (c *Client) IndexBulk(index string, items []*BulkRequest) (*BulkResponse, error)
- func (c *Client) IndexTypeBulk(index string, docType string, items []*BulkRequest) (*BulkResponse, error)
- func (c *Client) Update(index string, docType string, id string, data map[string]interface{}) error
- type ClientConfig
- type Response
- type ResponseItem
Constants ¶
View Source
const ( ActionCreate = "create" ActionUpdate = "update" ActionDelete = "delete" ActionIndex = "index" )
See http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/bulk.html
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BulkRequest ¶
type BulkResponse ¶
type BulkResponse struct { Code int Took int `json:"took"` Errors bool `json:"errors"` Items []map[string]*BulkResponseItem `json:"items"` }
type BulkResponseItem ¶
type Client ¶
type Client struct { Addr string User string Password string // contains filtered or unexported fields }
Although there are many Elasticsearch clients with Go, I still want to implement one by myself. Because we only need some very simple usages.
func NewClient ¶
func NewClient(conf *ClientConfig) *Client
func (*Client) Bulk ¶
func (c *Client) Bulk(items []*BulkRequest) (*BulkResponse, error)
only support parent in 'Bulk' related apis
func (*Client) CreateMapping ¶
func (*Client) DeleteIndex ¶
func (*Client) DoBulk ¶
func (c *Client) DoBulk(url string, items []*BulkRequest) (*BulkResponse, error)
func (*Client) IndexBulk ¶
func (c *Client) IndexBulk(index string, items []*BulkRequest) (*BulkResponse, error)
func (*Client) IndexTypeBulk ¶
func (c *Client) IndexTypeBulk(index string, docType string, items []*BulkRequest) (*BulkResponse, error)
type ClientConfig ¶
type Response ¶
type Response struct { Code int ResponseItem }
Click to show internal directories.
Click to hide internal directories.