Documentation ¶
Index ¶
- func Agg(ctx context.Context, client *elastic.Client, csr *Query, ...) (err error)
- func BatchAdd[T any](ctx context.Context, client *elastic.Client, index string, datas map[string]T, ...) error
- func BatchDelete(ctx context.Context, client *elastic.Client, index string, ids []string, ...) error
- func BatchUpdate(ctx context.Context, client *elastic.Client, index string, ...) error
- func BuildExistsQuery(name string) (query *elastic.ExistsQuery)
- func BuildIntTermsQuery(name string, list []int64) (query *elastic.TermsQuery)
- func BuildNestedTermsQuery[T any](path string, name string, list []T) (query *elastic.NestedQuery)
- func BuildNestedWildcardQuery(path string, name string, card string) (query *elastic.NestedQuery)
- func BuildQuery(ctx context.Context, client *elastic.Client, filter *Query) (*elastic.SearchService, error)
- func BuildTermQuery[T any](name string, val T) (query *elastic.TermQuery)
- func BuildTermsQuery[T any](name string, list []T) (query *elastic.TermsQuery)
- func BuildWildcardQuery(names []string, term string) (query *elastic.BoolQuery)
- func NotFoundErr(err error) bool
- func Search(ctx context.Context, client *elastic.Client, filter *Query, ...) (int64, error)
- func SearchAny[T any](ctx context.Context, client *elastic.Client, filter *Query) ([]*T, int64, error)
- func UpdateWhere(ctx context.Context, client *elastic.Client, csr *Query, ...) error
- type Query
- func (cs *Query) ExistsQueryIf(ok bool, name string) *Query
- func (cs *Query) FilterDeleteQuery() *Query
- func (cs *Query) FilterDeleteQueryIf(filterDel bool) *Query
- func (cs *Query) MustBitScriptQueryIf(ok bool, name string, val int32) *Query
- func (cs *Query) MustNotTermQueryIf(ok bool, name string, term interface{}) *Query
- func (cs *Query) MustRangeFromQueryIf(ok bool, name string, from int64, optType int64) *Query
- func (cs *Query) MustTermQueryIf(ok bool, name string, term interface{}) *Query
- func (cs *Query) MustTermsQueryIf(ok bool, name string, list []string) *Query
- func (cs *Query) MustTermsQueryInt32If(ok bool, name string, list []int32) *Query
- func (cs *Query) MustTermsQueryIntIf(ok bool, name string, list []int) *Query
- func (cs *Query) MustTermsUint8QueryIf(ok bool, name string, list []uint8) *Query
- func (cs *Query) MustWildcardOrQueryIf(ok bool, names []string, term string) *Query
- func (cs *Query) MustWildcardQueryIf(ok bool, name string, term string) *Query
- func (cs *Query) Sort(list []*SortField, dft *SortField) *Query
- func (cs *Query) ToQuery() elastic.Query
- func (cs *Query) TryMustIntTermsQuery(name string, list []int64) *Query
- func (cs *Query) TryMustNestedInt32TermsQuery(path string, name string, list []int32) *Query
- func (cs *Query) TryMustNestedStringTermsQuery(path string, name string, list []string) *Query
- func (cs *Query) TryMustNestedWildcardQuery(path string, name string, card string) *Query
- func (cs *Query) TryMustNotTermsQuery(name string, list []string) *Query
- func (cs *Query) TryMustRangeQuery(name string, from int64, to int64) *Query
- func (cs *Query) TryMustTermsQuery(name string, list []string) *Query
- type SortField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Agg ¶
func Agg(ctx context.Context, client *elastic.Client, csr *Query, agg elastic.Aggregation, valueFunc func(json.RawMessage) error) (err error)
Agg 统计
func BatchDelete ¶
func BatchUpdate ¶
func BuildExistsQuery ¶
func BuildExistsQuery(name string) (query *elastic.ExistsQuery)
func BuildIntTermsQuery ¶
func BuildNestedTermsQuery ¶
func BuildQuery ¶
func BuildTermQuery ¶
func BuildTermsQuery ¶
func BuildWildcardQuery ¶
func NotFoundErr ¶ added in v1.22.10
func Search ¶
func Search(ctx context.Context, client *elastic.Client, filter *Query, valueFunc func(*elastic.SearchHit)) (int64, error)
Search ES搜索
Types ¶
type Query ¶ added in v1.22.10
type Query struct { Index string MustQuery []elastic.Query MustNotQuery []elastic.Query ShouldQuery []elastic.Query Filters []elastic.Query Sorters []elastic.Sorter PageIndex int Size int MaxWindows int }
func MustTermsQueryIf ¶
func (*Query) ExistsQueryIf ¶ added in v1.22.10
func (*Query) FilterDeleteQuery ¶ added in v1.22.10
FilterDeleteQuery 过滤删除的
func (*Query) FilterDeleteQueryIf ¶ added in v1.22.10
func (*Query) MustBitScriptQueryIf ¶ added in v1.22.10
MustBitScriptQueryIf 位运算
func (*Query) MustNotTermQueryIf ¶ added in v1.22.10
func (*Query) MustRangeFromQueryIf ¶ added in v1.22.10
MustRangeFromQueryIf optType 1 gt 2 gte 3 lt 4 lte
func (*Query) MustTermQueryIf ¶ added in v1.22.10
func (*Query) MustTermsQueryIf ¶ added in v1.22.10
func (*Query) MustTermsQueryInt32If ¶ added in v1.22.10
func (*Query) MustTermsQueryIntIf ¶ added in v1.22.10
func (*Query) MustTermsUint8QueryIf ¶ added in v1.22.10
func (*Query) MustWildcardOrQueryIf ¶ added in v1.22.10
MustWildcardOrQueryIf 多字段模糊匹配, 用bool query.should 拼接or 条件
func (*Query) MustWildcardQueryIf ¶ added in v1.22.10
func (*Query) TryMustIntTermsQuery ¶ added in v1.22.10
func (*Query) TryMustNestedInt32TermsQuery ¶ added in v1.22.10
TryMustNestedInt32TermsQuery 如 (path:to,name:to.id)
func (*Query) TryMustNestedStringTermsQuery ¶ added in v1.22.10
TryMustNestedStringTermsQuery 如 (path:to,name:to.id)
func (*Query) TryMustNestedWildcardQuery ¶ added in v1.22.10
TryMustNestedWildcardQuery 如 (path:to,name:to.id)
func (*Query) TryMustNotTermsQuery ¶ added in v1.22.10
func (*Query) TryMustRangeQuery ¶ added in v1.22.10
Click to show internal directories.
Click to hide internal directories.