代码拉取完成,页面将自动刷新
package elastic
import (
"github.com/olivere/elastic"
)
var Client *elastic.Client
type SearchResult elastic.SearchResult
//func init() {
// elastic_host := "http://" + config.C.Elastic.Host + ":" + config.C.Elastic.Port
// elastic_user := config.C.Elastic.User
// elastic_password := config.C.Elastic.Password
// var sniff = false //<4>
// cfg := &esconfig.Config{
// URL: elastic_host,
// Username: elastic_user,
// Password: elastic_password,
// }
//
// cfg.Sniff = &sniff
// Client, _ = elastic.NewClientFromConfig(cfg)
//}
// 精确查询
func NewBoolQuery() *elastic.BoolQuery {
return elastic.NewBoolQuery()
}
func NewMatchQuery(name string, text interface{}) *elastic.MatchQuery {
return elastic.NewMatchQuery(name, text)
}
func NewMatchPhraseQuery(name string, value interface{}) *elastic.MatchPhraseQuery {
return elastic.NewMatchPhraseQuery(name, value)
}
func NewQueryStringQuery(queryString string) *elastic.QueryStringQuery {
return elastic.NewQueryStringQuery(queryString)
}
func NewWildcardQuery(name string, wildcard string) *elastic.WildcardQuery {
return elastic.NewWildcardQuery(name, wildcard)
}
func NewTermQuery(name string, value interface{}) *elastic.TermQuery {
return elastic.NewTermQuery(name, value)
}
func NewTermsQuery(name string, value ...interface{}) *elastic.TermsQuery {
return elastic.NewTermsQuery(name, value...)
}
// 范围查询
func NewRangeQuery(name string) *elastic.RangeQuery {
return elastic.NewRangeQuery(name)
}
func NewDateRangeAggregation() *elastic.DateRangeAggregation {
return elastic.NewDateRangeAggregation()
}
// 模糊查询
func NewFuzzyQuery(name string, value interface{}) *elastic.FuzzyQuery {
return elastic.NewFuzzyQuery(name, value)
}
// 通过多个字段查询
func NewMultiMatchQuery(text interface{}, field ...string) *elastic.MultiMatchQuery {
return elastic.NewMultiMatchQuery(text, field...)
}
func NewHasChildQuery(childType string, query elastic.Query) *elastic.HasChildQuery {
return elastic.NewHasChildQuery(childType, query)
}
func NewHasParentQuery(parentType string, query elastic.Query) *elastic.HasParentQuery {
return elastic.NewHasParentQuery(parentType, query)
}
func NewFilterAggregation() *elastic.FilterAggregation {
return elastic.NewFilterAggregation()
}
func NewScriptQuery(script string) *elastic.ScriptQuery {
esscript := elastic.NewScript(script)
return elastic.NewScriptQuery(esscript)
}
func NewExistsQuery(name string) *elastic.ExistsQuery {
return elastic.NewExistsQuery(name)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。