es

package
v0.0.0-...-3ee71c1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2014 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK  = '2'
	AND = "AND"
	OR  = "OR"
)
View Source
const (
	Asc  = "asc"
	Desc = "desc"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Analysis

type Analysis struct {
	Analyzer Analyzer `json:"analyzer"`
}

type Analyzer

type Analyzer struct {
	Default AnalyzerType `json:"default"`
}

type AnalyzerType

type AnalyzerType struct {
	Type      string `json:"type,omitempty"`
	Tokenizer string `json:"tokenizer,omitempty"`
}

type BulkIndexJob

type BulkIndexJob struct {
	Key    string
	Type   string
	Index  string
	Record interface{}
}

type DateHistogram

type DateHistogram struct {
	Field      string `json:"field,omitempty"`
	Interval   string `json:"interval,omitempty"`
	ValueField string `json:"value_field,omitempty"`
}

type DateHistogramFacet

type DateHistogramFacet struct {
	Type    string                     `json:"term,omitempty"`
	Entries []*DateHistogramFacetEntry `json:"entries,omitempty"`
}

func (*DateHistogramFacet) Load

func (dhf *DateHistogramFacet) Load(m map[string]interface{}) error

type DateHistogramFacetEntry

type DateHistogramFacetEntry struct {
	Time       int64 `json:"time,omitempty"`
	Count      int64 `json:"time,omitempty"`
	Min        float64
	Max        float64
	Total      int64
	TotalCount int64
	Mean       float64
}

type Doc

type Doc struct {
	Index  string
	Type   string
	Id     string
	Source interface{}
}

func (*Doc) IndexAttributes

func (doc *Doc) IndexAttributes() map[string]string

type DynamicTemplate

type DynamicTemplate struct {
	Match            string                  `json:"match,omitempty"`
	MatchMappingType string                  `json:"match_mapping_type,omitempty"`
	Mapping          *DynamicTemplateMapping `json:"mapping,omitempty"`
}

type DynamicTemplateMapping

type DynamicTemplateMapping struct {
	Type   string `json:"type,omitempty"`
	Index  string `json:"index,omitempty"`
	Format string `json:"format,omitempty"`
}

type DynamicTemplates

type DynamicTemplates []map[string]DynamicTemplate

type Entries

type Entries []*Entry

type Entry

type Entry struct {
	TimestampMicros int64   `json:"time"`
	Count           int64   `json:"count"`
	Min             float64 `json:"min,omitempty"`
	Max             float64 `json:"max,omitempty"`
	Total           float64 `json:"total,omitempty"`
	TotalCount      int64   `json:"total_count,omitempty"`
	Mean            float64 `json:"mean,omitempty"`
}

func (*Entry) Timestamp

func (entry *Entry) Timestamp() int64

type Facet

type Facet struct {
	Type           string      `json:"_type,omitempty"`
	Missing        int         `json:"missing,omitempty"`
	Total          int         `json:"total,omitempty"`
	Other          int         `json:"other,omitempty"`
	Terms          *FacetTerms `json:"terms,omitempty"`
	*Entries       `json:"entries,omitempty"`
	*DateHistogram `json:"date_histogram,omitempty"`
	Statistical    *StatisticalFacet `json:"statistical,omitempty"`
}

type FacetResponseTerm

type FacetResponseTerm struct {
	Term  interface{}
	Count int64
}

type FacetResponseTerms

type FacetResponseTerms []*FacetResponseTerm

type FacetTerm

type FacetTerm struct {
	Term  interface{} `json:"term"`
	Count int         `json:"count"`
}

type FacetTerms

type FacetTerms struct {
	Field   string        `json:"field,omitempty"`
	Size    int           `json:"size,omitempty"`
	Exclude []interface{} `json:"exclude,omitempty"`
}

type Facets

type Facets map[string]*Facet

type Filter

type Filter struct {
	And   []*Filter         `json:"and,omitempty`
	Term  *Term             `json:"term,omitempty"`
	Terms *Terms            `json:"term,omitempty"`
	Range map[string]*Range `json:"range,omitempty"`
}

type Filtered

type Filtered struct {
	Filter *Filter
}

type Hit

type Hit struct {
	Index  string  `json:"_index"`
	Type   string  `json:"_type"`
	Id     string  `json:"_id"`
	Score  float64 `json:"_score"`
	Source Source  `json:"_source"`
}

type Hits

type Hits struct {
	Total    int     `json:"total"`
	MaxScore float64 `json:"max_score"`
	Hits     []*Hit  `json:"hits"`
}

type HttpResponse

type HttpResponse struct {
	*http.Response
	Body []byte
}

type Index

type Index struct {
	Host  string
	Port  int
	Index string
	Type  string

	BatchSize int
	Debug     bool
	Logger    Logger
	// contains filtered or unexported fields
}

func (*Index) BaseUrl

func (index *Index) BaseUrl() string

func (*Index) CreateIndex

func (index *Index) CreateIndex(config IndexConfig) (rsp *HttpResponse, e error)

func (*Index) DeleteByQuery

func (index *Index) DeleteByQuery(query string) (b []byte, e error)

func (*Index) DeleteIndex

func (index *Index) DeleteIndex() error

func (*Index) EnqueueBulkIndex

func (index *Index) EnqueueBulkIndex(key string, record interface{}) (bool, error)

func (*Index) EnqueueDoc

func (index *Index) EnqueueDoc(doc *Doc) (indexed bool, e error)

func (*Index) GlobalMapping

func (index *Index) GlobalMapping() (m *Mapping, e error)

func (*Index) IndexDocs

func (index *Index) IndexDocs(docs []*Doc) error

func (*Index) IndexExists

func (index *Index) IndexExists() (exists bool, e error)

func (*Index) IndexUrl

func (index *Index) IndexUrl() string

func (*Index) LogDebug

func (index *Index) LogDebug(format string, i ...interface{})

func (*Index) LogInfo

func (index *Index) LogInfo(format string, i ...interface{})

func (*Index) Mapping

func (index *Index) Mapping() (i interface{}, e error)

func (*Index) Post

func (index *Index) Post(u string, i interface{}) (*HttpResponse, error)

func (*Index) PostObject

func (index *Index) PostObject(i interface{}) (*HttpResponse, error)

func (*Index) Put

func (index *Index) Put(u string, i interface{}) (*HttpResponse, error)

func (*Index) PutMapping

func (index *Index) PutMapping(mapping interface{}) (rsp *HttpResponse, e error)

func (*Index) PutObject

func (index *Index) PutObject(id string, i interface{}) (*HttpResponse, error)

func (*Index) Refresh

func (index *Index) Refresh() error

func (*Index) ResetBatch

func (index *Index) ResetBatch()

func (*Index) RunBatchIndex

func (index *Index) RunBatchIndex() error

func (*Index) Search

func (index *Index) Search(req *Request) (rsp *Response, e error)

func (*Index) Status

func (index *Index) Status() (status *Status, e error)

func (*Index) TypeUrl

func (index *Index) TypeUrl() string

type IndexConfig

type IndexConfig struct {
	Index IndexIndexConfig `json:"index"`
}

func KeywordIndex

func KeywordIndex() IndexConfig

type IndexIndexConfig

type IndexIndexConfig struct {
	Analysis Analysis `json:"analysis"`
}

type IndexMapping

type IndexMapping struct {
	Properties *IndexMappingProperties
}

type IndexMappingProperties

type IndexMappingProperties map[string]IndexMappingProperty

type IndexMappingProperty

type IndexMappingProperty struct {
	Type   string `json:"type"`
	Format string `json:"format,omitempty"`
}

type IndexMappings

type IndexMappings map[string]*IndexMapping

type Indexer

type Indexer struct {
	Index *Index

	IndexEvery time.Duration // triggers a new index run after that duration, will be reset when BatchSize reached
	BatchSize  int           // triggers a new index run when the batch reaches that size

	Stats IndexerStats
	// contains filtered or unexported fields
}

func (*Indexer) Finish

func (indexer *Indexer) Finish() error

func (*Indexer) Start

func (indexer *Indexer) Start() chan *Doc

type IndexerStats

type IndexerStats struct {
	Runs        int64
	IndexedDocs int64
	TotalTime   time.Duration
}

func (*IndexerStats) Add

func (stats *IndexerStats) Add(count int, dur time.Duration)

type Logger

type Logger interface {
	Debug(format string, i ...interface{})
	Info(format string, i ...interface{})
	Error(format string, i ...interface{})
}

type Mapping

type Mapping map[string]IndexMappings

func (Mapping) IndexNames

func (mapping Mapping) IndexNames() []string

type Query

type Query struct {
	Filtered    *Filtered    `json:"filtered,omitempty"`
	QueryString *QueryString `json:"query_string,omitempty"`
}

type QueryString

type QueryString struct {
	Query           string `json:"query,omitempty"`
	DefaultOperator string `json:"default_operator,omitempty"`
}

type Range

type Range struct {
	From interface{}
	To   interface{}
}

type Request

type Request struct {
	Index  string `json:"-"`
	Query  *Query `json:"query,omitempty"`
	Size   int    `json:"size"`
	Facets `json:"facets,omitempty"`
	*Sort  `json:"sort,omitempty"`
}

func (*Request) AddFacet

func (request *Request) AddFacet(key string, facet *Facet)

type RequestFacet

type RequestFacet struct {
	*Terms         `json:"terms,omitempty"`
	*DateHistogram `json:"date_histogram,omitempty"`
}

type Response

type Response struct {
	Took     int            `json:"took"`
	TimedOut bool           `json:"timed_out"`
	Facets   ResponseFacets `json:"facets"`
	Hits     Hits           `json:"hits"`
}

type ResponseFacet

type ResponseFacet struct {
	Type    string       `json:"_type"`
	Missing int          `json:"missing"`
	Total   int          `json:"total"`
	Other   int          `json:"other"`
	Terms   []*FacetTerm `json:"terms,omitempty"`
	Entries []*Entry     `json:"entries,omitempty"`
}

type ResponseFacets

type ResponseFacets map[string]*ResponseFacet

type Shards

type Shards struct {
	Total      int `json:"total"`
	Successful int `json:"successful"`
	Failed     int `json:"failed"`
}

type Sort

type Sort map[string]*SortCriteria

type SortCriteria

type SortCriteria struct {
	Order string `json:"order,omitempty"`
}

type Source

type Source map[string]interface{}

func (*Source) Unmarshal

func (source *Source) Unmarshal(i interface{}) error

type StatisticalFacet

type StatisticalFacet struct {
	Type         string  `json:"_type,omitempty"`
	Count        int64   `json:"count,omitempty"`
	Total        int64   `json:"total,omitempty"`
	Min          float64 `json:"min,omitempty"`
	Max          float64 `json:"max,omitempty"`
	Mean         float64 `json:"mean,omitempty"`
	SumOfSquares float64 `json:"sum_of_squares,omitempty"`
	Variance     float64 `json:"variance,omitempty"`
	StdDeviation float64 `json:"std_deviation,omitempty"`
}

func (*StatisticalFacet) Load

func (sf *StatisticalFacet) Load(m map[string]interface{}) error

type Status

type Status struct {
	Ok     bool    `json:"ok"`
	Shards *Shards `json:"_shards"`
}

type Term

type Term map[string]interface{}

type Terms

type Terms map[string][]interface{}

type TermsFacet

type TermsFacet struct {
	Type    string             `json:"_type,omitempty"`
	Missing int64              `json:"missing,omitempty"`
	Total   int64              `json:"total,omitempty"`
	Other   int64              `json:"other,omitempty"`
	Terms   FacetResponseTerms `json:"terms,omitempty"`
}

func (*TermsFacet) Load

func (tf *TermsFacet) Load(m map[string]interface{}) error

Jump to

Keyboard shortcuts

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