myelastic

package
v0.0.0-...-faf29f7 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MyElastic

type MyElastic struct {
	Client *elastic.Client
	Err    error
	Ctx    context.Context
}

func OnInitES

func OnInitES(url string) MyElastic

func (*MyElastic) Add

func (es *MyElastic) Add(index_name, type_name, id string, data interface{}) (result bool)

添加记录,覆盖添加

func (*MyElastic) CreateIndex

func (es *MyElastic) CreateIndex(index_name, mapping string) (result bool)

创建索引(相当于数据库) mapping 如果为空("")则表示不创建模型

func (*MyElastic) Search

func (es *MyElastic) Search(index_name, type_name string, query interface{}, out interface{}) (result bool)

添加记录,覆盖添加 index_name type_name query interface{} //查询条件 out *[]Param //查询结果

func (*MyElastic) SearchMap

func (es *MyElastic) SearchMap(index_name, type_name string, query interface{}, out *[]map[string]interface{}) (result bool)

添加记录,覆盖添加 index_name type_name query interface{} //查询条件 out *[]Param //查询结果

func (*MyElastic) SortQuery

func (es *MyElastic) SortQuery(index_name string, builder []elastic.Sorter, query []elastic.Query) (bool, []string)

排序查询 返回json数据集合

func (*MyElastic) SortQueryReturnHits

func (es *MyElastic) SortQueryReturnHits(index_name string, from, size int, builder []elastic.Sorter, query []elastic.Query) (bool, []*elastic.SearchHit)

排序查询 返回原始Hit builder:排序 agg:聚合 类似group_by sum query:查询

Jump to

Keyboard shortcuts

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