elasticsearch

package
v0.0.0-...-8c72124 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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) DropIndex

func (es *Elastic) DropIndex() error

DropIndex is useful for testing purposes.

func (*Elastic) Init

func (es *Elastic) Init(args ...string)

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.

func (*Elastic) NewQuery

func (es *Elastic) NewQuery(kind string) search.Query

NewQuery creates a new query object, to return results of type kind.

func (*Elastic) Update

func (es *Elastic) Update(doc x.Doc) error

Update checks the validify of given document, and the. external versioning via the timestamp of the document.

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

func (*ElasticQuery) Order

func (eq *ElasticQuery) Order(field string) search.Query

Order sorts the results for the given field.

func (*ElasticQuery) Run

func (eq *ElasticQuery) Run() (docs []x.Doc, rerr error)

Run runs the query and returns results and error, if any.

Jump to

Keyboard shortcuts

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