Documentation
¶
Index ¶
- Constants
- type BulkDoc
- type Condition
- type Connection
- func (c *Connection) Bulk(timeout time.Duration, param string) (resp *Response, err error)
- func (c *Connection) Delete(timeout time.Duration, path string, params string) (*Response, error)
- func (c *Connection) DocsBulk(timeout time.Duration, items ...BulkDoc) (resp *Response, err error)
- func (c *Connection) DocsDelete(timeout time.Duration, index, id string) (*results.IndexResult, error)
- func (c *Connection) DocsGet(timeout time.Duration, index string, id string) (*results.DocumentResult, error)
- func (c *Connection) DocsInsert(timeout time.Duration, index string, row base.JsonParam) (*results.IndexResult, error)
- func (c *Connection) DocsMGet(timeout time.Duration, index string, idList ...string) (rows *results.DocumentsResult, err error)
- func (c *Connection) DocsMSet(timeout time.Duration, index string, rows ...base.JsonParam) (resp *Response, err error)
- func (c *Connection) DocsUpdate(timeout time.Duration, index string, id string, doc base.JsonParam) (*results.IndexResult, error)
- func (c *Connection) DocsUpdateWithVersion(timeout time.Duration, index string, id string, version int64, ...) (*results.IndexResult, error)
- func (c *Connection) Get(timeout time.Duration, path string, params string) (*Response, error)
- func (c *Connection) IndexCreate(timeout time.Duration, index string, settings *Settings, mappings *Mappings) (ok bool, err error)
- func (c *Connection) IndexDelete(timeout time.Duration, index string) (ok bool, err error)
- func (c *Connection) MappingsAlter(timeout time.Duration, index string, mappings *Mappings) (ok bool, err error)
- func (c *Connection) Post(timeout time.Duration, path string, params string) (*Response, error)
- func (c *Connection) Put(timeout time.Duration, path string, params string) (*Response, error)
- func (c *Connection) SetMaxResultWindow(timeout time.Duration, index string, value int64) (ok bool, err error)
- func (c *Connection) SettingsAlter(timeout time.Duration, index string, settings base.JsonParam) (ok bool, err error)
- func (c *Connection) SqlSearch(timeout time.Duration, sql string) (*results.SqlSearchResult, error)
- func (c *Connection) SqlTranslate(timeout time.Duration, sql string, limit int) (*Response, error)
- type Field
- type Mappings
- type Operator
- type Option
- type Order
- type OrderBy
- type Property
- type Query
- func (q *Query) After(sortItems ...interface{}) *Query
- func (q *Query) Build() string
- func (q *Query) From(index string) *Query
- func (q *Query) Limit(size int) *Query
- func (q *Query) Offset(offset int64) *Query
- func (q *Query) OrderBy(order ...OrderBy) *Query
- func (q *Query) Search(timeout time.Duration, conn *Connection) (result *results.SearchResult, err error)
- func (q *Query) SearchRows(timeout time.Duration, conn *Connection) (result *results.RowsResult, err error)
- func (q *Query) Select(fields ...string) *Query
- func (q *Query) Where(condition Condition) *Query
- func (q *Query) WhereString(where string) *Query
- type Response
- func (r *Response) Error() (err error)
- func (r *Response) Is(status int) bool
- func (r *Response) IsOk() bool
- func (r *Response) UnmarshalBulkResult() (*results.BulkResult, error)
- func (r *Response) UnmarshalDocumentResult() (*results.DocumentResult, error)
- func (r *Response) UnmarshalDocumentsResult() (*results.DocumentsResult, error)
- func (r *Response) UnmarshalIndexResult() (*results.IndexResult, error)
- func (r *Response) UnmarshalSearchResult() (*results.SearchResult, error)
- func (r *Response) UnmarshalSqlSearchResult() (*results.SqlSearchResult, error)
- type Settings
Constants ¶
const ( OptIndex = iota OptCreate OptUpdate OptDelete )
const ( TypeBinary = `binary` TypeBoolean = `boolean` TypeByte = `byte` TypeShort = `short` TypeInteger = `integer` TypeLong = `long` TypeUlong = `unsigned_long` TypeFloat = `float` TypeDouble = `double` TypeKeyword = `keyword` TypeText = `text` TypeDate = `date` TypeIp = `ip` TypeVersion = `version` )
const ( FormatDate = `yyyy-MM-dd` FormatDateTime = `yyyy-MM-dd HH:mm:ss` FormatUnixTime = `epoch_second` FormatTimestampSecond = FormatUnixTime FormatTimestampMilliSecond = `epoch_millis` )
const ( And = ` AND ` Or = ` OR ` )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition struct {
// contains filtered or unexported fields
}
func AndCondition ¶
func OrCondition ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func New ¶
func New(opt Option) *Connection
func (*Connection) Bulk ¶
Bulk link: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
func (*Connection) DocsDelete ¶
func (c *Connection) DocsDelete(timeout time.Duration, index, id string) (*results.IndexResult, error)
DocsDelete link: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html
func (*Connection) DocsGet ¶
func (c *Connection) DocsGet(timeout time.Duration, index string, id string) (*results.DocumentResult, error)
DocsGet link: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html
func (*Connection) DocsInsert ¶
func (c *Connection) DocsInsert(timeout time.Duration, index string, row base.JsonParam) (*results.IndexResult, error)
DocsInsert link: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html
func (*Connection) DocsMGet ¶
func (c *Connection) DocsMGet(timeout time.Duration, index string, idList ...string) (rows *results.DocumentsResult, err error)
DocsMGet link: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html
func (*Connection) DocsUpdate ¶
func (c *Connection) DocsUpdate(timeout time.Duration, index string, id string, doc base.JsonParam) (*results.IndexResult, error)
DocsUpdate link: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html
func (*Connection) DocsUpdateWithVersion ¶
func (c *Connection) DocsUpdateWithVersion(timeout time.Duration, index string, id string, version int64, fullDoc base.JsonParam) (*results.IndexResult, error)
DocsUpdateWithVersion link: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html
func (*Connection) IndexCreate ¶
func (*Connection) IndexDelete ¶
func (*Connection) MappingsAlter ¶
func (c *Connection) MappingsAlter(timeout time.Duration, index string, mappings *Mappings) (ok bool, err error)
MappingsAlter link: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html
func (*Connection) SetMaxResultWindow ¶
func (*Connection) SettingsAlter ¶
func (c *Connection) SettingsAlter(timeout time.Duration, index string, settings base.JsonParam) (ok bool, err error)
SettingsAlter link: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html
func (*Connection) SqlSearch ¶
func (c *Connection) SqlSearch(timeout time.Duration, sql string) (*results.SqlSearchResult, error)
SqlSearch link: https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-search-api.html#sql-search-api
func (*Connection) SqlTranslate ¶
SqlTranslate link: https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-translate-api.html
type Option ¶
type Option struct {
BaseUrl string `json:"baseUrl" yaml:"baseUrl"`
UserName string `json:"userName" yaml:"userName"`
Password string `json:"password" yaml:"password"`
DialTimeoutSecond int64 `json:"dialTimeoutSecond" yaml:"dialTimeoutSecond"`
KeepaliveSecond int64 `json:"keepaliveSecond" yaml:"keepaliveSecond"`
IdleConnTimeoutSecond int64 `json:"idleConnTimeoutSecond" yaml:"idleConnTimeoutSecond"`
MaxIdleConns int `json:"maxIdleConns" yaml:"maxIdleConns"`
MaxIdleConnsPerHost int `json:"maxIdleConnsPerHost" yaml:"maxIdleConnsPerHost"`
MaxConnsPerHost int `json:"maxConnsPerHost" yaml:"maxConnsPerHost"`
}
type Property ¶
type Property struct {
Type string `json:"type"`
Format string `json:"format,omitempty"`
// contains filtered or unexported fields
}
func NewProperty ¶
func (*Property) WithFormat ¶
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query link: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html
func (*Query) Search ¶
func (q *Query) Search(timeout time.Duration, conn *Connection) (result *results.SearchResult, err error)
func (*Query) SearchRows ¶
func (q *Query) SearchRows(timeout time.Duration, conn *Connection) (result *results.RowsResult, err error)
func (*Query) WhereString ¶
type Response ¶
func (*Response) UnmarshalBulkResult ¶
func (r *Response) UnmarshalBulkResult() (*results.BulkResult, error)
func (*Response) UnmarshalDocumentResult ¶
func (r *Response) UnmarshalDocumentResult() (*results.DocumentResult, error)
func (*Response) UnmarshalDocumentsResult ¶
func (r *Response) UnmarshalDocumentsResult() (*results.DocumentsResult, error)
func (*Response) UnmarshalIndexResult ¶
func (r *Response) UnmarshalIndexResult() (*results.IndexResult, error)
func (*Response) UnmarshalSearchResult ¶
func (r *Response) UnmarshalSearchResult() (*results.SearchResult, error)
func (*Response) UnmarshalSqlSearchResult ¶
func (r *Response) UnmarshalSqlSearchResult() (*results.SqlSearchResult, error)