Documentation ¶
Index ¶
- Variables
- func AddToIndex(c ElasticConnector, index string, source interface{}) (err error)
- func Clear(c ElasticConnector, toDelete ...string) (err error)
- func CreateDynamicMapping(c ElasticConnector) (err error)
- func CreateIndex(c ElasticConnector, name string, def IndexDef) (err error)
- func CreateIndexTemplate(c ElasticConnector, name string, def IndexDef) (err error)
- func RemoveFromIndex(c ElasticConnector, index string, source interface{}) (err error)
- func SearchAndCopy(c ElasticSearchContext, query *SearchRequest, index string, result interface{}) (err error)
- func UpdateDoc(c ElasticConnector, index string, id key.Key, groovyCode string, ...) (err error)
- type AggRequest
- type AggregationResult
- type AggregationTermCountBucket
- type AggregationTermCountResult
- type Analyzer
- type Analyzers
- type BoolFilter
- type BoolQuery
- type CardinalityAggRequest
- type DynamicTemplate
- type ElasticConnector
- type ElasticDoc
- type ElasticSearchContext
- type FacetRequest
- type FacetResponse
- type Filter
- type FilteredQuery
- type Hits
- type IndexDef
- type IndexOption
- type Mapping
- type MatchAllQuery
- type MissingFilter
- type PageableItems
- type Properties
- type Query
- type RangeDef
- type SearchRequest
- type SearchResponse
- type Settings
- type SimpleStringQuery
- type Sort
- type Sources
- type StringQuery
- type TermFacetResponse
- type TermsAggRequest
- type TermsFacetRequest
- type UpdateRequest
- type ValueCountAggRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var IndexNameProcessor = func(s string) string {
return s
}
View Source
var UpdateConflictRetries = 10
Functions ¶
func AddToIndex ¶
func AddToIndex(c ElasticConnector, index string, source interface{}) (err error)
AddToIndex adds source to a search index. Source must have a field `Id *datastore.key`.
func Clear ¶
func Clear(c ElasticConnector, toDelete ...string) (err error)
Clear will delete things. If toDelete is empty, EVERYTHING will be deleted. If toDelete has one element, that index will be deleted. If toDelete has two elements, that index and doc type will be deleted.
func CreateDynamicMapping ¶
func CreateDynamicMapping(c ElasticConnector) (err error)
CreateDynamicMapping will create a sane default dynamic mapping where all string type fields are indexed twice, once analyzed under their proper name, and once non-analyzed under [name].na
func CreateIndex ¶
func CreateIndex(c ElasticConnector, name string, def IndexDef) (err error)
func CreateIndexTemplate ¶
func CreateIndexTemplate(c ElasticConnector, name string, def IndexDef) (err error)
func RemoveFromIndex ¶
func RemoveFromIndex(c ElasticConnector, index string, source interface{}) (err error)
func SearchAndCopy ¶
func SearchAndCopy(c ElasticSearchContext, query *SearchRequest, index string, result interface{}) (err error)
Types ¶
type AggRequest ¶
type AggRequest struct { ValueCount *ValueCountAggRequest `json:"value_count,omitempty"` Cardinality *CardinalityAggRequest `json:"cardinality,omitempty"` Terms *TermsAggRequest `json:"terms,omitempty"` Aggs map[string]AggRequest `json:"aggs,omitempty"` Filter *Filter `json:"filter,omitempty"` }
type AggregationResult ¶
type AggregationResult struct { Value int `json:"value,omitempty"` DocCount int `json:"doc_count,omitempty"` TermCount AggregationTermCountResult `json:"termcount,omitempty"` }
type AggregationTermCountResult ¶
type AggregationTermCountResult struct {
Buckets []AggregationTermCountBucket `json:"buckets"`
}
type BoolFilter ¶
type CardinalityAggRequest ¶
type CardinalityAggRequest struct {
Field string `json:"field"`
}
type DynamicTemplate ¶
type DynamicTemplate struct { Match string `json:"match"` MatchMappingType string `json:"match_mapping_type"` Mapping *Properties `json:"mapping,omitempty"` }
type ElasticConnector ¶
type ElasticDoc ¶
type ElasticSearchContext ¶
type ElasticSearchContext interface { ElasticConnector Debugf(format string, args ...interface{}) }
type FacetRequest ¶
type FacetRequest struct {
Terms *TermsFacetRequest `json:"terms,omitempty"`
}
type FacetResponse ¶
type FacetResponse struct { Type string `json:"_type"` Missing int `json:"missing"` Total int `json:"total"` Other int `json:"other"` Terms []TermFacetResponse `json:"terms"` }
type Filter ¶
type Filter struct { Or []Query `json:"or,omitempty"` Query *Query `json:"query,omitempty"` Bool *BoolFilter `json:"bool,omitempty"` Term map[string]interface{} `json:"term,omitempty"` Range map[string]RangeDef `json:"range,omitempty"` Missing *MissingFilter `json:"missing,omitempty"` }
type FilteredQuery ¶
type Hits ¶
type Hits struct { Total int `json:"total"` MaxScore float64 `json:"max_score"` Hits []ElasticDoc `json:"hits"` }
type IndexOption ¶
type IndexOption string
const ( AnalyzedIndex IndexOption = "analyzed" NotAnalyzedIndex IndexOption = "not_analyzed" NoIndex IndexOption = "no" )
type Mapping ¶
type Mapping struct { DynamicTemplates []map[string]DynamicTemplate `json:"dynamic_templates,omitempty"` Properties map[string]Properties `json:"properties,omitempty"` }
type MatchAllQuery ¶
type MatchAllQuery struct {
Boost float64 `json:"boost,omitempty"`
}
type MissingFilter ¶
type MissingFilter struct {
Field string `json:"field"`
}
type PageableItems ¶
type Properties ¶
type Properties struct { Type string `json:"type"` Index IndexOption `json:"index,omitempty"` Store bool `json:"store"` Fields map[string]Properties `json:"fields,omitempty"` Analyzer string `json:"analyzer,omitempty"` }
type Query ¶
type Query struct { String *StringQuery `json:"query_string,omitempty"` SimpleString *SimpleStringQuery `json:"simple_query_string,omitempty"` Term map[string]string `json:"term,omitempty"` Range map[string]RangeDef `json:"range,omitempty"` Bool *BoolQuery `json:"bool,omitempty"` Filtered *FilteredQuery `json:"filtered,omitempty"` MatchAll *MatchAllQuery `json:"match_all,omitempty"` Ids map[string]interface{} `json:"ids,omitempty"` }
type SearchRequest ¶
type SearchRequest struct { Query *Query `json:"query,omitempty"` From int `json:"from,omitempty"` Size int `json:"size,omitempty"` Sort []map[string]Sort `json:"sort,omitempty"` Facets map[string]FacetRequest `json:"facets,omitempty"` Aggs map[string]AggRequest `json:"aggs,omitempty"` }
type SearchResponse ¶
type SearchResponse struct { Took float64 `json:"took"` Hits Hits `json:"hits"` Facets map[string]FacetResponse `json:"facets,omitempty"` Page int `json:"page"` PerPage int `json:"per_page"` Aggregations map[string]AggregationResult `json:"aggregations,omitempty"` }
func Search ¶
func Search(c ElasticSearchContext, query *SearchRequest, index, typ string) (result *SearchResponse, err error)
func (*SearchResponse) Copy ¶
func (self *SearchResponse) Copy(result interface{}) (err error)
type SimpleStringQuery ¶
type SimpleStringQuery StringQuery
type Sources ¶
type Sources []map[string]*json.RawMessage
type StringQuery ¶
type TermFacetResponse ¶
type TermsAggRequest ¶
type TermsAggRequest struct {
Field string `json:"field"`
}
type TermsFacetRequest ¶
type UpdateRequest ¶
type ValueCountAggRequest ¶
type ValueCountAggRequest struct {
Field string `json:"field"`
}
Click to show internal directories.
Click to hide internal directories.