Documentation ¶
Index ¶
- func DelClient(names ...string)
- func Init(conf Config, options ...elastic.ClientOptionFunc) (err error)
- type BoolQueryAction
- type Config
- type GoEs
- func (cli *GoEs) Client() *elastic.Client
- func (cli *GoEs) DocArrayAppendValue(field string, value interface{}) *elastic.Script
- func (cli *GoEs) DocArrayAppendValues(field string, value []interface{}) *elastic.Script
- func (cli *GoEs) DocArrayDelField(field string, value interface{}) *elastic.Script
- func (cli *GoEs) DocArrayDelFields(field string, value []interface{}) *elastic.Script
- func (cli *GoEs) DocArrayUpdateValue(field string, old, new interface{}) *elastic.Script
- func (cli *GoEs) DocBatchCreate(index string, data map[string]interface{}) (resp *elastic.BulkResponse, err error)
- func (cli *GoEs) DocBatchDelete(index string, ids []string) (total int64, err error)
- func (cli *GoEs) DocBatchUpdate(index string, ids []string, docs []interface{}) (err error)
- func (cli *GoEs) DocBatchUpset(index string, ids []string, docs []interface{}) (err error)
- func (cli *GoEs) DocCount(index string, query elastic.Query) (int64, error)
- func (cli *GoEs) DocCreate(index, id string, body interface{}) (*elastic.IndexResponse, error)
- func (cli *GoEs) DocDelete(index, id string) (*elastic.IndexResponse, error)
- func (cli *GoEs) DocDeleteBy(index string, query elastic.Query) (total int64, err error)
- func (cli *GoEs) DocGet(index, id string, m interface{}) (resp *elastic.GetResult, err error)
- func (cli *GoEs) DocMultiGet(index string, ids []string, m interface{}) (resp *elastic.MgetResponse, err error)
- func (cli *GoEs) DocSearch(index string, query elastic.Query, p *Pagination) (resp *elastic.SearchResult, err error)
- func (cli *GoEs) DocSearchBoolQuery(action BoolQueryAction, queries ...elastic.Query) *elastic.BoolQuery
- func (cli *GoEs) DocSearchExistsQuery(field string) *elastic.ExistsQuery
- func (cli *GoEs) DocSearchMatchQuery(field string, value interface{}) *elastic.MatchQuery
- func (cli *GoEs) DocSearchRangeQuery(field string, from, to interface{}) *elastic.RangeQuery
- func (cli *GoEs) DocSearchScriptQuery(script *elastic.Script) *elastic.ScriptQuery
- func (cli *GoEs) DocSearchTermQuery(field string, value interface{}) *elastic.TermQuery
- func (cli *GoEs) DocSearchTermsQuery(field string, values []interface{}) *elastic.TermsQuery
- func (cli *GoEs) DocUpdate(index, id string, body interface{}) (response *elastic.UpdateResponse, err error)
- func (cli *GoEs) DocUpdateBy(index string, query elastic.Query, script *elastic.Script) (total int64, err error)
- func (cli *GoEs) DocUpset(index, id string, body interface{}) (response *elastic.UpdateResponse, err error)
- func (cli *GoEs) IndexAlias(index, aliasName string) (*elastic.AliasResult, error)
- func (cli *GoEs) IndexAliasRemove(index, aliasName string) (*elastic.AliasResult, error)
- func (cli *GoEs) IndexCreate(index, body string) (err error)
- func (cli *GoEs) IndexDelete(index string) (err error)
- func (cli *GoEs) IndexExists(index string) (bool, error)
- func (cli *GoEs) IndexGet(index string) (*elastic.IndicesGetResponse, error)
- func (cli *GoEs) IndexMapping(index string) (map[string]interface{}, error)
- func (cli *GoEs) IndexNames() ([]string, error)
- func (cli *GoEs) IndexSettings(index string) (map[string]*elastic.IndicesGetSettingsResponse, error)
- func (cli *GoEs) IndexUpdateMapping(index, body string) (*elastic.PutMappingResponse, error)
- func (cli *GoEs) IndexUpdateSettings(index, body string) (*elastic.IndicesPutSettingsResponse, error)
- type Pagination
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BoolQueryAction ¶
type BoolQueryAction string
var ( BoolQueryMust BoolQueryAction = "must" BoolQueryFilter BoolQueryAction = "filter" BoolQueryShould BoolQueryAction = "should" BoolQueryMustNot BoolQueryAction = "must_not" )
type GoEs ¶ added in v1.2.142
type GoEs struct {
// contains filtered or unexported fields
}
func (*GoEs) DocArrayAppendValue ¶ added in v1.2.142
3. 数组追加元素
func (*GoEs) DocArrayAppendValues ¶ added in v1.2.142
4. 数组追加多个元素
func (*GoEs) DocArrayDelField ¶ added in v1.2.142
1. 数组删除元素
func (*GoEs) DocArrayDelFields ¶ added in v1.2.142
2. 数组删除多个元素
func (*GoEs) DocArrayUpdateValue ¶ added in v1.2.142
5. 数组修改元素
func (*GoEs) DocBatchCreate ¶ added in v1.2.142
func (cli *GoEs) DocBatchCreate(index string, data map[string]interface{}) (resp *elastic.BulkResponse, err error)
文档 - 批量添加
func (*GoEs) DocBatchDelete ¶ added in v1.2.142
文档 - 批量删除
func (*GoEs) DocBatchUpdate ¶ added in v1.2.142
文档 - 批量修改
func (*GoEs) DocBatchUpset ¶ added in v1.2.142
文档 - 批量修改 - 不存在就插入
func (*GoEs) DocDeleteBy ¶ added in v1.2.142
文档 - 删除 - 根据条件 即时没有符合条件的文档,也不会报404错误
func (*GoEs) DocMultiGet ¶ added in v1.2.142
func (cli *GoEs) DocMultiGet(index string, ids []string, m interface{}) (resp *elastic.MgetResponse, err error)
文档 - 查询文档 - 根据ID集合
func (*GoEs) DocSearch ¶ added in v1.2.142
func (cli *GoEs) DocSearch(index string, query elastic.Query, p *Pagination) (resp *elastic.SearchResult, err error)
文档 - 搜索文档 - 根据条件
func (*GoEs) DocSearchBoolQuery ¶ added in v1.2.142
func (cli *GoEs) DocSearchBoolQuery(action BoolQueryAction, queries ...elastic.Query) *elastic.BoolQuery
文档 - 搜索条件 - bool 组合查找 must 条件必须要满足,并将对分数起作用 filter 条件必须要满足,但又不同于 must 子句,在 filter context 中执行,这意味着忽略评分,并考虑使用缓存。效率会高于 must should 条件应该满足。可以通过 minimum_should_match 参数指定应该满足的条件个数。如果 bool 查询包含 should 子句,并且没有 must 和 filter 子句,则默认值为 1,否则默认值为 0 must_not 条件必须不能满足。在 filter context 中执行,这意味着评分被忽略,并考虑使用缓存。因为评分被忽略,所以会返回所有 0 分的文档
func (*GoEs) DocSearchExistsQuery ¶ added in v1.2.142
文档 - 搜索条件 - 判断某个字段是否存在
func (*GoEs) DocSearchMatchQuery ¶ added in v1.2.142
文档 - 搜索条件 - 匹配查找,单字段搜索(匹配分词结果)
func (*GoEs) DocSearchRangeQuery ¶ added in v1.2.142
文档 - 搜索条件 - 范围查找
func (*GoEs) DocSearchScriptQuery ¶ added in v1.2.142
func (cli *GoEs) DocSearchScriptQuery(script *elastic.Script) *elastic.ScriptQuery
文档 - 搜索条件 - 脚本查询
func (*GoEs) DocSearchTermQuery ¶ added in v1.2.142
文档 - 搜索条件 - 精确匹配单个字段
func (*GoEs) DocSearchTermsQuery ¶ added in v1.2.142
文档 - 搜索条件 - 精确匹配多个字段
func (*GoEs) DocUpdate ¶ added in v1.2.142
func (cli *GoEs) DocUpdate(index, id string, body interface{}) (response *elastic.UpdateResponse, err error)
文档 - 修改
func (*GoEs) DocUpdateBy ¶ added in v1.2.142
func (cli *GoEs) DocUpdateBy(index string, query elastic.Query, script *elastic.Script) (total int64, err error)
文档 - 修改 - 根据条件
func (*GoEs) DocUpset ¶ added in v1.2.142
func (cli *GoEs) DocUpset(index, id string, body interface{}) (response *elastic.UpdateResponse, err error)
文档 - 修改 - 不存在就插入
func (*GoEs) IndexAlias ¶ added in v1.2.142
索引 - 别名 - 添加
func (*GoEs) IndexAliasRemove ¶ added in v1.2.142
索引 - 别名 - 删除
func (*GoEs) IndexCreate ¶ added in v1.2.142
索引 - 创建
func (*GoEs) IndexDelete ¶ added in v1.2.142
索引 - 删除
func (*GoEs) IndexExists ¶ added in v1.2.142
索引 - 是否存在
func (*GoEs) IndexMapping ¶ added in v1.2.142
索引 - 查看 - 文档结构
func (*GoEs) IndexNames ¶ added in v1.2.142
索引 - 所有索引名称
func (*GoEs) IndexSettings ¶ added in v1.2.142
func (cli *GoEs) IndexSettings(index string) (map[string]*elastic.IndicesGetSettingsResponse, error)
索引 - 查看 - 索引设置
func (*GoEs) IndexUpdateMapping ¶ added in v1.2.142
索引 - 修改 - 文档结构
func (*GoEs) IndexUpdateSettings ¶ added in v1.2.142
func (cli *GoEs) IndexUpdateSettings(index, body string) (*elastic.IndicesPutSettingsResponse, error)
索引 - 修改 - 索引设置