Documentation ¶
Index ¶
- func New(config map[string]interface{}) (interface{}, error)
- type Client
- func (c *Client) Batch(action, head, body string) error
- func (c *Client) Close()
- func (c *Client) Flush()
- func (c *Client) Init() error
- func (c *Client) Process(item *DataItem)
- func (c *Client) Request(method, uri string, body []byte, timeout time.Duration, bulk ...bool) ([]byte, error)
- func (c *Client) SetBatchEsTimeout(v string) error
- func (c *Client) SetBatchFlushInterval(v string) error
- func (c *Client) SetBatchFlushNum(v int)
- func (c *Client) SetEsHost(v string)
- func (c *Client) SetMaxBufferByte(v int)
- func (c *Client) SetMaxBufferLine(v int)
- func (c *Client) SetRetryNum(v int)
- func (c *Client) SetSingleEsTimeout(v string) error
- func (c *Client) Single(method, uri string, body []byte, timeout time.Duration) ([]byte, error)
- type DataItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
Elasticsearch client component,Support for batch and asynchronous writes. support read-write splitting, configuration: components:
es: esHost: "http://127.0.0.1:9200/" httpId: "http" // 默认http retryNum: 0 // 默认0重试1次 batchChanLen: 500 // 队列数量 默认500 batchFlushInterval: "50s" // 批量操作刷新间隔时间 默认50秒 batchEsTimeout:"30s" // 批量请求es服务器超时时间 默认30秒 singleEsTimeout: "500ms" // 单个请求es服务器超时时间 默认500毫秒 maxBufferLine: 600 // 缓冲最条数,默认600 maxBufferByte: 1048576 // 写缓冲大小 单位bite 默认1M
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Batch ¶
批量增加命令 异步执行 action : index,create,delete, update head : {“_ index”:“test”,“_ type”:“_ doc”,“_ id”:“1”} body : {"filed1":"value1"}
func (*Client) Request ¶
func (c *Client) Request(method, uri string, body []byte, timeout time.Duration, bulk ...bool) ([]byte, error)
Request 请求es,返回原始结果 method: POST GET PUT .... body: 请求body timeout: 超时设置 bulk: 是否批量操作(默认否)
func (*Client) SetBatchEsTimeout ¶
func (*Client) SetBatchFlushInterval ¶
func (*Client) SetBatchFlushNum ¶
func (*Client) SetMaxBufferByte ¶
func (*Client) SetMaxBufferLine ¶
func (*Client) SetRetryNum ¶
func (*Client) SetSingleEsTimeout ¶
Click to show internal directories.
Click to hide internal directories.