Documentation ¶
Index ¶
- type Elastic
- type ElasticFilter
- type ElasticQuery
- func (eq *ElasticQuery) Count() (rcount int64, rerr error)
- func (eq *ElasticQuery) From(num int) search.Query
- func (eq *ElasticQuery) Limit(num int) search.Query
- func (eq *ElasticQuery) NewAndFilter() search.FilterQuery
- func (eq *ElasticQuery) NewOrFilter() search.FilterQuery
- func (eq *ElasticQuery) Order(field string) search.Query
- func (eq *ElasticQuery) Run() (docs []x.Doc, rerr error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Elastic ¶
type Elastic struct {
// contains filtered or unexported fields
}
Elastic encapsulates elastic search client, and implements methods declared by search.Engine.
func (*Elastic) Init ¶
Init initializes connection to Elastic Search instance, checks for existence of "gocrud" index and creates it, if missing. Note that Init does NOT do mapping necessary to do exact-value term matching for strings etc. That needs to be done externally.
type ElasticFilter ¶
type ElasticFilter struct {
// contains filtered or unexported fields
}
func (*ElasticFilter) AddExact ¶
func (ef *ElasticFilter) AddExact(field string, value interface{}) search.FilterQuery
AddExact implemented by ElasticSearch uses the 'term' directive. Note that with strings, this might not return exact match results, if the index is set to pre-process strings, which it does by default. In other words, for string term-exact matches to work, you need to set the mapping to "index": "not_analyzed". https://www.elastic.co/guide/en/elasticsearch/guide/current/mapping-intro.html
func (*ElasticFilter) AddRegex ¶
func (ef *ElasticFilter) AddRegex(field string, value string) search.FilterQuery
AddRegex uses regex filter directive.
type ElasticQuery ¶
type ElasticQuery struct {
// contains filtered or unexported fields
}
ElasticQuery implements methods declared by search.Query.
func (*ElasticQuery) Count ¶
func (eq *ElasticQuery) Count() (rcount int64, rerr error)
func (*ElasticQuery) From ¶
func (eq *ElasticQuery) From(num int) search.Query
From sets the offset.
func (*ElasticQuery) Limit ¶
func (eq *ElasticQuery) Limit(num int) search.Query
Limit limits the number of results to num.
func (*ElasticQuery) NewAndFilter ¶
func (eq *ElasticQuery) NewAndFilter() search.FilterQuery
func (*ElasticQuery) NewOrFilter ¶
func (eq *ElasticQuery) NewOrFilter() search.FilterQuery