gelastic

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2020 License: MIT Imports: 5 Imported by: 0

README

gelastic

elastic search api wrap

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ISearch

type ISearch interface {
	IsIndexExists(index ...string) (bool, error)
	IsDataExists(index, typ, id string) (bool, error)

	GetCount(index string) int64

	GetIndexNames() ([]string, error)
	GetIndexSettings(index ...string) (interface{}, error)
	GetIndexMapping(index string) (interface{}, error)
	SetIndexMapping(index, metaMapping string, typ ...string) (bool, error)
	GetIndexStatus(index ...string) (interface{}, error)

	CreateIndex(index string, metaMapping ...string) (bool, error)
	DeleteIndex(index ...string) (bool, error)
	RefreshIndex(index ...string) error
	FlushIndex(index ...string) error

	GetData(index, typ, id string) (interface{}, error)
	IndexData(index, typ, id string, data interface{}) error

	Analyze(content string, analyzer ...string) ([]string, error)
	Query(query elastic_api.Query, option *QueryOption) (*elastic_api.SearchResult, error)
	Search() *elastic_api.SearchService
	MultiSearch() *elastic_api.MultiSearchService
	Bulk(requests ...elastic_api.BulkableRequest) (*elastic_api.BulkResponse, error)

	GetClient() *elastic_api.Client
	Version() (string, error)
}

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 搜索接口 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

func NewSearch

func NewSearch(option *SearchOption) (ISearch, error)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 初始化Search * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

type QueryOption

type QueryOption struct {
	Indexs      []string              `form:"indexs" json:"indexs"`
	Types       []string              `form:"types" json:"types"`
	Suggester   elastic_api.Suggester `form:"suggester" json:"suggester"`
	From        int                   `form:"from" json:"from"`
	Size        int                   `form:"size" json:"size"`
	SortField   string                `form:"sort_field" json:"sort_field"`
	Timeout     string                `form:"timeout" json:"timeout"`
	IsAscending bool                  `form:"is_ascending" json:"is_ascending"`
}

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 查询选项数据域结构 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

func DefaultQueryOption

func DefaultQueryOption() *QueryOption

type SearchOption

type SearchOption struct {
	Hosts               []string
	Username            string
	Password            string
	HealthcheckInterval int
	MaxRetries          int
	IsSniff             bool
	IsAuth              bool
}

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 搜索选项数据域结构 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

func DefaultSearchOption

func DefaultSearchOption() *SearchOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL