Documentation ¶
Overview ¶
Example ¶
package main import ( "context" "encoding/json" "fmt" "log" "os" "reflect" "time" elastic "github.com/venicegeo/pz-gocommon/elasticsearch/elastic-5-api" ) type Tweet struct { User string `json:"user"` Message string `json:"message"` Retweets int `json:"retweets"` Image string `json:"image,omitempty"` Created time.Time `json:"created,omitempty"` Tags []string `json:"tags,omitempty"` Location string `json:"location,omitempty"` } func main() { errorlog := log.New(os.Stdout, "APP ", log.LstdFlags) // Obtain a client. You can also provide your own HTTP client here. client, err := elastic.NewClient(elastic.SetErrorLog(errorlog)) if err != nil { // Handle error panic(err) } // Trace request and response details like this //client.SetTracer(log.New(os.Stdout, "", 0)) // Ping the Elasticsearch server to get e.g. the version number info, code, err := client.Ping("http://127.0.0.1:9200").Do(context.Background()) if err != nil { // Handle error panic(err) } fmt.Printf("Elasticsearch returned with code %d and version %s\n", code, info.Version.Number) // Getting the ES version number is quite common, so there's a shortcut esversion, err := client.ElasticsearchVersion("http://127.0.0.1:9200") if err != nil { // Handle error panic(err) } fmt.Printf("Elasticsearch version %s\n", esversion) // Use the IndexExists service to check if a specified index exists. exists, err := client.IndexExists("twitter").Do(context.Background()) if err != nil { // Handle error panic(err) } if !exists { // Create a new index. mapping := ` { "settings":{ "number_of_shards":1, "number_of_replicas":0 }, "mappings":{ "_default_": { "_all": { "enabled": true } }, "tweet":{ "properties":{ "user":{ "type":"keyword" }, "message":{ "type":"text", "store": true, "fielddata": true }, "retweets":{ "type":"long" }, "tags":{ "type":"keyword" }, "location":{ "type":"geo_point" }, "suggest_field":{ "type":"completion" } } } } } ` createIndex, err := client.CreateIndex("twitter").Body(mapping).Do(context.Background()) if err != nil { // Handle error panic(err) } if !createIndex.Acknowledged { // Not acknowledged } } // Index a tweet (using JSON serialization) tweet1 := Tweet{User: "olivere", Message: "Take Five", Retweets: 0} put1, err := client.Index(). Index("twitter"). Type("tweet"). Id("1"). BodyJson(tweet1). Do(context.Background()) if err != nil { // Handle error panic(err) } fmt.Printf("Indexed tweet %s to index %s, type %s\n", put1.Id, put1.Index, put1.Type) // Index a second tweet (by string) tweet2 := `{"user" : "olivere", "message" : "It's a Raggy Waltz"}` put2, err := client.Index(). Index("twitter"). Type("tweet"). Id("2"). BodyString(tweet2). Do(context.Background()) if err != nil { // Handle error panic(err) } fmt.Printf("Indexed tweet %s to index %s, type %s\n", put2.Id, put2.Index, put2.Type) // Get tweet with specified ID get1, err := client.Get(). Index("twitter"). Type("tweet"). Id("1"). Do(context.Background()) if err != nil { // Handle error panic(err) } if get1.Found { fmt.Printf("Got document %s in version %d from index %s, type %s\n", get1.Id, get1.Version, get1.Index, get1.Type) } // Flush to make sure the documents got written. _, err = client.Flush().Index("twitter").Do(context.Background()) if err != nil { panic(err) } // Search with a term query termQuery := elastic.NewTermQuery("user", "olivere") searchResult, err := client.Search(). Index("twitter"). // search in index "twitter" Query(termQuery). // specify the query Sort("user", true). // sort by "user" field, ascending From(0).Size(10). // take documents 0-9 Pretty(true). // pretty print request and response JSON Do(context.Background()) // execute if err != nil { // Handle error panic(err) } // searchResult is of type SearchResult and returns hits, suggestions, // and all kinds of other information from Elasticsearch. fmt.Printf("Query took %d milliseconds\n", searchResult.TookInMillis) // Each is a convenience function that iterates over hits in a search result. // It makes sure you don't need to check for nil values in the response. // However, it ignores errors in serialization. If you want full control // over iterating the hits, see below. var ttyp Tweet for _, item := range searchResult.Each(reflect.TypeOf(ttyp)) { t := item.(Tweet) fmt.Printf("Tweet by %s: %s\n", t.User, t.Message) } // TotalHits is another convenience function that works even when something goes wrong. fmt.Printf("Found a total of %d tweets\n", searchResult.TotalHits()) // Here's how you iterate through results with full control over each step. if searchResult.Hits.TotalHits > 0 { fmt.Printf("Found a total of %d tweets\n", searchResult.Hits.TotalHits) // Iterate through results for _, hit := range searchResult.Hits.Hits { // hit.Index contains the name of the index // Deserialize hit.Source into a Tweet (could also be just a map[string]interface{}). var t Tweet err := json.Unmarshal(*hit.Source, &t) if err != nil { // Deserialization failed } // Work with tweet fmt.Printf("Tweet by %s: %s\n", t.User, t.Message) } } else { // No hits fmt.Print("Found no tweets\n") } // ... // Delete an index. deleteIndex, err := client.DeleteIndex("twitter").Do(context.Background()) if err != nil { // Handle error panic(err) } if !deleteIndex.Acknowledged { // Not acknowledged } }
Output:
Index ¶
- Constants
- Variables
- func IsConnErr(err error) bool
- func IsNotFound(err interface{}) bool
- func IsTimeout(err interface{}) bool
- func Retry(o Operation, b Backoff) error
- func RetryNotify(operation Operation, b Backoff, notify Notify) error
- type AcknowledgedResponse
- type Aggregation
- type AggregationBucketFilters
- type AggregationBucketHistogramItem
- type AggregationBucketHistogramItems
- type AggregationBucketKeyItem
- type AggregationBucketKeyItems
- type AggregationBucketKeyedRangeItems
- type AggregationBucketRangeItem
- type AggregationBucketRangeItems
- type AggregationBucketSignificantTerm
- type AggregationBucketSignificantTerms
- type AggregationExtendedStatsMetric
- type AggregationGeoBoundsMetric
- type AggregationMatrixStats
- type AggregationMatrixStatsField
- type AggregationPercentilesMetric
- type AggregationPipelineBucketMetricValue
- type AggregationPipelineDerivative
- type AggregationPipelineSimpleValue
- type AggregationPipelineStatsMetric
- type AggregationSingleBucket
- type AggregationStatsMetric
- type AggregationTopHitsMetric
- type AggregationValueMetric
- type Aggregations
- func (a Aggregations) Avg(name string) (*AggregationValueMetric, bool)
- func (a Aggregations) AvgBucket(name string) (*AggregationPipelineSimpleValue, bool)
- func (a Aggregations) BucketScript(name string) (*AggregationPipelineSimpleValue, bool)
- func (a Aggregations) Cardinality(name string) (*AggregationValueMetric, bool)
- func (a Aggregations) Children(name string) (*AggregationSingleBucket, bool)
- func (a Aggregations) CumulativeSum(name string) (*AggregationPipelineSimpleValue, bool)
- func (a Aggregations) DateHistogram(name string) (*AggregationBucketHistogramItems, bool)
- func (a Aggregations) DateRange(name string) (*AggregationBucketRangeItems, bool)
- func (a Aggregations) Derivative(name string) (*AggregationPipelineDerivative, bool)
- func (a Aggregations) ExtendedStats(name string) (*AggregationExtendedStatsMetric, bool)
- func (a Aggregations) Filter(name string) (*AggregationSingleBucket, bool)
- func (a Aggregations) Filters(name string) (*AggregationBucketFilters, bool)
- func (a Aggregations) GeoBounds(name string) (*AggregationGeoBoundsMetric, bool)
- func (a Aggregations) GeoDistance(name string) (*AggregationBucketRangeItems, bool)
- func (a Aggregations) GeoHash(name string) (*AggregationBucketKeyItems, bool)
- func (a Aggregations) Global(name string) (*AggregationSingleBucket, bool)
- func (a Aggregations) Histogram(name string) (*AggregationBucketHistogramItems, bool)
- func (a Aggregations) IPv4Range(name string) (*AggregationBucketRangeItems, bool)
- func (a Aggregations) KeyedRange(name string) (*AggregationBucketKeyedRangeItems, bool)
- func (a Aggregations) MatrixStats(name string) (*AggregationMatrixStats, bool)
- func (a Aggregations) Max(name string) (*AggregationValueMetric, bool)
- func (a Aggregations) MaxBucket(name string) (*AggregationPipelineBucketMetricValue, bool)
- func (a Aggregations) Min(name string) (*AggregationValueMetric, bool)
- func (a Aggregations) MinBucket(name string) (*AggregationPipelineBucketMetricValue, bool)
- func (a Aggregations) Missing(name string) (*AggregationSingleBucket, bool)
- func (a Aggregations) MovAvg(name string) (*AggregationPipelineSimpleValue, bool)
- func (a Aggregations) Nested(name string) (*AggregationSingleBucket, bool)
- func (a Aggregations) PercentileRanks(name string) (*AggregationPercentilesMetric, bool)
- func (a Aggregations) Percentiles(name string) (*AggregationPercentilesMetric, bool)
- func (a Aggregations) Range(name string) (*AggregationBucketRangeItems, bool)
- func (a Aggregations) ReverseNested(name string) (*AggregationSingleBucket, bool)
- func (a Aggregations) Sampler(name string) (*AggregationSingleBucket, bool)
- func (a Aggregations) SerialDiff(name string) (*AggregationPipelineSimpleValue, bool)
- func (a Aggregations) SignificantTerms(name string) (*AggregationBucketSignificantTerms, bool)
- func (a Aggregations) Stats(name string) (*AggregationStatsMetric, bool)
- func (a Aggregations) StatsBucket(name string) (*AggregationPipelineStatsMetric, bool)
- func (a Aggregations) Sum(name string) (*AggregationValueMetric, bool)
- func (a Aggregations) SumBucket(name string) (*AggregationPipelineSimpleValue, bool)
- func (a Aggregations) Terms(name string) (*AggregationBucketKeyItems, bool)
- func (a Aggregations) TopHits(name string) (*AggregationTopHitsMetric, bool)
- func (a Aggregations) ValueCount(name string) (*AggregationValueMetric, bool)
- type AliasAction
- type AliasAddAction
- func (a *AliasAddAction) Filter(filter Query) *AliasAddAction
- func (a *AliasAddAction) Index(index ...string) *AliasAddAction
- func (a *AliasAddAction) IndexRouting(routing string) *AliasAddAction
- func (a *AliasAddAction) Routing(routing string) *AliasAddAction
- func (a *AliasAddAction) SearchRouting(routing ...string) *AliasAddAction
- func (a *AliasAddAction) Source() (interface{}, error)
- func (a *AliasAddAction) Validate() error
- type AliasRemoveAction
- type AliasResult
- type AliasService
- func (s *AliasService) Action(action ...AliasAction) *AliasService
- func (s *AliasService) Add(indexName string, aliasName string) *AliasService
- func (s *AliasService) AddWithFilter(indexName string, aliasName string, filter Query) *AliasService
- func (s *AliasService) Do(ctx context.Context) (*AliasResult, error)
- func (s *AliasService) Pretty(pretty bool) *AliasService
- func (s *AliasService) Remove(indexName string, aliasName string) *AliasService
- type Backoff
- type BackoffFunc
- type BackoffRetrier
- type Client
- func (c *Client) Alias() *AliasService
- func (c *Client) CloseIndex(name string) *IndicesCloseService
- func (c *Client) Count(indices ...string) *CountService
- func (c *Client) CreateIndex(name string) *IndicesCreateService
- func (c *Client) Delete() *DeleteService
- func (c *Client) DeleteIndex(indices ...string) *IndicesDeleteService
- func (c *Client) ElasticsearchVersion(url string) (string, error)
- func (c *Client) Exists() *ExistsService
- func (c *Client) Flush(indices ...string) *IndicesFlushService
- func (c *Client) Get() *GetService
- func (c *Client) GetFieldMapping() *IndicesGetFieldMappingService
- func (c *Client) GetMapping() *IndicesGetMappingService
- func (c *Client) Index() *IndexService
- func (c *Client) IndexExists(indices ...string) *IndicesExistsService
- func (c *Client) IndexGet(indices ...string) *IndicesGetService
- func (c *Client) IndexGetSettings(indices ...string) *IndicesGetSettingsService
- func (c *Client) IndexNames() ([]string, error)
- func (c *Client) IsRunning() bool
- func (c *Client) NodesInfo() *NodesInfoService
- func (c *Client) OpenIndex(name string) *IndicesOpenService
- func (c *Client) PerformRequest(ctx context.Context, method, path string, params url.Values, body interface{}, ...) (*Response, error)
- func (c *Client) Ping(url string) *PingService
- func (c *Client) PutMapping() *IndicesPutMappingService
- func (c *Client) Refresh(indices ...string) *RefreshService
- func (c *Client) Search(indices ...string) *SearchService
- func (c *Client) Start()
- func (c *Client) Stop()
- func (c *Client) String() string
- func (c *Client) TypeExists() *IndicesExistsTypeService
- func (c *Client) Update() *UpdateService
- type ClientOptionFunc
- func SetBasicAuth(username, password string) ClientOptionFunc
- func SetDecoder(decoder Decoder) ClientOptionFunc
- func SetErrorLog(logger Logger) ClientOptionFunc
- func SetGzip(enabled bool) ClientOptionFunc
- func SetHealthcheck(enabled bool) ClientOptionFunc
- func SetHealthcheckInterval(interval time.Duration) ClientOptionFunc
- func SetHealthcheckTimeout(timeout time.Duration) ClientOptionFunc
- func SetHealthcheckTimeoutStartup(timeout time.Duration) ClientOptionFunc
- func SetHttpClient(httpClient *http.Client) ClientOptionFunc
- func SetInfoLog(logger Logger) ClientOptionFunc
- func SetMaxRetries(maxRetries int) ClientOptionFuncdeprecated
- func SetRequiredPlugins(plugins ...string) ClientOptionFunc
- func SetRetrier(retrier Retrier) ClientOptionFunc
- func SetScheme(scheme string) ClientOptionFunc
- func SetSendGetBodyAs(httpMethod string) ClientOptionFunc
- func SetSniff(enabled bool) ClientOptionFunc
- func SetSnifferCallback(f SnifferCallback) ClientOptionFunc
- func SetSnifferInterval(interval time.Duration) ClientOptionFunc
- func SetSnifferTimeout(timeout time.Duration) ClientOptionFunc
- func SetSnifferTimeoutStartup(timeout time.Duration) ClientOptionFunc
- func SetTraceLog(logger Logger) ClientOptionFunc
- func SetURL(urls ...string) ClientOptionFunc
- type ClusterHealthResponse
- type ClusterHealthService
- func (s *ClusterHealthService) Do(ctx context.Context) (*ClusterHealthResponse, error)
- func (s *ClusterHealthService) Index(indices ...string) *ClusterHealthService
- func (s *ClusterHealthService) Level(level string) *ClusterHealthService
- func (s *ClusterHealthService) Local(local bool) *ClusterHealthService
- func (s *ClusterHealthService) MasterTimeout(masterTimeout string) *ClusterHealthService
- func (s *ClusterHealthService) Pretty(pretty bool) *ClusterHealthService
- func (s *ClusterHealthService) Timeout(timeout string) *ClusterHealthService
- func (s *ClusterHealthService) Validate() error
- func (s *ClusterHealthService) WaitForActiveShards(waitForActiveShards int) *ClusterHealthService
- func (s *ClusterHealthService) WaitForGreenStatus() *ClusterHealthService
- func (s *ClusterHealthService) WaitForNoRelocatingShards(waitForNoRelocatingShards bool) *ClusterHealthService
- func (s *ClusterHealthService) WaitForNodes(waitForNodes string) *ClusterHealthService
- func (s *ClusterHealthService) WaitForStatus(waitForStatus string) *ClusterHealthService
- func (s *ClusterHealthService) WaitForYellowStatus() *ClusterHealthService
- type ClusterIndexHealth
- type ClusterShardHealth
- type CollectorResult
- type ConstantBackoff
- type CountResponse
- type CountService
- func (s *CountService) AllowNoIndices(allowNoIndices bool) *CountService
- func (s *CountService) AnalyzeWildcard(analyzeWildcard bool) *CountService
- func (s *CountService) Analyzer(analyzer string) *CountService
- func (s *CountService) BodyJson(body interface{}) *CountService
- func (s *CountService) BodyString(body string) *CountService
- func (s *CountService) DefaultOperator(defaultOperator string) *CountService
- func (s *CountService) Df(df string) *CountService
- func (s *CountService) Do(ctx context.Context) (int64, error)
- func (s *CountService) ExpandWildcards(expandWildcards string) *CountService
- func (s *CountService) IgnoreUnavailable(ignoreUnavailable bool) *CountService
- func (s *CountService) Index(index ...string) *CountService
- func (s *CountService) Lenient(lenient bool) *CountService
- func (s *CountService) LowercaseExpandedTerms(lowercaseExpandedTerms bool) *CountService
- func (s *CountService) MinScore(minScore interface{}) *CountService
- func (s *CountService) Preference(preference string) *CountService
- func (s *CountService) Pretty(pretty bool) *CountService
- func (s *CountService) Q(q string) *CountService
- func (s *CountService) Query(query Query) *CountService
- func (s *CountService) Routing(routing string) *CountService
- func (s *CountService) Type(typ ...string) *CountService
- func (s *CountService) Validate() error
- type Decoder
- type DefaultDecoder
- type DeleteResponse
- type DeleteService
- func (s *DeleteService) Do(ctx context.Context) (*DeleteResponse, error)
- func (s *DeleteService) Id(id string) *DeleteService
- func (s *DeleteService) Index(index string) *DeleteService
- func (s *DeleteService) Parent(parent string) *DeleteService
- func (s *DeleteService) Pretty(pretty bool) *DeleteService
- func (s *DeleteService) Refresh(refresh string) *DeleteService
- func (s *DeleteService) Routing(routing string) *DeleteService
- func (s *DeleteService) Timeout(timeout string) *DeleteService
- func (s *DeleteService) Type(typ string) *DeleteService
- func (s *DeleteService) Validate() error
- func (s *DeleteService) Version(version interface{}) *DeleteService
- func (s *DeleteService) VersionType(versionType string) *DeleteService
- func (s *DeleteService) WaitForActiveShards(waitForActiveShards string) *DeleteService
- type Error
- type ErrorDetails
- type ExistsService
- func (s *ExistsService) Do(ctx context.Context) (bool, error)
- func (s *ExistsService) Id(id string) *ExistsService
- func (s *ExistsService) Index(index string) *ExistsService
- func (s *ExistsService) Parent(parent string) *ExistsService
- func (s *ExistsService) Preference(preference string) *ExistsService
- func (s *ExistsService) Pretty(pretty bool) *ExistsService
- func (s *ExistsService) Realtime(realtime bool) *ExistsService
- func (s *ExistsService) Refresh(refresh string) *ExistsService
- func (s *ExistsService) Routing(routing string) *ExistsService
- func (s *ExistsService) Type(typ string) *ExistsService
- func (s *ExistsService) Validate() error
- type ExponentialBackoff
- type FetchSourceContext
- func (fsc *FetchSourceContext) Exclude(excludes ...string) *FetchSourceContext
- func (fsc *FetchSourceContext) FetchSource() bool
- func (fsc *FetchSourceContext) Include(includes ...string) *FetchSourceContext
- func (fsc *FetchSourceContext) Query() url.Values
- func (fsc *FetchSourceContext) SetFetchSource(fetchSource bool)
- func (fsc *FetchSourceContext) Source() (interface{}, error)
- func (fsc *FetchSourceContext) TransformSource(transformSource bool) *FetchSourceContext
- type FieldSort
- func (s *FieldSort) Asc() *FieldSort
- func (s *FieldSort) Desc() *FieldSort
- func (s *FieldSort) FieldName(fieldName string) *FieldSort
- func (s *FieldSort) IgnoreUnmapped(ignoreUnmapped bool) *FieldSort
- func (s *FieldSort) Missing(missing interface{}) *FieldSort
- func (s *FieldSort) NestedFilter(nestedFilter Query) *FieldSort
- func (s *FieldSort) NestedPath(nestedPath string) *FieldSort
- func (s *FieldSort) Order(ascending bool) *FieldSort
- func (s *FieldSort) SortMode(sortMode string) *FieldSort
- func (s *FieldSort) Source() (interface{}, error)
- func (s *FieldSort) UnmappedType(typ string) *FieldSort
- type GetResult
- type GetService
- func (s *GetService) Do(ctx context.Context) (*GetResult, error)
- func (s *GetService) FetchSource(fetchSource bool) *GetService
- func (s *GetService) FetchSourceContext(fetchSourceContext *FetchSourceContext) *GetService
- func (s *GetService) Id(id string) *GetService
- func (s *GetService) IgnoreErrorsOnGeneratedFields(ignore bool) *GetService
- func (s *GetService) Index(index string) *GetService
- func (s *GetService) Parent(parent string) *GetService
- func (s *GetService) Preference(preference string) *GetService
- func (s *GetService) Pretty(pretty bool) *GetService
- func (s *GetService) Realtime(realtime bool) *GetService
- func (s *GetService) Refresh(refresh string) *GetService
- func (s *GetService) Routing(routing string) *GetService
- func (s *GetService) StoredFields(storedFields ...string) *GetService
- func (s *GetService) Type(typ string) *GetService
- func (s *GetService) Validate() error
- func (s *GetService) Version(version interface{}) *GetService
- func (s *GetService) VersionType(versionType string) *GetService
- type Highlight
- func (hl *Highlight) BoundaryChars(boundaryChars string) *Highlight
- func (hl *Highlight) BoundaryMaxScan(boundaryMaxScan int) *Highlight
- func (hl *Highlight) Encoder(encoder string) *Highlight
- func (hl *Highlight) Field(name string) *Highlight
- func (hl *Highlight) Fields(fields ...*HighlighterField) *Highlight
- func (hl *Highlight) ForceSource(forceSource bool) *Highlight
- func (hl *Highlight) FragmentSize(fragmentSize int) *Highlight
- func (hl *Highlight) Fragmenter(fragmenter string) *Highlight
- func (hl *Highlight) HighlighQuery(highlightQuery Query) *Highlight
- func (hl *Highlight) HighlightFilter(highlightFilter bool) *Highlight
- func (hl *Highlight) HighlighterType(highlighterType string) *Highlight
- func (hl *Highlight) NoMatchSize(noMatchSize int) *Highlight
- func (hl *Highlight) NumOfFragments(numOfFragments int) *Highlight
- func (hl *Highlight) Options(options map[string]interface{}) *Highlight
- func (hl *Highlight) Order(order string) *Highlight
- func (hl *Highlight) PostTags(postTags ...string) *Highlight
- func (hl *Highlight) PreTags(preTags ...string) *Highlight
- func (hl *Highlight) RequireFieldMatch(requireFieldMatch bool) *Highlight
- func (hl *Highlight) Source() (interface{}, error)
- func (hl *Highlight) TagsSchema(schemaName string) *Highlight
- func (hl *Highlight) UseExplicitFieldOrder(useExplicitFieldOrder bool) *Highlight
- type HighlighterField
- func (f *HighlighterField) BoundaryChars(boundaryChars ...rune) *HighlighterField
- func (f *HighlighterField) BoundaryMaxScan(boundaryMaxScan int) *HighlighterField
- func (f *HighlighterField) ForceSource(forceSource bool) *HighlighterField
- func (f *HighlighterField) FragmentOffset(fragmentOffset int) *HighlighterField
- func (f *HighlighterField) FragmentSize(fragmentSize int) *HighlighterField
- func (f *HighlighterField) Fragmenter(fragmenter string) *HighlighterField
- func (f *HighlighterField) HighlightFilter(highlightFilter bool) *HighlighterField
- func (f *HighlighterField) HighlightQuery(highlightQuery Query) *HighlighterField
- func (f *HighlighterField) HighlighterType(highlighterType string) *HighlighterField
- func (f *HighlighterField) MatchedFields(matchedFields ...string) *HighlighterField
- func (f *HighlighterField) NoMatchSize(noMatchSize int) *HighlighterField
- func (f *HighlighterField) NumOfFragments(numOfFragments int) *HighlighterField
- func (f *HighlighterField) Options(options map[string]interface{}) *HighlighterField
- func (f *HighlighterField) Order(order string) *HighlighterField
- func (f *HighlighterField) PhraseLimit(phraseLimit int) *HighlighterField
- func (f *HighlighterField) PostTags(postTags ...string) *HighlighterField
- func (f *HighlighterField) PreTags(preTags ...string) *HighlighterField
- func (f *HighlighterField) RequireFieldMatch(requireFieldMatch bool) *HighlighterField
- func (f *HighlighterField) Source() (interface{}, error)
- type IndexResponse
- type IndexService
- func (s *IndexService) BodyJson(body interface{}) *IndexService
- func (s *IndexService) BodyString(body string) *IndexService
- func (s *IndexService) Do(ctx context.Context) (*IndexResponse, error)
- func (s *IndexService) Id(id string) *IndexService
- func (s *IndexService) Index(index string) *IndexService
- func (s *IndexService) OpType(opType string) *IndexService
- func (s *IndexService) Parent(parent string) *IndexService
- func (s *IndexService) Pipeline(pipeline string) *IndexService
- func (s *IndexService) Pretty(pretty bool) *IndexService
- func (s *IndexService) Refresh(refresh string) *IndexService
- func (s *IndexService) Routing(routing string) *IndexService
- func (s *IndexService) TTL(ttl string) *IndexService
- func (s *IndexService) Timeout(timeout string) *IndexService
- func (s *IndexService) Timestamp(timestamp string) *IndexService
- func (s *IndexService) Ttl(ttl string) *IndexService
- func (s *IndexService) Type(typ string) *IndexService
- func (s *IndexService) Validate() error
- func (s *IndexService) Version(version interface{}) *IndexService
- func (s *IndexService) VersionType(versionType string) *IndexService
- func (s *IndexService) WaitForActiveShards(waitForActiveShards string) *IndexService
- type IndicesCloseResponse
- type IndicesCloseService
- func (s *IndicesCloseService) AllowNoIndices(allowNoIndices bool) *IndicesCloseService
- func (s *IndicesCloseService) Do(ctx context.Context) (*IndicesCloseResponse, error)
- func (s *IndicesCloseService) ExpandWildcards(expandWildcards string) *IndicesCloseService
- func (s *IndicesCloseService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesCloseService
- func (s *IndicesCloseService) Index(index string) *IndicesCloseService
- func (s *IndicesCloseService) MasterTimeout(masterTimeout string) *IndicesCloseService
- func (s *IndicesCloseService) Pretty(pretty bool) *IndicesCloseService
- func (s *IndicesCloseService) Timeout(timeout string) *IndicesCloseService
- func (s *IndicesCloseService) Validate() error
- type IndicesCreateResult
- type IndicesCreateService
- func (b *IndicesCreateService) Body(body string) *IndicesCreateService
- func (b *IndicesCreateService) BodyJson(body interface{}) *IndicesCreateService
- func (b *IndicesCreateService) BodyString(body string) *IndicesCreateService
- func (b *IndicesCreateService) Do(ctx context.Context) (*IndicesCreateResult, error)
- func (b *IndicesCreateService) Index(index string) *IndicesCreateService
- func (s *IndicesCreateService) MasterTimeout(masterTimeout string) *IndicesCreateService
- func (b *IndicesCreateService) Pretty(pretty bool) *IndicesCreateService
- func (s *IndicesCreateService) Timeout(timeout string) *IndicesCreateService
- type IndicesDeleteResponse
- type IndicesDeleteService
- func (s *IndicesDeleteService) Do(ctx context.Context) (*IndicesDeleteResponse, error)
- func (s *IndicesDeleteService) Index(index []string) *IndicesDeleteService
- func (s *IndicesDeleteService) MasterTimeout(masterTimeout string) *IndicesDeleteService
- func (s *IndicesDeleteService) Pretty(pretty bool) *IndicesDeleteService
- func (s *IndicesDeleteService) Timeout(timeout string) *IndicesDeleteService
- func (s *IndicesDeleteService) Validate() error
- type IndicesExistsService
- func (s *IndicesExistsService) AllowNoIndices(allowNoIndices bool) *IndicesExistsService
- func (s *IndicesExistsService) Do(ctx context.Context) (bool, error)
- func (s *IndicesExistsService) ExpandWildcards(expandWildcards string) *IndicesExistsService
- func (s *IndicesExistsService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesExistsService
- func (s *IndicesExistsService) Index(index []string) *IndicesExistsService
- func (s *IndicesExistsService) Local(local bool) *IndicesExistsService
- func (s *IndicesExistsService) Pretty(pretty bool) *IndicesExistsService
- func (s *IndicesExistsService) Validate() error
- type IndicesExistsTypeService
- func (s *IndicesExistsTypeService) AllowNoIndices(allowNoIndices bool) *IndicesExistsTypeService
- func (s *IndicesExistsTypeService) Do(ctx context.Context) (bool, error)
- func (s *IndicesExistsTypeService) ExpandWildcards(expandWildcards string) *IndicesExistsTypeService
- func (s *IndicesExistsTypeService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesExistsTypeService
- func (s *IndicesExistsTypeService) Index(indices ...string) *IndicesExistsTypeService
- func (s *IndicesExistsTypeService) Local(local bool) *IndicesExistsTypeService
- func (s *IndicesExistsTypeService) Pretty(pretty bool) *IndicesExistsTypeService
- func (s *IndicesExistsTypeService) Type(types ...string) *IndicesExistsTypeService
- func (s *IndicesExistsTypeService) Validate() error
- type IndicesFlushResponse
- type IndicesFlushService
- func (s *IndicesFlushService) AllowNoIndices(allowNoIndices bool) *IndicesFlushService
- func (s *IndicesFlushService) Do(ctx context.Context) (*IndicesFlushResponse, error)
- func (s *IndicesFlushService) ExpandWildcards(expandWildcards string) *IndicesFlushService
- func (s *IndicesFlushService) Force(force bool) *IndicesFlushService
- func (s *IndicesFlushService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesFlushService
- func (s *IndicesFlushService) Index(indices ...string) *IndicesFlushService
- func (s *IndicesFlushService) Pretty(pretty bool) *IndicesFlushService
- func (s *IndicesFlushService) Validate() error
- func (s *IndicesFlushService) WaitIfOngoing(waitIfOngoing bool) *IndicesFlushService
- type IndicesGetFieldMappingService
- func (s *IndicesGetFieldMappingService) AllowNoIndices(allowNoIndices bool) *IndicesGetFieldMappingService
- func (s *IndicesGetFieldMappingService) Do(ctx context.Context) (map[string]interface{}, error)
- func (s *IndicesGetFieldMappingService) ExpandWildcards(expandWildcards string) *IndicesGetFieldMappingService
- func (s *IndicesGetFieldMappingService) Field(fields ...string) *IndicesGetFieldMappingService
- func (s *IndicesGetFieldMappingService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesGetFieldMappingService
- func (s *IndicesGetFieldMappingService) Index(indices ...string) *IndicesGetFieldMappingService
- func (s *IndicesGetFieldMappingService) Local(local bool) *IndicesGetFieldMappingService
- func (s *IndicesGetFieldMappingService) Pretty(pretty bool) *IndicesGetFieldMappingService
- func (s *IndicesGetFieldMappingService) Type(types ...string) *IndicesGetFieldMappingService
- func (s *IndicesGetFieldMappingService) Validate() error
- type IndicesGetMappingService
- func (s *IndicesGetMappingService) AllowNoIndices(allowNoIndices bool) *IndicesGetMappingService
- func (s *IndicesGetMappingService) Do(ctx context.Context) (map[string]interface{}, error)
- func (s *IndicesGetMappingService) ExpandWildcards(expandWildcards string) *IndicesGetMappingService
- func (s *IndicesGetMappingService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesGetMappingService
- func (s *IndicesGetMappingService) Index(indices ...string) *IndicesGetMappingService
- func (s *IndicesGetMappingService) Local(local bool) *IndicesGetMappingService
- func (s *IndicesGetMappingService) Pretty(pretty bool) *IndicesGetMappingService
- func (s *IndicesGetMappingService) Type(types ...string) *IndicesGetMappingService
- func (s *IndicesGetMappingService) Validate() error
- type IndicesGetResponse
- type IndicesGetService
- func (s *IndicesGetService) AllowNoIndices(allowNoIndices bool) *IndicesGetService
- func (s *IndicesGetService) Do(ctx context.Context) (map[string]*IndicesGetResponse, error)
- func (s *IndicesGetService) ExpandWildcards(expandWildcards string) *IndicesGetService
- func (s *IndicesGetService) Feature(features ...string) *IndicesGetService
- func (s *IndicesGetService) Human(human bool) *IndicesGetService
- func (s *IndicesGetService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesGetService
- func (s *IndicesGetService) Index(indices ...string) *IndicesGetService
- func (s *IndicesGetService) Local(local bool) *IndicesGetService
- func (s *IndicesGetService) Pretty(pretty bool) *IndicesGetService
- func (s *IndicesGetService) Validate() error
- type IndicesGetSettingsResponse
- type IndicesGetSettingsService
- func (s *IndicesGetSettingsService) AllowNoIndices(allowNoIndices bool) *IndicesGetSettingsService
- func (s *IndicesGetSettingsService) Do(ctx context.Context) (map[string]*IndicesGetSettingsResponse, error)
- func (s *IndicesGetSettingsService) ExpandWildcards(expandWildcards string) *IndicesGetSettingsService
- func (s *IndicesGetSettingsService) FlatSettings(flatSettings bool) *IndicesGetSettingsService
- func (s *IndicesGetSettingsService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesGetSettingsService
- func (s *IndicesGetSettingsService) Index(indices ...string) *IndicesGetSettingsService
- func (s *IndicesGetSettingsService) Local(local bool) *IndicesGetSettingsService
- func (s *IndicesGetSettingsService) Name(name ...string) *IndicesGetSettingsService
- func (s *IndicesGetSettingsService) Pretty(pretty bool) *IndicesGetSettingsService
- func (s *IndicesGetSettingsService) Validate() error
- type IndicesOpenResponse
- type IndicesOpenService
- func (s *IndicesOpenService) AllowNoIndices(allowNoIndices bool) *IndicesOpenService
- func (s *IndicesOpenService) Do(ctx context.Context) (*IndicesOpenResponse, error)
- func (s *IndicesOpenService) ExpandWildcards(expandWildcards string) *IndicesOpenService
- func (s *IndicesOpenService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesOpenService
- func (s *IndicesOpenService) Index(index string) *IndicesOpenService
- func (s *IndicesOpenService) MasterTimeout(masterTimeout string) *IndicesOpenService
- func (s *IndicesOpenService) Pretty(pretty bool) *IndicesOpenService
- func (s *IndicesOpenService) Timeout(timeout string) *IndicesOpenService
- func (s *IndicesOpenService) Validate() error
- type IndicesPutMappingService
- func (s *IndicesPutMappingService) AllowNoIndices(allowNoIndices bool) *IndicesPutMappingService
- func (s *IndicesPutMappingService) BodyJson(mapping map[string]interface{}) *IndicesPutMappingService
- func (s *IndicesPutMappingService) BodyString(mapping string) *IndicesPutMappingService
- func (s *IndicesPutMappingService) Do(ctx context.Context) (*PutMappingResponse, error)
- func (s *IndicesPutMappingService) ExpandWildcards(expandWildcards string) *IndicesPutMappingService
- func (s *IndicesPutMappingService) IgnoreConflicts(ignoreConflicts bool) *IndicesPutMappingService
- func (s *IndicesPutMappingService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesPutMappingService
- func (s *IndicesPutMappingService) Index(indices ...string) *IndicesPutMappingService
- func (s *IndicesPutMappingService) MasterTimeout(masterTimeout string) *IndicesPutMappingService
- func (s *IndicesPutMappingService) Pretty(pretty bool) *IndicesPutMappingService
- func (s *IndicesPutMappingService) Timeout(timeout string) *IndicesPutMappingService
- func (s *IndicesPutMappingService) Type(typ string) *IndicesPutMappingService
- func (s *IndicesPutMappingService) Validate() error
- type InnerHit
- func (hit *InnerHit) DocvalueField(docvalueField string) *InnerHit
- func (hit *InnerHit) DocvalueFields(docvalueFields ...string) *InnerHit
- func (hit *InnerHit) Explain(explain bool) *InnerHit
- func (hit *InnerHit) FetchSource(fetchSource bool) *InnerHit
- func (hit *InnerHit) FetchSourceContext(fetchSourceContext *FetchSourceContext) *InnerHit
- func (hit *InnerHit) From(from int) *InnerHit
- func (hit *InnerHit) Highlight(highlight *Highlight) *InnerHit
- func (hit *InnerHit) Highlighter() *Highlight
- func (hit *InnerHit) Name(name string) *InnerHit
- func (hit *InnerHit) NoStoredFields() *InnerHit
- func (hit *InnerHit) Path(path string) *InnerHit
- func (hit *InnerHit) Query(query Query) *InnerHit
- func (hit *InnerHit) Size(size int) *InnerHit
- func (hit *InnerHit) Sort(field string, ascending bool) *InnerHit
- func (hit *InnerHit) SortBy(sorter ...Sorter) *InnerHit
- func (hit *InnerHit) SortWithInfo(info SortInfo) *InnerHit
- func (hit *InnerHit) Source() (interface{}, error)
- func (hit *InnerHit) StoredField(storedFieldName string) *InnerHit
- func (hit *InnerHit) StoredFields(storedFieldNames ...string) *InnerHit
- func (hit *InnerHit) TrackScores(trackScores bool) *InnerHit
- func (hit *InnerHit) Type(typ string) *InnerHit
- func (hit *InnerHit) Version(version bool) *InnerHit
- type Logger
- type MatchAllQuery
- type MatchQuery
- func (q *MatchQuery) Analyzer(analyzer string) *MatchQuery
- func (q *MatchQuery) Boost(boost float64) *MatchQuery
- func (q *MatchQuery) CutoffFrequency(cutoff float64) *MatchQuery
- func (q *MatchQuery) Fuzziness(fuzziness string) *MatchQuery
- func (q *MatchQuery) FuzzyRewrite(fuzzyRewrite string) *MatchQuery
- func (q *MatchQuery) FuzzyTranspositions(fuzzyTranspositions bool) *MatchQuery
- func (q *MatchQuery) Lenient(lenient bool) *MatchQuery
- func (q *MatchQuery) MaxExpansions(maxExpansions int) *MatchQuery
- func (q *MatchQuery) MinimumShouldMatch(minimumShouldMatch string) *MatchQuery
- func (q *MatchQuery) Operator(operator string) *MatchQuery
- func (q *MatchQuery) PrefixLength(prefixLength int) *MatchQuery
- func (q *MatchQuery) QueryName(queryName string) *MatchQuery
- func (q *MatchQuery) Rewrite(rewrite string) *MatchQuery
- func (q *MatchQuery) Slop(slop int) *MatchQuery
- func (q *MatchQuery) Source() (interface{}, error)
- func (q *MatchQuery) Type(typ string) *MatchQuery
- func (q *MatchQuery) ZeroTermsQuery(zeroTermsQuery string) *MatchQuery
- type NodesInfoNode
- type NodesInfoNodeHTTP
- type NodesInfoNodeJVM
- type NodesInfoNodeNetwork
- type NodesInfoNodeOS
- type NodesInfoNodePlugin
- type NodesInfoNodeProcess
- type NodesInfoNodeThreadPool
- type NodesInfoNodeThreadPoolSection
- type NodesInfoNodeTransport
- type NodesInfoNodeTransportProfile
- type NodesInfoResponse
- type NodesInfoService
- func (s *NodesInfoService) Do(ctx context.Context) (*NodesInfoResponse, error)
- func (s *NodesInfoService) FlatSettings(flatSettings bool) *NodesInfoService
- func (s *NodesInfoService) Human(human bool) *NodesInfoService
- func (s *NodesInfoService) Metric(metric ...string) *NodesInfoService
- func (s *NodesInfoService) NodeId(nodeId ...string) *NodesInfoService
- func (s *NodesInfoService) Pretty(pretty bool) *NodesInfoService
- func (s *NodesInfoService) Validate() error
- type Notify
- type Operation
- type PingResult
- type PingService
- func (s *PingService) Do(ctx context.Context) (*PingResult, int, error)
- func (s *PingService) HttpHeadOnly(httpHeadOnly bool) *PingService
- func (s *PingService) Pretty(pretty bool) *PingService
- func (s *PingService) Timeout(timeout string) *PingService
- func (s *PingService) URL(url string) *PingService
- type ProfileResult
- type PutMappingResponse
- type Query
- type QueryProfileShardResult
- type QueryRescorer
- func (r *QueryRescorer) Name() string
- func (r *QueryRescorer) QueryWeight(queryWeight float64) *QueryRescorer
- func (r *QueryRescorer) RescoreQueryWeight(rescoreQueryWeight float64) *QueryRescorer
- func (r *QueryRescorer) ScoreMode(scoreMode string) *QueryRescorer
- func (r *QueryRescorer) Source() (interface{}, error)
- type RefreshResult
- type RefreshService
- type Request
- type Rescore
- type Rescorer
- type Response
- type Retrier
- type RetrierFunc
- type ScoreSort
- type SearchExplanation
- type SearchHit
- type SearchHitHighlight
- type SearchHitInnerHits
- type SearchHits
- type SearchProfile
- type SearchProfileShardResult
- type SearchRequest
- func (s *SearchRequest) AllowNoIndices(allowNoIndices bool) *SearchRequest
- func (s *SearchRequest) ExpandWildcards(expandWildcards string) *SearchRequest
- func (r *SearchRequest) HasIndices() bool
- func (s *SearchRequest) IgnoreUnavailable(ignoreUnavailable bool) *SearchRequest
- func (r *SearchRequest) Index(indices ...string) *SearchRequest
- func (r *SearchRequest) Preference(preference string) *SearchRequest
- func (r *SearchRequest) RequestCache(requestCache bool) *SearchRequest
- func (r *SearchRequest) Routing(routing string) *SearchRequest
- func (r *SearchRequest) Routings(routings ...string) *SearchRequest
- func (r *SearchRequest) Scroll(scroll string) *SearchRequest
- func (r *SearchRequest) SearchSource(searchSource *SearchSource) *SearchRequest
- func (r *SearchRequest) SearchType(searchType string) *SearchRequest
- func (r *SearchRequest) SearchTypeCount() *SearchRequest
- func (r *SearchRequest) SearchTypeDfsQueryAndFetch() *SearchRequest
- func (r *SearchRequest) SearchTypeDfsQueryThenFetch() *SearchRequest
- func (r *SearchRequest) SearchTypeQueryAndFetch() *SearchRequest
- func (r *SearchRequest) SearchTypeQueryThenFetch() *SearchRequest
- func (r *SearchRequest) SearchTypeScan() *SearchRequest
- func (r *SearchRequest) Source(source interface{}) *SearchRequest
- func (r *SearchRequest) Type(types ...string) *SearchRequest
- type SearchResult
- type SearchService
- func (s *SearchService) Aggregation(name string, aggregation Aggregation) *SearchService
- func (s *SearchService) AllowNoIndices(allowNoIndices bool) *SearchService
- func (s *SearchService) Do(ctx context.Context) (*SearchResult, error)
- func (s *SearchService) ExpandWildcards(expandWildcards string) *SearchService
- func (s *SearchService) Explain(explain bool) *SearchService
- func (s *SearchService) FetchSource(fetchSource bool) *SearchService
- func (s *SearchService) FetchSourceContext(fetchSourceContext *FetchSourceContext) *SearchService
- func (s *SearchService) FilterPath(filterPath ...string) *SearchService
- func (s *SearchService) From(from int) *SearchService
- func (s *SearchService) GlobalSuggestText(globalText string) *SearchService
- func (s *SearchService) Highlight(highlight *Highlight) *SearchService
- func (s *SearchService) IgnoreUnavailable(ignoreUnavailable bool) *SearchService
- func (s *SearchService) Index(index ...string) *SearchService
- func (s *SearchService) MinScore(minScore float64) *SearchService
- func (s *SearchService) NoStoredFields() *SearchService
- func (s *SearchService) PostFilter(postFilter Query) *SearchService
- func (s *SearchService) Preference(preference string) *SearchService
- func (s *SearchService) Pretty(pretty bool) *SearchService
- func (s *SearchService) Profile(profile bool) *SearchService
- func (s *SearchService) Query(query Query) *SearchService
- func (s *SearchService) RequestCache(requestCache bool) *SearchService
- func (s *SearchService) Routing(routings ...string) *SearchService
- func (s *SearchService) SearchAfter(sortValues ...interface{}) *SearchService
- func (s *SearchService) SearchSource(searchSource *SearchSource) *SearchService
- func (s *SearchService) SearchType(searchType string) *SearchService
- func (s *SearchService) Size(size int) *SearchService
- func (s *SearchService) Sort(field string, ascending bool) *SearchService
- func (s *SearchService) SortBy(sorter ...Sorter) *SearchService
- func (s *SearchService) SortWithInfo(info SortInfo) *SearchService
- func (s *SearchService) Source(source interface{}) *SearchService
- func (s *SearchService) StoredField(fieldName string) *SearchService
- func (s *SearchService) StoredFields(fields ...string) *SearchService
- func (s *SearchService) Timeout(timeout string) *SearchService
- func (s *SearchService) TimeoutInMillis(timeoutInMillis int) *SearchService
- func (s *SearchService) Type(typ ...string) *SearchService
- func (s *SearchService) Validate() error
- func (s *SearchService) Version(version bool) *SearchService
- type SearchSource
- func (s *SearchSource) Aggregation(name string, aggregation Aggregation) *SearchSource
- func (s *SearchSource) ClearRescorers() *SearchSource
- func (s *SearchSource) DefaultRescoreWindowSize(defaultRescoreWindowSize int) *SearchSource
- func (s *SearchSource) DocvalueField(fieldDataField string) *SearchSource
- func (s *SearchSource) DocvalueFields(docvalueFields ...string) *SearchSource
- func (s *SearchSource) Explain(explain bool) *SearchSource
- func (s *SearchSource) FetchSource(fetchSource bool) *SearchSource
- func (s *SearchSource) FetchSourceContext(fetchSourceContext *FetchSourceContext) *SearchSource
- func (s *SearchSource) From(from int) *SearchSource
- func (s *SearchSource) GlobalSuggestText(text string) *SearchSource
- func (s *SearchSource) Highlight(highlight *Highlight) *SearchSource
- func (s *SearchSource) Highlighter() *Highlight
- func (s *SearchSource) IndexBoost(index string, boost float64) *SearchSource
- func (s *SearchSource) InnerHit(name string, innerHit *InnerHit) *SearchSource
- func (s *SearchSource) MinScore(minScore float64) *SearchSource
- func (s *SearchSource) NoStoredFields() *SearchSource
- func (s *SearchSource) PostFilter(postFilter Query) *SearchSource
- func (s *SearchSource) Profile(profile bool) *SearchSource
- func (s *SearchSource) Query(query Query) *SearchSource
- func (s *SearchSource) Rescorer(rescore *Rescore) *SearchSource
- func (s *SearchSource) SearchAfter(sortValues ...interface{}) *SearchSource
- func (s *SearchSource) Size(size int) *SearchSource
- func (s *SearchSource) Slice(sliceQuery Query) *SearchSource
- func (s *SearchSource) Sort(field string, ascending bool) *SearchSource
- func (s *SearchSource) SortBy(sorter ...Sorter) *SearchSource
- func (s *SearchSource) SortWithInfo(info SortInfo) *SearchSource
- func (s *SearchSource) Source() (interface{}, error)
- func (s *SearchSource) Stats(statsGroup ...string) *SearchSource
- func (s *SearchSource) StoredField(storedFieldName string) *SearchSource
- func (s *SearchSource) StoredFields(storedFieldNames ...string) *SearchSource
- func (s *SearchSource) TerminateAfter(terminateAfter int) *SearchSource
- func (s *SearchSource) Timeout(timeout string) *SearchSource
- func (s *SearchSource) TimeoutInMillis(timeoutInMillis int) *SearchSource
- func (s *SearchSource) TrackScores(trackScores bool) *SearchSource
- func (s *SearchSource) Version(version bool) *SearchSource
- type SearchSuggest
- type SearchSuggestion
- type SearchSuggestionOption
- type SimpleBackoff
- type SnifferCallback
- type SortByDoc
- type SortInfo
- type Sorter
- type StopBackoff
- type StopRetrier
- type TermQuery
- type UpdateResponse
- type UpdateService
- func (b *UpdateService) DetectNoop(detectNoop bool) *UpdateService
- func (b *UpdateService) Do(ctx context.Context) (*UpdateResponse, error)
- func (b *UpdateService) Doc(doc interface{}) *UpdateService
- func (b *UpdateService) DocAsUpsert(docAsUpsert bool) *UpdateService
- func (b *UpdateService) Fields(fields ...string) *UpdateService
- func (b *UpdateService) Id(id string) *UpdateService
- func (b *UpdateService) Index(name string) *UpdateService
- func (b *UpdateService) Parent(parent string) *UpdateService
- func (b *UpdateService) Pretty(pretty bool) *UpdateService
- func (b *UpdateService) Refresh(refresh string) *UpdateService
- func (b *UpdateService) RetryOnConflict(retryOnConflict int) *UpdateService
- func (b *UpdateService) Routing(routing string) *UpdateService
- func (b *UpdateService) ScriptedUpsert(scriptedUpsert bool) *UpdateService
- func (b *UpdateService) Timeout(timeout string) *UpdateService
- func (b *UpdateService) Type(typ string) *UpdateService
- func (b *UpdateService) Upsert(doc interface{}) *UpdateService
- func (b *UpdateService) Version(version int64) *UpdateService
- func (b *UpdateService) VersionType(versionType string) *UpdateService
- func (b *UpdateService) WaitForActiveShards(waitForActiveShards string) *UpdateService
- type ZeroBackoff
Examples ¶
Constants ¶
const ( // Version is the current version of Elastic. Version = "5.0.37" // DefaultURL is the default endpoint of Elasticsearch on the local machine. // It is used e.g. when initializing a new Client without a specific URL. DefaultURL = "http://127.0.0.1:9200" // DefaultScheme is the default protocol scheme to use when sniffing // the Elasticsearch cluster. DefaultScheme = "http" // DefaultHealthcheckEnabled specifies if healthchecks are enabled by default. DefaultHealthcheckEnabled = true // DefaultHealthcheckTimeoutStartup is the time the healthcheck waits // for a response from Elasticsearch on startup, i.e. when creating a // client. After the client is started, a shorter timeout is commonly used // (its default is specified in DefaultHealthcheckTimeout). DefaultHealthcheckTimeoutStartup = 5 * time.Second // DefaultHealthcheckTimeout specifies the time a running client waits for // a response from Elasticsearch. Notice that the healthcheck timeout // when a client is created is larger by default (see DefaultHealthcheckTimeoutStartup). DefaultHealthcheckTimeout = 1 * time.Second // DefaultHealthcheckInterval is the default interval between // two health checks of the nodes in the cluster. DefaultHealthcheckInterval = 60 * time.Second // DefaultSnifferEnabled specifies if the sniffer is enabled by default. DefaultSnifferEnabled = true // DefaultSnifferInterval is the interval between two sniffing procedures, // i.e. the lookup of all nodes in the cluster and their addition/removal // from the list of actual connections. DefaultSnifferInterval = 15 * time.Minute // DefaultSnifferTimeoutStartup is the default timeout for the sniffing // process that is initiated while creating a new client. For subsequent // sniffing processes, DefaultSnifferTimeout is used (by default). DefaultSnifferTimeoutStartup = 5 * time.Second // DefaultSnifferTimeout is the default timeout after which the // sniffing process times out. Notice that for the initial sniffing // process, DefaultSnifferTimeoutStartup is used. DefaultSnifferTimeout = 2 * time.Second // DefaultSendGetBodyAs is the HTTP method to use when elastic is sending // a GET request with a body. DefaultSendGetBodyAs = "GET" // DefaultGzipEnabled specifies if gzip compression is enabled by default. DefaultGzipEnabled = false )
Variables ¶
var ( // ErrNoClient is raised when no Elasticsearch node is available. ErrNoClient = errors.New("no Elasticsearch node available") // ErrRetry is raised when a request cannot be executed after the configured // number of retries. ErrRetry = errors.New("cannot connect after several retries") // ErrTimeout is raised when a request timed out, e.g. when WaitForStatus // didn't return in time. ErrTimeout = errors.New("timeout") )
Functions ¶
func IsConnErr ¶
IsConnError unwraps the given error value and checks if it is equal to elastic.ErrNoClient.
func IsNotFound ¶
func IsNotFound(err interface{}) bool
IsNotFound returns true if the given error indicates that Elasticsearch returned HTTP status 404. The err parameter can be of type *elastic.Error, elastic.Error, *http.Response or int (indicating the HTTP status code).
func IsTimeout ¶
func IsTimeout(err interface{}) bool
IsTimeout returns true if the given error indicates that Elasticsearch returned HTTP status 408. The err parameter can be of type *elastic.Error, elastic.Error, *http.Response or int (indicating the HTTP status code).
Types ¶
type AcknowledgedResponse ¶
type AcknowledgedResponse struct {
Acknowledged bool `json:"acknowledged"`
}
AcknowledgedResponse is returned from various APIs. It simply indicates whether the operation is ack'd or not.
type Aggregation ¶
type Aggregation interface { // Source returns a JSON-serializable aggregation that is a fragment // of the request sent to Elasticsearch. Source() (interface{}, error) }
Aggregations can be seen as a unit-of-work that build analytic information over a set of documents. It is (in many senses) the follow-up of facets in Elasticsearch. For more details about aggregations, visit: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations.html
type AggregationBucketFilters ¶
type AggregationBucketFilters struct { Aggregations Buckets []*AggregationBucketKeyItem //`json:"buckets"` NamedBuckets map[string]*AggregationBucketKeyItem //`json:"buckets"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationBucketFilters is a multi-bucket aggregation that is returned with a filters aggregation.
func (*AggregationBucketFilters) UnmarshalJSON ¶
func (a *AggregationBucketFilters) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationBucketFilters structure.
type AggregationBucketHistogramItem ¶
type AggregationBucketHistogramItem struct { Aggregations Key float64 //`json:"key"` KeyAsString *string //`json:"key_as_string"` DocCount int64 //`json:"doc_count"` }
AggregationBucketHistogramItem is a single bucket of an AggregationBucketHistogramItems structure.
func (*AggregationBucketHistogramItem) UnmarshalJSON ¶
func (a *AggregationBucketHistogramItem) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationBucketHistogramItem structure.
type AggregationBucketHistogramItems ¶
type AggregationBucketHistogramItems struct { Aggregations Buckets []*AggregationBucketHistogramItem //`json:"buckets"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationBucketHistogramItems is a bucket aggregation that is returned with a date histogram aggregation.
func (*AggregationBucketHistogramItems) UnmarshalJSON ¶
func (a *AggregationBucketHistogramItems) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationBucketHistogramItems structure.
type AggregationBucketKeyItem ¶
type AggregationBucketKeyItem struct { Aggregations Key interface{} //`json:"key"` KeyAsString *string //`json:"key_as_string"` KeyNumber json.Number DocCount int64 //`json:"doc_count"` }
AggregationBucketKeyItem is a single bucket of an AggregationBucketKeyItems structure.
func (*AggregationBucketKeyItem) UnmarshalJSON ¶
func (a *AggregationBucketKeyItem) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationBucketKeyItem structure.
type AggregationBucketKeyItems ¶
type AggregationBucketKeyItems struct { Aggregations DocCountErrorUpperBound int64 //`json:"doc_count_error_upper_bound"` SumOfOtherDocCount int64 //`json:"sum_other_doc_count"` Buckets []*AggregationBucketKeyItem //`json:"buckets"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationBucketKeyItems is a bucket aggregation that is e.g. returned with a terms aggregation.
func (*AggregationBucketKeyItems) UnmarshalJSON ¶
func (a *AggregationBucketKeyItems) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationBucketKeyItems structure.
type AggregationBucketKeyedRangeItems ¶
type AggregationBucketKeyedRangeItems struct { Aggregations DocCountErrorUpperBound int64 //`json:"doc_count_error_upper_bound"` SumOfOtherDocCount int64 //`json:"sum_other_doc_count"` Buckets map[string]*AggregationBucketRangeItem //`json:"buckets"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationBucketKeyedRangeItems is a bucket aggregation that is e.g. returned with a keyed range aggregation.
func (*AggregationBucketKeyedRangeItems) UnmarshalJSON ¶
func (a *AggregationBucketKeyedRangeItems) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationBucketRangeItems structure.
type AggregationBucketRangeItem ¶
type AggregationBucketRangeItem struct { Aggregations Key string //`json:"key"` DocCount int64 //`json:"doc_count"` From *float64 //`json:"from"` FromAsString string //`json:"from_as_string"` To *float64 //`json:"to"` ToAsString string //`json:"to_as_string"` }
AggregationBucketRangeItem is a single bucket of an AggregationBucketRangeItems structure.
func (*AggregationBucketRangeItem) UnmarshalJSON ¶
func (a *AggregationBucketRangeItem) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationBucketRangeItem structure.
type AggregationBucketRangeItems ¶
type AggregationBucketRangeItems struct { Aggregations DocCountErrorUpperBound int64 //`json:"doc_count_error_upper_bound"` SumOfOtherDocCount int64 //`json:"sum_other_doc_count"` Buckets []*AggregationBucketRangeItem //`json:"buckets"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationBucketRangeItems is a bucket aggregation that is e.g. returned with a range aggregation.
func (*AggregationBucketRangeItems) UnmarshalJSON ¶
func (a *AggregationBucketRangeItems) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationBucketRangeItems structure.
type AggregationBucketSignificantTerm ¶
type AggregationBucketSignificantTerm struct { Aggregations Key string //`json:"key"` DocCount int64 //`json:"doc_count"` BgCount int64 //`json:"bg_count"` Score float64 //`json:"score"` }
AggregationBucketSignificantTerm is a single bucket of an AggregationBucketSignificantTerms structure.
func (*AggregationBucketSignificantTerm) UnmarshalJSON ¶
func (a *AggregationBucketSignificantTerm) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationBucketSignificantTerm structure.
type AggregationBucketSignificantTerms ¶
type AggregationBucketSignificantTerms struct { Aggregations DocCount int64 //`json:"doc_count"` Buckets []*AggregationBucketSignificantTerm //`json:"buckets"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationBucketSignificantTerms is a bucket aggregation returned with a significant terms aggregation.
func (*AggregationBucketSignificantTerms) UnmarshalJSON ¶
func (a *AggregationBucketSignificantTerms) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationBucketSignificantTerms structure.
type AggregationExtendedStatsMetric ¶
type AggregationExtendedStatsMetric struct { Aggregations Count int64 // `json:"count"` Min *float64 //`json:"min,omitempty"` Max *float64 //`json:"max,omitempty"` Avg *float64 //`json:"avg,omitempty"` Sum *float64 //`json:"sum,omitempty"` SumOfSquares *float64 //`json:"sum_of_squares,omitempty"` Variance *float64 //`json:"variance,omitempty"` StdDeviation *float64 //`json:"std_deviation,omitempty"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationExtendedStatsMetric is a multi-value metric, returned by an ExtendedStats aggregation.
func (*AggregationExtendedStatsMetric) UnmarshalJSON ¶
func (a *AggregationExtendedStatsMetric) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationExtendedStatsMetric structure.
type AggregationGeoBoundsMetric ¶
type AggregationGeoBoundsMetric struct { Aggregations Bounds struct { TopLeft struct { Latitude float64 `json:"lat"` Longitude float64 `json:"lon"` } `json:"top_left"` BottomRight struct { Latitude float64 `json:"lat"` Longitude float64 `json:"lon"` } `json:"bottom_right"` } `json:"bounds"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationGeoBoundsMetric is a metric as returned by a GeoBounds aggregation.
func (*AggregationGeoBoundsMetric) UnmarshalJSON ¶
func (a *AggregationGeoBoundsMetric) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationGeoBoundsMetric structure.
type AggregationMatrixStats ¶
type AggregationMatrixStats struct { Aggregations Fields []*AggregationMatrixStatsField // `json:"field,omitempty"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationMatrixStats is returned by a MatrixStats aggregation.
func (*AggregationMatrixStats) UnmarshalJSON ¶
func (a *AggregationMatrixStats) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationMatrixStats structure.
type AggregationMatrixStatsField ¶
type AggregationMatrixStatsField struct { Name string `json:"name"` Count int64 `json:"count"` Mean float64 `json:"mean,omitempty"` Variance float64 `json:"variance,omitempty"` Skewness float64 `json:"skewness,omitempty"` Kurtosis float64 `json:"kurtosis,omitempty"` Covariance map[string]float64 `json:"covariance,omitempty"` Correlation map[string]float64 `json:"correlation,omitempty"` }
AggregationMatrixStatsField represents running stats of a single field returned from MatrixStats aggregation.
type AggregationPercentilesMetric ¶
type AggregationPercentilesMetric struct { Aggregations Values map[string]float64 // `json:"values"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationPercentilesMetric is a multi-value metric, returned by a Percentiles aggregation.
func (*AggregationPercentilesMetric) UnmarshalJSON ¶
func (a *AggregationPercentilesMetric) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationPercentilesMetric structure.
type AggregationPipelineBucketMetricValue ¶
type AggregationPipelineBucketMetricValue struct { Aggregations Keys []interface{} // `json:"keys"` Value *float64 // `json:"value"` ValueAsString string // `json:"value_as_string"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationPipelineBucketMetricValue is a value returned e.g. by a MaxBucket aggregation.
func (*AggregationPipelineBucketMetricValue) UnmarshalJSON ¶
func (a *AggregationPipelineBucketMetricValue) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationPipelineBucketMetricValue structure.
type AggregationPipelineDerivative ¶
type AggregationPipelineDerivative struct { Aggregations Value *float64 // `json:"value"` ValueAsString string // `json:"value_as_string"` NormalizedValue *float64 // `json:"normalized_value"` NormalizedValueAsString string // `json:"normalized_value_as_string"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationPipelineDerivative is the value returned by a Derivative aggregation.
func (*AggregationPipelineDerivative) UnmarshalJSON ¶
func (a *AggregationPipelineDerivative) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationPipelineDerivative structure.
type AggregationPipelineSimpleValue ¶
type AggregationPipelineSimpleValue struct { Aggregations Value *float64 // `json:"value"` ValueAsString string // `json:"value_as_string"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationPipelineSimpleValue is a simple value, returned e.g. by a MovAvg aggregation.
func (*AggregationPipelineSimpleValue) UnmarshalJSON ¶
func (a *AggregationPipelineSimpleValue) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationPipelineSimpleValue structure.
type AggregationPipelineStatsMetric ¶
type AggregationPipelineStatsMetric struct { Aggregations Count int64 // `json:"count"` CountAsString string // `json:"count_as_string"` Min *float64 // `json:"min"` MinAsString string // `json:"min_as_string"` Max *float64 // `json:"max"` MaxAsString string // `json:"max_as_string"` Avg *float64 // `json:"avg"` AvgAsString string // `json:"avg_as_string"` Sum *float64 // `json:"sum"` SumAsString string // `json:"sum_as_string"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationPipelineStatsMetric is a simple value, returned e.g. by a MovAvg aggregation.
func (*AggregationPipelineStatsMetric) UnmarshalJSON ¶
func (a *AggregationPipelineStatsMetric) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationPipelineStatsMetric structure.
type AggregationSingleBucket ¶
type AggregationSingleBucket struct { Aggregations DocCount int64 // `json:"doc_count"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationSingleBucket is a single bucket, returned e.g. via an aggregation of type Global.
func (*AggregationSingleBucket) UnmarshalJSON ¶
func (a *AggregationSingleBucket) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationSingleBucket structure.
type AggregationStatsMetric ¶
type AggregationStatsMetric struct { Aggregations Count int64 // `json:"count"` Min *float64 //`json:"min,omitempty"` Max *float64 //`json:"max,omitempty"` Avg *float64 //`json:"avg,omitempty"` Sum *float64 //`json:"sum,omitempty"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationStatsMetric is a multi-value metric, returned by a Stats aggregation.
func (*AggregationStatsMetric) UnmarshalJSON ¶
func (a *AggregationStatsMetric) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationStatsMetric structure.
type AggregationTopHitsMetric ¶
type AggregationTopHitsMetric struct { Aggregations Hits *SearchHits //`json:"hits"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationTopHitsMetric is a metric returned by a TopHits aggregation.
func (*AggregationTopHitsMetric) UnmarshalJSON ¶
func (a *AggregationTopHitsMetric) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationTopHitsMetric structure.
type AggregationValueMetric ¶
type AggregationValueMetric struct { Aggregations Value *float64 //`json:"value"` Meta map[string]interface{} // `json:"meta,omitempty"` }
AggregationValueMetric is a single-value metric, returned e.g. by a Min or Max aggregation.
func (*AggregationValueMetric) UnmarshalJSON ¶
func (a *AggregationValueMetric) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON data and initializes an AggregationValueMetric structure.
type Aggregations ¶
type Aggregations map[string]*json.RawMessage
Aggregations is a list of aggregations that are part of a search result.
func (Aggregations) Avg ¶
func (a Aggregations) Avg(name string) (*AggregationValueMetric, bool)
Avg returns average aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-avg-aggregation.html
func (Aggregations) AvgBucket ¶
func (a Aggregations) AvgBucket(name string) (*AggregationPipelineSimpleValue, bool)
AvgBucket returns average bucket pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-avg-bucket-aggregation.html
func (Aggregations) BucketScript ¶
func (a Aggregations) BucketScript(name string) (*AggregationPipelineSimpleValue, bool)
BucketScript returns bucket script pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-bucket-script-aggregation.html
func (Aggregations) Cardinality ¶
func (a Aggregations) Cardinality(name string) (*AggregationValueMetric, bool)
Cardinality returns cardinality aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-cardinality-aggregation.html
func (Aggregations) Children ¶
func (a Aggregations) Children(name string) (*AggregationSingleBucket, bool)
Children returns children results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-children-aggregation.html
func (Aggregations) CumulativeSum ¶
func (a Aggregations) CumulativeSum(name string) (*AggregationPipelineSimpleValue, bool)
CumulativeSum returns a cumulative sum pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-cumulative-sum-aggregation.html
func (Aggregations) DateHistogram ¶
func (a Aggregations) DateHistogram(name string) (*AggregationBucketHistogramItems, bool)
DateHistogram returns date histogram aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-datehistogram-aggregation.html
func (Aggregations) DateRange ¶
func (a Aggregations) DateRange(name string) (*AggregationBucketRangeItems, bool)
DateRange returns date range aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-daterange-aggregation.html
func (Aggregations) Derivative ¶
func (a Aggregations) Derivative(name string) (*AggregationPipelineDerivative, bool)
Derivative returns derivative pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-derivative-aggregation.html
func (Aggregations) ExtendedStats ¶
func (a Aggregations) ExtendedStats(name string) (*AggregationExtendedStatsMetric, bool)
ExtendedStats returns extended stats aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-extendedstats-aggregation.html
func (Aggregations) Filter ¶
func (a Aggregations) Filter(name string) (*AggregationSingleBucket, bool)
Filter returns filter results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-filter-aggregation.html
func (Aggregations) Filters ¶
func (a Aggregations) Filters(name string) (*AggregationBucketFilters, bool)
Filters returns filters results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-filters-aggregation.html
func (Aggregations) GeoBounds ¶
func (a Aggregations) GeoBounds(name string) (*AggregationGeoBoundsMetric, bool)
GeoBounds returns geo-bounds aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-geobounds-aggregation.html
func (Aggregations) GeoDistance ¶
func (a Aggregations) GeoDistance(name string) (*AggregationBucketRangeItems, bool)
GeoDistance returns geo distance aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-geodistance-aggregation.html
func (Aggregations) GeoHash ¶
func (a Aggregations) GeoHash(name string) (*AggregationBucketKeyItems, bool)
GeoHash returns geo-hash aggregation results. https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-geohashgrid-aggregation.html
func (Aggregations) Global ¶
func (a Aggregations) Global(name string) (*AggregationSingleBucket, bool)
Global returns global results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-global-aggregation.html
func (Aggregations) Histogram ¶
func (a Aggregations) Histogram(name string) (*AggregationBucketHistogramItems, bool)
Histogram returns histogram aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-histogram-aggregation.html
func (Aggregations) IPv4Range ¶
func (a Aggregations) IPv4Range(name string) (*AggregationBucketRangeItems, bool)
IPv4Range returns IPv4 range aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-iprange-aggregation.html
func (Aggregations) KeyedRange ¶
func (a Aggregations) KeyedRange(name string) (*AggregationBucketKeyedRangeItems, bool)
KeyedRange returns keyed range aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-range-aggregation.html.
func (Aggregations) MatrixStats ¶
func (a Aggregations) MatrixStats(name string) (*AggregationMatrixStats, bool)
MatrixStats returns matrix stats aggregation results. https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-matrix-stats-aggregation.html
func (Aggregations) Max ¶
func (a Aggregations) Max(name string) (*AggregationValueMetric, bool)
Max returns max aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-max-aggregation.html
func (Aggregations) MaxBucket ¶
func (a Aggregations) MaxBucket(name string) (*AggregationPipelineBucketMetricValue, bool)
MaxBucket returns maximum bucket pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-max-bucket-aggregation.html
func (Aggregations) Min ¶
func (a Aggregations) Min(name string) (*AggregationValueMetric, bool)
Min returns min aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-min-aggregation.html
func (Aggregations) MinBucket ¶
func (a Aggregations) MinBucket(name string) (*AggregationPipelineBucketMetricValue, bool)
MinBucket returns minimum bucket pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-min-bucket-aggregation.html
func (Aggregations) Missing ¶
func (a Aggregations) Missing(name string) (*AggregationSingleBucket, bool)
Missing returns missing results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-missing-aggregation.html
func (Aggregations) MovAvg ¶
func (a Aggregations) MovAvg(name string) (*AggregationPipelineSimpleValue, bool)
MovAvg returns moving average pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-movavg-aggregation.html
func (Aggregations) Nested ¶
func (a Aggregations) Nested(name string) (*AggregationSingleBucket, bool)
Nested returns nested results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-nested-aggregation.html
func (Aggregations) PercentileRanks ¶
func (a Aggregations) PercentileRanks(name string) (*AggregationPercentilesMetric, bool)
PercentileRanks returns percentile ranks results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-percentile-rank-aggregation.html
func (Aggregations) Percentiles ¶
func (a Aggregations) Percentiles(name string) (*AggregationPercentilesMetric, bool)
Percentiles returns percentiles results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-percentile-aggregation.html
func (Aggregations) Range ¶
func (a Aggregations) Range(name string) (*AggregationBucketRangeItems, bool)
Range returns range aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-range-aggregation.html
func (Aggregations) ReverseNested ¶
func (a Aggregations) ReverseNested(name string) (*AggregationSingleBucket, bool)
ReverseNested returns reverse-nested results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-reverse-nested-aggregation.html
func (Aggregations) Sampler ¶
func (a Aggregations) Sampler(name string) (*AggregationSingleBucket, bool)
Sampler returns sampler aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-sampler-aggregation.html
func (Aggregations) SerialDiff ¶
func (a Aggregations) SerialDiff(name string) (*AggregationPipelineSimpleValue, bool)
SerialDiff returns serial differencing pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-serialdiff-aggregation.html
func (Aggregations) SignificantTerms ¶
func (a Aggregations) SignificantTerms(name string) (*AggregationBucketSignificantTerms, bool)
SignificantTerms returns significant terms aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-significantterms-aggregation.html
func (Aggregations) Stats ¶
func (a Aggregations) Stats(name string) (*AggregationStatsMetric, bool)
Stats returns stats aggregation results. https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-stats-aggregation.html
func (Aggregations) StatsBucket ¶
func (a Aggregations) StatsBucket(name string) (*AggregationPipelineStatsMetric, bool)
StatsBucket returns stats bucket pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-stats-bucket-aggregation.html
func (Aggregations) Sum ¶
func (a Aggregations) Sum(name string) (*AggregationValueMetric, bool)
Sum returns sum aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-sum-aggregation.html
func (Aggregations) SumBucket ¶
func (a Aggregations) SumBucket(name string) (*AggregationPipelineSimpleValue, bool)
SumBucket returns sum bucket pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-sum-bucket-aggregation.html
func (Aggregations) Terms ¶
func (a Aggregations) Terms(name string) (*AggregationBucketKeyItems, bool)
Terms returns terms aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-terms-aggregation.html
func (Aggregations) TopHits ¶
func (a Aggregations) TopHits(name string) (*AggregationTopHitsMetric, bool)
TopHits returns top-hits aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-top-hits-aggregation.html
func (Aggregations) ValueCount ¶
func (a Aggregations) ValueCount(name string) (*AggregationValueMetric, bool)
ValueCount returns value-count aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-valuecount-aggregation.html
type AliasAction ¶
type AliasAction interface {
Source() (interface{}, error)
}
AliasAction is an action to apply to an alias, e.g. "add" or "remove".
type AliasAddAction ¶
type AliasAddAction struct {
// contains filtered or unexported fields
}
AliasAddAction is an action to add to an alias.
func NewAliasAddAction ¶
func NewAliasAddAction(alias string) *AliasAddAction
NewAliasAddAction returns an action to add an alias.
func (*AliasAddAction) Filter ¶
func (a *AliasAddAction) Filter(filter Query) *AliasAddAction
Filter associates a filter to the alias.
func (*AliasAddAction) Index ¶
func (a *AliasAddAction) Index(index ...string) *AliasAddAction
Index associates one or more indices to the alias.
func (*AliasAddAction) IndexRouting ¶
func (a *AliasAddAction) IndexRouting(routing string) *AliasAddAction
IndexRouting associates an index routing value to the alias.
func (*AliasAddAction) Routing ¶
func (a *AliasAddAction) Routing(routing string) *AliasAddAction
Routing associates a routing value to the alias. This basically sets index and search routing to the same value.
func (*AliasAddAction) SearchRouting ¶
func (a *AliasAddAction) SearchRouting(routing ...string) *AliasAddAction
SearchRouting associates a search routing value to the alias.
func (*AliasAddAction) Source ¶
func (a *AliasAddAction) Source() (interface{}, error)
Source returns the JSON-serializable data.
func (*AliasAddAction) Validate ¶
func (a *AliasAddAction) Validate() error
Validate checks if the operation is valid.
type AliasRemoveAction ¶
type AliasRemoveAction struct {
// contains filtered or unexported fields
}
AliasRemoveAction is an action to remove an alias.
func NewAliasRemoveAction ¶
func NewAliasRemoveAction(alias string) *AliasRemoveAction
NewAliasRemoveAction returns an action to remove an alias.
func (*AliasRemoveAction) Index ¶
func (a *AliasRemoveAction) Index(index ...string) *AliasRemoveAction
Index associates one or more indices to the alias.
func (*AliasRemoveAction) Source ¶
func (a *AliasRemoveAction) Source() (interface{}, error)
Source returns the JSON-serializable data.
func (*AliasRemoveAction) Validate ¶
func (a *AliasRemoveAction) Validate() error
Validate checks if the operation is valid.
type AliasResult ¶
type AliasResult struct {
Acknowledged bool `json:"acknowledged"`
}
AliasResult is the outcome of calling Do on AliasService.
type AliasService ¶
type AliasService struct {
// contains filtered or unexported fields
}
AliasService enables users to add or remove an alias. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-aliases.html for details.
func NewAliasService ¶
func NewAliasService(client *Client) *AliasService
NewAliasService implements a service to manage aliases.
func (*AliasService) Action ¶
func (s *AliasService) Action(action ...AliasAction) *AliasService
Action accepts one or more AliasAction instances which can be of type AliasAddAction or AliasRemoveAction.
func (*AliasService) Add ¶
func (s *AliasService) Add(indexName string, aliasName string) *AliasService
Add adds an alias to an index.
func (*AliasService) AddWithFilter ¶
func (s *AliasService) AddWithFilter(indexName string, aliasName string, filter Query) *AliasService
Add adds an alias to an index and associates a filter to the alias.
func (*AliasService) Do ¶
func (s *AliasService) Do(ctx context.Context) (*AliasResult, error)
Do executes the command.
func (*AliasService) Pretty ¶
func (s *AliasService) Pretty(pretty bool) *AliasService
Pretty asks Elasticsearch to indent the HTTP response.
func (*AliasService) Remove ¶
func (s *AliasService) Remove(indexName string, aliasName string) *AliasService
Remove removes an alias.
type BackoffFunc ¶
BackoffFunc specifies the signature of a function that returns the time to wait before the next call to a resource. To stop retrying return false in the 2nd return value.
type BackoffRetrier ¶
type BackoffRetrier struct {
// contains filtered or unexported fields
}
BackoffRetrier is an implementation that does nothing but return nil on Retry.
func NewBackoffRetrier ¶
func NewBackoffRetrier(backoff Backoff) *BackoffRetrier
NewBackoffRetrier returns a retrier that uses the given backoff strategy.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an Elasticsearch client. Create one by calling NewClient.
func NewClient ¶
func NewClient(options ...ClientOptionFunc) (*Client, error)
NewClient creates a new client to work with Elasticsearch.
NewClient, by default, is meant to be long-lived and shared across your application. If you need a short-lived client, e.g. for request-scope, consider using NewSimpleClient instead.
The caller can configure the new client by passing configuration options to the func.
Example:
client, err := elastic.NewClient( elastic.SetURL("http://127.0.0.1:9200", "http://127.0.0.1:9201"), elastic.SetBasicAuth("user", "secret"))
If no URL is configured, Elastic uses DefaultURL by default.
If the sniffer is enabled (the default), the new client then sniffes the cluster via the Nodes Info API (see https://www.elastic.co/guide/en/elasticsearch/reference/5.2/cluster-nodes-info.html#cluster-nodes-info). It uses the URLs specified by the caller. The caller is responsible to only pass a list of URLs of nodes that belong to the same cluster. This sniffing process is run on startup and periodically. Use SnifferInterval to set the interval between two sniffs (default is 15 minutes). In other words: By default, the client will find new nodes in the cluster and remove those that are no longer available every 15 minutes. Disable the sniffer by passing SetSniff(false) to NewClient.
The list of nodes found in the sniffing process will be used to make connections to the REST API of Elasticsearch. These nodes are also periodically checked in a shorter time frame. This process is called a health check. By default, a health check is done every 60 seconds. You can set a shorter or longer interval by SetHealthcheckInterval. Disabling health checks is not recommended, but can be done by SetHealthcheck(false).
Connections are automatically marked as dead or healthy while making requests to Elasticsearch. When a request fails, Elastic will call into the Retry strategy which can be specified with SetRetry. The Retry strategy is also responsible for handling backoff i.e. the time to wait before starting the next request. There are various standard backoff implementations, e.g. ExponentialBackoff or SimpleBackoff. Retries are disabled by default.
If no HttpClient is configured, then http.DefaultClient is used. You can use your own http.Client with some http.Transport for advanced scenarios.
An error is also returned when some configuration option is invalid or the new client cannot sniff the cluster (if enabled).
func NewSimpleClient ¶
func NewSimpleClient(options ...ClientOptionFunc) (*Client, error)
NewSimpleClient creates a new short-lived Client that can be used in use cases where you need e.g. one client per request.
While NewClient by default sets up e.g. periodic health checks and sniffing for new nodes in separate goroutines, NewSimpleClient does not and is meant as a simple replacement where you don't need all the heavy lifting of NewClient.
NewSimpleClient does the following by default: First, all health checks are disabled, including timeouts and periodic checks. Second, sniffing is disabled, including timeouts and periodic checks. The number of retries is set to 1. NewSimpleClient also does not start any goroutines.
Notice that you can still override settings by passing additional options, just like with NewClient.
func (*Client) Alias ¶
func (c *Client) Alias() *AliasService
Alias enables the caller to add and/or remove aliases.
func (*Client) CloseIndex ¶
func (c *Client) CloseIndex(name string) *IndicesCloseService
CloseIndex closes an index.
func (*Client) CreateIndex ¶
func (c *Client) CreateIndex(name string) *IndicesCreateService
CreateIndex returns a service to create a new index.
func (*Client) DeleteIndex ¶
func (c *Client) DeleteIndex(indices ...string) *IndicesDeleteService
DeleteIndex returns a service to delete an index.
func (*Client) ElasticsearchVersion ¶
ElasticsearchVersion returns the version number of Elasticsearch running on the given URL.
func (*Client) Exists ¶
func (c *Client) Exists() *ExistsService
Exists checks if a document exists.
func (*Client) Flush ¶
func (c *Client) Flush(indices ...string) *IndicesFlushService
Flush asks Elasticsearch to free memory from the index and flush data to disk.
func (*Client) GetFieldMapping ¶
func (c *Client) GetFieldMapping() *IndicesGetFieldMappingService
GetFieldMapping gets mapping for fields.
func (*Client) GetMapping ¶
func (c *Client) GetMapping() *IndicesGetMappingService
GetMapping gets a mapping.
func (*Client) IndexExists ¶
func (c *Client) IndexExists(indices ...string) *IndicesExistsService
IndexExists allows to check if an index exists.
func (*Client) IndexGet ¶
func (c *Client) IndexGet(indices ...string) *IndicesGetService
IndexGet retrieves information about one or more indices. IndexGet is only available for Elasticsearch 1.4 or later.
func (*Client) IndexGetSettings ¶
func (c *Client) IndexGetSettings(indices ...string) *IndicesGetSettingsService
IndexGetSettings retrieves settings of all, one or more indices.
func (*Client) IndexNames ¶
IndexNames returns the names of all indices in the cluster.
func (*Client) IsRunning ¶
IsRunning returns true if the background processes of the client are running, false otherwise.
func (*Client) NodesInfo ¶
func (c *Client) NodesInfo() *NodesInfoService
NodesInfo retrieves one or more or all of the cluster nodes information.
func (*Client) OpenIndex ¶
func (c *Client) OpenIndex(name string) *IndicesOpenService
OpenIndex opens an index.
func (*Client) PerformRequest ¶
func (c *Client) PerformRequest(ctx context.Context, method, path string, params url.Values, body interface{}, ignoreErrors ...int) (*Response, error)
PerformRequest does a HTTP request to Elasticsearch. It returns a response (which might be nil) and an error on failure.
Optionally, a list of HTTP error codes to ignore can be passed. This is necessary for services that expect e.g. HTTP status 404 as a valid outcome (Exists, IndicesExists, IndicesTypeExists).
func (*Client) Ping ¶
func (c *Client) Ping(url string) *PingService
Ping checks if a given node in a cluster exists and (optionally) returns some basic information about the Elasticsearch server, e.g. the Elasticsearch version number.
Notice that you need to specify a URL here explicitly.
func (*Client) PutMapping ¶
func (c *Client) PutMapping() *IndicesPutMappingService
PutMapping registers a mapping.
func (*Client) Refresh ¶
func (c *Client) Refresh(indices ...string) *RefreshService
Refresh asks Elasticsearch to refresh one or more indices.
func (*Client) Search ¶
func (c *Client) Search(indices ...string) *SearchService
Search is the entry point for searches.
func (*Client) Start ¶
func (c *Client) Start()
Start starts the background processes like sniffing the cluster and periodic health checks. You don't need to run Start when creating a client with NewClient; the background processes are run by default.
If the background processes are already running, this is a no-op.
func (*Client) Stop ¶
func (c *Client) Stop()
Stop stops the background processes that the client is running, i.e. sniffing the cluster periodically and running health checks on the nodes.
If the background processes are not running, this is a no-op.
func (*Client) TypeExists ¶
func (c *Client) TypeExists() *IndicesExistsTypeService
TypeExists allows to check if one or more types exist in one or more indices.
type ClientOptionFunc ¶
ClientOptionFunc is a function that configures a Client. It is used in NewClient.
func SetBasicAuth ¶
func SetBasicAuth(username, password string) ClientOptionFunc
SetBasicAuth can be used to specify the HTTP Basic Auth credentials to use when making HTTP requests to Elasticsearch.
func SetDecoder ¶
func SetDecoder(decoder Decoder) ClientOptionFunc
SetDecoder sets the Decoder to use when decoding data from Elasticsearch. DefaultDecoder is used by default.
func SetErrorLog ¶
func SetErrorLog(logger Logger) ClientOptionFunc
SetErrorLog sets the logger for critical messages like nodes joining or leaving the cluster or failing requests. It is nil by default.
func SetGzip ¶
func SetGzip(enabled bool) ClientOptionFunc
SetGzip enables or disables gzip compression (disabled by default).
func SetHealthcheck ¶
func SetHealthcheck(enabled bool) ClientOptionFunc
SetHealthcheck enables or disables healthchecks (enabled by default).
func SetHealthcheckInterval ¶
func SetHealthcheckInterval(interval time.Duration) ClientOptionFunc
SetHealthcheckInterval sets the interval between two health checks. The default interval is 60 seconds.
func SetHealthcheckTimeout ¶
func SetHealthcheckTimeout(timeout time.Duration) ClientOptionFunc
SetHealthcheckTimeout sets the timeout for periodic health checks. The default timeout is 1 second (see DefaultHealthcheckTimeout). Notice that a different (usually larger) timeout is used for the initial healthcheck, which is initiated while creating a new client. The startup timeout can be modified with SetHealthcheckTimeoutStartup.
func SetHealthcheckTimeoutStartup ¶
func SetHealthcheckTimeoutStartup(timeout time.Duration) ClientOptionFunc
SetHealthcheckTimeoutStartup sets the timeout for the initial health check. The default timeout is 5 seconds (see DefaultHealthcheckTimeoutStartup). Notice that timeouts for subsequent health checks can be modified with SetHealthcheckTimeout.
func SetHttpClient ¶
func SetHttpClient(httpClient *http.Client) ClientOptionFunc
SetHttpClient can be used to specify the http.Client to use when making HTTP requests to Elasticsearch.
func SetInfoLog ¶
func SetInfoLog(logger Logger) ClientOptionFunc
SetInfoLog sets the logger for informational messages, e.g. requests and their response times. It is nil by default.
func SetMaxRetries
deprecated
func SetMaxRetries(maxRetries int) ClientOptionFunc
SetMaxRetries sets the maximum number of retries before giving up when performing a HTTP request to Elasticsearch.
Deprecated: Replace with a Retry implementation.
func SetRequiredPlugins ¶
func SetRequiredPlugins(plugins ...string) ClientOptionFunc
SetRequiredPlugins can be used to indicate that some plugins are required before a Client will be created.
func SetRetrier ¶
func SetRetrier(retrier Retrier) ClientOptionFunc
SetRetrier specifies the retry strategy that handles errors during HTTP request/response with Elasticsearch.
func SetScheme ¶
func SetScheme(scheme string) ClientOptionFunc
SetScheme sets the HTTP scheme to look for when sniffing (http or https). This is http by default.
func SetSendGetBodyAs ¶
func SetSendGetBodyAs(httpMethod string) ClientOptionFunc
SetSendGetBodyAs specifies the HTTP method to use when sending a GET request with a body. It is GET by default.
func SetSniff ¶
func SetSniff(enabled bool) ClientOptionFunc
SetSniff enables or disables the sniffer (enabled by default).
func SetSnifferCallback ¶
func SetSnifferCallback(f SnifferCallback) ClientOptionFunc
SetSnifferCallback allows the caller to modify sniffer decisions. When setting the callback, the given SnifferCallback is called for each (healthy) node found during the sniffing process. If the callback returns false, the node is ignored: No requests are routed to it.
func SetSnifferInterval ¶
func SetSnifferInterval(interval time.Duration) ClientOptionFunc
SetSnifferInterval sets the interval between two sniffing processes. The default interval is 15 minutes.
func SetSnifferTimeout ¶
func SetSnifferTimeout(timeout time.Duration) ClientOptionFunc
SetSnifferTimeout sets the timeout for the sniffer that finds the nodes in a cluster. The default is 2 seconds. Notice that the timeout used when creating a new client on startup is usually greater and can be set with SetSnifferTimeoutStartup.
func SetSnifferTimeoutStartup ¶
func SetSnifferTimeoutStartup(timeout time.Duration) ClientOptionFunc
SetSnifferTimeoutStartup sets the timeout for the sniffer that is used when creating a new client. The default is 5 seconds. Notice that the timeout being used for subsequent sniffing processes is set with SetSnifferTimeout.
func SetTraceLog ¶
func SetTraceLog(logger Logger) ClientOptionFunc
SetTraceLog specifies the log.Logger to use for output of HTTP requests and responses which is helpful during debugging. It is nil by default.
func SetURL ¶
func SetURL(urls ...string) ClientOptionFunc
SetURL defines the URL endpoints of the Elasticsearch nodes. Notice that when sniffing is enabled, these URLs are used to initially sniff the cluster on startup.
type ClusterHealthResponse ¶
type ClusterHealthResponse struct { ClusterName string `json:"cluster_name"` Status string `json:"status"` TimedOut bool `json:"timed_out"` NumberOfNodes int `json:"number_of_nodes"` NumberOfDataNodes int `json:"number_of_data_nodes"` ActivePrimaryShards int `json:"active_primary_shards"` ActiveShards int `json:"active_shards"` RelocatingShards int `json:"relocating_shards"` InitializingShards int `json:"initializing_shards"` UnassignedShards int `json:"unassigned_shards"` DelayedUnassignedShards int `json:"delayed_unassigned_shards"` NumberOfPendingTasks int `json:"number_of_pending_tasks"` NumberOfInFlightFetch int `json:"number_of_in_flight_fetch"` TaskMaxWaitTimeInQueueInMillis int `json:"task_max_waiting_in_queue_millis"` ActiveShardsPercentAsNumber float64 `json:"active_shards_percent_as_number"` // Validation failures -> index name -> array of validation failures ValidationFailures []map[string][]string `json:"validation_failures"` // Index name -> index health Indices map[string]*ClusterIndexHealth `json:"indices"` }
ClusterHealthResponse is the response of ClusterHealthService.Do.
type ClusterHealthService ¶
type ClusterHealthService struct {
// contains filtered or unexported fields
}
ClusterHealthService allows to get a very simple status on the health of the cluster.
See http://www.elastic.co/guide/en/elasticsearch/reference/5.2/cluster-health.html for details.
Example ¶
package main import ( "context" "fmt" elastic "github.com/venicegeo/pz-gocommon/elasticsearch/elastic-5-api" ) func main() { client, err := elastic.NewClient() if err != nil { panic(err) } // Get cluster health res, err := elastic.NewClusterHealthService(client).Index("twitter").Do(context.Background()) if err != nil { panic(err) } if res == nil { panic(err) } fmt.Printf("Cluster status is %q\n", res.Status) }
Output:
func NewClusterHealthService ¶
func NewClusterHealthService(client *Client) *ClusterHealthService
NewClusterHealthService creates a new ClusterHealthService.
func (*ClusterHealthService) Do ¶
func (s *ClusterHealthService) Do(ctx context.Context) (*ClusterHealthResponse, error)
Do executes the operation.
func (*ClusterHealthService) Index ¶
func (s *ClusterHealthService) Index(indices ...string) *ClusterHealthService
Index limits the information returned to specific indices.
func (*ClusterHealthService) Level ¶
func (s *ClusterHealthService) Level(level string) *ClusterHealthService
Level specifies the level of detail for returned information.
func (*ClusterHealthService) Local ¶
func (s *ClusterHealthService) Local(local bool) *ClusterHealthService
Local indicates whether to return local information. If it is true, we do not retrieve the state from master node (default: false).
func (*ClusterHealthService) MasterTimeout ¶
func (s *ClusterHealthService) MasterTimeout(masterTimeout string) *ClusterHealthService
MasterTimeout specifies an explicit operation timeout for connection to master node.
func (*ClusterHealthService) Pretty ¶
func (s *ClusterHealthService) Pretty(pretty bool) *ClusterHealthService
Pretty indicates that the JSON response be indented and human readable.
func (*ClusterHealthService) Timeout ¶
func (s *ClusterHealthService) Timeout(timeout string) *ClusterHealthService
Timeout specifies an explicit operation timeout.
func (*ClusterHealthService) Validate ¶
func (s *ClusterHealthService) Validate() error
Validate checks if the operation is valid.
func (*ClusterHealthService) WaitForActiveShards ¶
func (s *ClusterHealthService) WaitForActiveShards(waitForActiveShards int) *ClusterHealthService
WaitForActiveShards can be used to wait until the specified number of shards are active.
func (*ClusterHealthService) WaitForGreenStatus ¶
func (s *ClusterHealthService) WaitForGreenStatus() *ClusterHealthService
WaitForGreenStatus will wait for the "green" state.
func (*ClusterHealthService) WaitForNoRelocatingShards ¶
func (s *ClusterHealthService) WaitForNoRelocatingShards(waitForNoRelocatingShards bool) *ClusterHealthService
WaitForNoRelocatingShards can be used to wait until all shard relocations are finished.
func (*ClusterHealthService) WaitForNodes ¶
func (s *ClusterHealthService) WaitForNodes(waitForNodes string) *ClusterHealthService
WaitForNodes can be used to wait until the specified number of nodes are available. Example: "12" to wait for exact values, ">12" and "<12" for ranges.
func (*ClusterHealthService) WaitForStatus ¶
func (s *ClusterHealthService) WaitForStatus(waitForStatus string) *ClusterHealthService
WaitForStatus can be used to wait until the cluster is in a specific state. Valid values are: green, yellow, or red.
func (*ClusterHealthService) WaitForYellowStatus ¶
func (s *ClusterHealthService) WaitForYellowStatus() *ClusterHealthService
WaitForYellowStatus will wait for the "yellow" state.
type ClusterIndexHealth ¶
type ClusterIndexHealth struct { Status string `json:"status"` NumberOfShards int `json:"number_of_shards"` NumberOfReplicas int `json:"number_of_replicas"` ActivePrimaryShards int `json:"active_primary_shards"` ActiveShards int `json:"active_shards"` RelocatingShards int `json:"relocating_shards"` InitializingShards int `json:"initializing_shards"` UnassignedShards int `json:"unassigned_shards"` // Validation failures ValidationFailures []string `json:"validation_failures"` // Shards by id, e.g. "0" or "1" Shards map[string]*ClusterShardHealth `json:"shards"` }
ClusterIndexHealth will be returned as part of ClusterHealthResponse.
type ClusterShardHealth ¶
type ClusterShardHealth struct { Status string `json:"status"` PrimaryActive bool `json:"primary_active"` ActiveShards int `json:"active_shards"` RelocatingShards int `json:"relocating_shards"` InitializingShards int `json:"initializing_shards"` UnassignedShards int `json:"unassigned_shards"` }
ClusterShardHealth will be returned as part of ClusterHealthResponse.
type CollectorResult ¶
type CollectorResult struct { Name string `json:"name,omitempty"` Reason string `json:"reason,omitempty"` Time string `json:"time,omitempty"` TimeNanos int64 `json:"time_in_nanos,omitempty"` Children []CollectorResult `json:"children,omitempty"` }
CollectorResult holds the profile timings of the collectors used in the search. Children's CollectorResults may be embedded inside of a parent CollectorResult.
type ConstantBackoff ¶
type ConstantBackoff struct {
// contains filtered or unexported fields
}
ConstantBackoff is a backoff policy that always returns the same delay.
func NewConstantBackoff ¶
func NewConstantBackoff(interval time.Duration) *ConstantBackoff
NewConstantBackoff returns a new ConstantBackoff.
type CountResponse ¶
type CountResponse struct { Count int64 `json:"count"` Shards shardsInfo `json:"_shards,omitempty"` }
CountResponse is the response of using the Count API.
type CountService ¶
type CountService struct {
// contains filtered or unexported fields
}
CountService is a convenient service for determining the number of documents in an index. Use SearchService with a SearchType of count for counting with queries etc.
func NewCountService ¶
func NewCountService(client *Client) *CountService
NewCountService creates a new CountService.
func (*CountService) AllowNoIndices ¶
func (s *CountService) AllowNoIndices(allowNoIndices bool) *CountService
AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes "_all" string or when no indices have been specified).
func (*CountService) AnalyzeWildcard ¶
func (s *CountService) AnalyzeWildcard(analyzeWildcard bool) *CountService
AnalyzeWildcard specifies whether wildcard and prefix queries should be analyzed (default: false).
func (*CountService) Analyzer ¶
func (s *CountService) Analyzer(analyzer string) *CountService
Analyzer specifies the analyzer to use for the query string.
func (*CountService) BodyJson ¶
func (s *CountService) BodyJson(body interface{}) *CountService
BodyJson specifies the query to restrict the results specified with the Query DSL (optional). The interface{} will be serialized to a JSON document, so use a map[string]interface{}.
func (*CountService) BodyString ¶
func (s *CountService) BodyString(body string) *CountService
Body specifies a query to restrict the results specified with the Query DSL (optional).
func (*CountService) DefaultOperator ¶
func (s *CountService) DefaultOperator(defaultOperator string) *CountService
DefaultOperator specifies the default operator for query string query (AND or OR).
func (*CountService) Df ¶
func (s *CountService) Df(df string) *CountService
Df specifies the field to use as default where no field prefix is given in the query string.
func (*CountService) Do ¶
func (s *CountService) Do(ctx context.Context) (int64, error)
Do executes the operation.
func (*CountService) ExpandWildcards ¶
func (s *CountService) ExpandWildcards(expandWildcards string) *CountService
ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.
func (*CountService) IgnoreUnavailable ¶
func (s *CountService) IgnoreUnavailable(ignoreUnavailable bool) *CountService
IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).
func (*CountService) Index ¶
func (s *CountService) Index(index ...string) *CountService
Index sets the names of the indices to restrict the results.
func (*CountService) Lenient ¶
func (s *CountService) Lenient(lenient bool) *CountService
Lenient specifies whether format-based query failures (such as providing text to a numeric field) should be ignored.
func (*CountService) LowercaseExpandedTerms ¶
func (s *CountService) LowercaseExpandedTerms(lowercaseExpandedTerms bool) *CountService
LowercaseExpandedTerms specifies whether query terms should be lowercased.
func (*CountService) MinScore ¶
func (s *CountService) MinScore(minScore interface{}) *CountService
MinScore indicates to include only documents with a specific `_score` value in the result.
func (*CountService) Preference ¶
func (s *CountService) Preference(preference string) *CountService
Preference specifies the node or shard the operation should be performed on (default: random).
func (*CountService) Pretty ¶
func (s *CountService) Pretty(pretty bool) *CountService
Pretty indicates that the JSON response be indented and human readable.
func (*CountService) Q ¶
func (s *CountService) Q(q string) *CountService
Q in the Lucene query string syntax. You can also use Query to pass a Query struct.
func (*CountService) Query ¶
func (s *CountService) Query(query Query) *CountService
Query specifies the query to pass. You can also pass a query string with Q.
func (*CountService) Routing ¶
func (s *CountService) Routing(routing string) *CountService
Routing specifies the routing value.
func (*CountService) Type ¶
func (s *CountService) Type(typ ...string) *CountService
Type sets the types to use to restrict the results.
func (*CountService) Validate ¶
func (s *CountService) Validate() error
Validate checks if the operation is valid.
type Decoder ¶
Decoder is used to decode responses from Elasticsearch. Users of elastic can implement their own marshaler for advanced purposes and set them per Client (see SetDecoder). If none is specified, DefaultDecoder is used.
type DefaultDecoder ¶
type DefaultDecoder struct{}
DefaultDecoder uses json.Unmarshal from the Go standard library to decode JSON data.
func (*DefaultDecoder) Decode ¶
func (u *DefaultDecoder) Decode(data []byte, v interface{}) error
Decode decodes with json.Unmarshal from the Go standard library.
type DeleteResponse ¶
type DeleteResponse struct { // TODO _shards { total, failed, successful } Found bool `json:"found"` Index string `json:"_index"` Type string `json:"_type"` Id string `json:"_id"` Version int64 `json:"_version"` }
DeleteResponse is the outcome of running DeleteService.Do.
type DeleteService ¶
type DeleteService struct {
// contains filtered or unexported fields
}
DeleteService allows to delete a typed JSON document from a specified index based on its id.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-delete.html for details.
func NewDeleteService ¶
func NewDeleteService(client *Client) *DeleteService
NewDeleteService creates a new DeleteService.
func (*DeleteService) Do ¶
func (s *DeleteService) Do(ctx context.Context) (*DeleteResponse, error)
Do executes the operation.
func (*DeleteService) Id ¶
func (s *DeleteService) Id(id string) *DeleteService
Id is the document ID.
func (*DeleteService) Index ¶
func (s *DeleteService) Index(index string) *DeleteService
Index is the name of the index.
func (*DeleteService) Parent ¶
func (s *DeleteService) Parent(parent string) *DeleteService
Parent is the ID of parent document.
func (*DeleteService) Pretty ¶
func (s *DeleteService) Pretty(pretty bool) *DeleteService
Pretty indicates that the JSON response be indented and human readable.
func (*DeleteService) Refresh ¶
func (s *DeleteService) Refresh(refresh string) *DeleteService
Refresh the index after performing the operation.
func (*DeleteService) Routing ¶
func (s *DeleteService) Routing(routing string) *DeleteService
Routing is a specific routing value.
func (*DeleteService) Timeout ¶
func (s *DeleteService) Timeout(timeout string) *DeleteService
Timeout is an explicit operation timeout.
func (*DeleteService) Type ¶
func (s *DeleteService) Type(typ string) *DeleteService
Type is the type of the document.
func (*DeleteService) Validate ¶
func (s *DeleteService) Validate() error
Validate checks if the operation is valid.
func (*DeleteService) Version ¶
func (s *DeleteService) Version(version interface{}) *DeleteService
Version is an explicit version number for concurrency control.
func (*DeleteService) VersionType ¶
func (s *DeleteService) VersionType(versionType string) *DeleteService
VersionType is a specific version type.
func (*DeleteService) WaitForActiveShards ¶
func (s *DeleteService) WaitForActiveShards(waitForActiveShards string) *DeleteService
WaitForActiveShards sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1).
type Error ¶
type Error struct { Status int `json:"status"` Details *ErrorDetails `json:"error,omitempty"` }
Error encapsulates error details as returned from Elasticsearch.
type ErrorDetails ¶
type ErrorDetails struct { Type string `json:"type"` Reason string `json:"reason"` ResourceType string `json:"resource.type,omitempty"` ResourceId string `json:"resource.id,omitempty"` Index string `json:"index,omitempty"` Phase string `json:"phase,omitempty"` Grouped bool `json:"grouped,omitempty"` CausedBy map[string]interface{} `json:"caused_by,omitempty"` RootCause []*ErrorDetails `json:"root_cause,omitempty"` FailedShards []map[string]interface{} `json:"failed_shards,omitempty"` }
ErrorDetails encapsulate error details from Elasticsearch. It is used in e.g. elastic.Error and elastic.BulkResponseItem.
type ExistsService ¶
type ExistsService struct {
// contains filtered or unexported fields
}
ExistsService checks for the existence of a document using HEAD.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-get.html for details.
func NewExistsService ¶
func NewExistsService(client *Client) *ExistsService
NewExistsService creates a new ExistsService.
func (*ExistsService) Do ¶
func (s *ExistsService) Do(ctx context.Context) (bool, error)
Do executes the operation.
func (*ExistsService) Id ¶
func (s *ExistsService) Id(id string) *ExistsService
Id is the document ID.
func (*ExistsService) Index ¶
func (s *ExistsService) Index(index string) *ExistsService
Index is the name of the index.
func (*ExistsService) Parent ¶
func (s *ExistsService) Parent(parent string) *ExistsService
Parent is the ID of the parent document.
func (*ExistsService) Preference ¶
func (s *ExistsService) Preference(preference string) *ExistsService
Preference specifies the node or shard the operation should be performed on (default: random).
func (*ExistsService) Pretty ¶
func (s *ExistsService) Pretty(pretty bool) *ExistsService
Pretty indicates that the JSON response be indented and human readable.
func (*ExistsService) Realtime ¶
func (s *ExistsService) Realtime(realtime bool) *ExistsService
Realtime specifies whether to perform the operation in realtime or search mode.
func (*ExistsService) Refresh ¶
func (s *ExistsService) Refresh(refresh string) *ExistsService
Refresh the shard containing the document before performing the operation.
func (*ExistsService) Routing ¶
func (s *ExistsService) Routing(routing string) *ExistsService
Routing is a specific routing value.
func (*ExistsService) Type ¶
func (s *ExistsService) Type(typ string) *ExistsService
Type is the type of the document (use `_all` to fetch the first document matching the ID across all types).
func (*ExistsService) Validate ¶
func (s *ExistsService) Validate() error
Validate checks if the operation is valid.
type ExponentialBackoff ¶
type ExponentialBackoff struct {
// contains filtered or unexported fields
}
ExponentialBackoff implements the simple exponential backoff described by Douglas Thain at http://dthain.blogspot.de/2009/02/exponential-backoff-in-distributed.html.
func NewExponentialBackoff ¶
func NewExponentialBackoff(initialTimeout, maxTimeout time.Duration) *ExponentialBackoff
NewExponentialBackoff returns a ExponentialBackoff backoff policy. Use initialTimeout to set the first/minimal interval and maxTimeout to set the maximum wait interval.
type FetchSourceContext ¶
type FetchSourceContext struct {
// contains filtered or unexported fields
}
func NewFetchSourceContext ¶
func NewFetchSourceContext(fetchSource bool) *FetchSourceContext
func (*FetchSourceContext) Exclude ¶
func (fsc *FetchSourceContext) Exclude(excludes ...string) *FetchSourceContext
func (*FetchSourceContext) FetchSource ¶
func (fsc *FetchSourceContext) FetchSource() bool
func (*FetchSourceContext) Include ¶
func (fsc *FetchSourceContext) Include(includes ...string) *FetchSourceContext
func (*FetchSourceContext) Query ¶
func (fsc *FetchSourceContext) Query() url.Values
Query returns the parameters in a form suitable for a URL query string.
func (*FetchSourceContext) SetFetchSource ¶
func (fsc *FetchSourceContext) SetFetchSource(fetchSource bool)
func (*FetchSourceContext) Source ¶
func (fsc *FetchSourceContext) Source() (interface{}, error)
func (*FetchSourceContext) TransformSource ¶
func (fsc *FetchSourceContext) TransformSource(transformSource bool) *FetchSourceContext
type FieldSort ¶
type FieldSort struct { Sorter // contains filtered or unexported fields }
FieldSort sorts by a given field.
func NewFieldSort ¶
NewFieldSort creates a new FieldSort.
func (*FieldSort) IgnoreUnmapped ¶
IgnoreUnmapped specifies what happens if the field does not exist in the index. Set it to true to ignore, or set it to false to not ignore (default).
func (*FieldSort) Missing ¶
Missing sets the value to be used when a field is missing in a document. You can also use "_last" or "_first" to sort missing last or first respectively.
func (*FieldSort) NestedFilter ¶
NestedFilter sets a filter that nested objects should match with in order to be taken into account for sorting.
func (*FieldSort) NestedPath ¶
NestedPath is used if sorting occurs on a field that is inside a nested object.
func (*FieldSort) SortMode ¶
SortMode specifies what values to pick in case a document contains multiple values for the targeted sort field. Possible values are: min, max, sum, and avg.
func (*FieldSort) UnmappedType ¶
UnmappedType sets the type to use when the current field is not mapped in an index.
type GetResult ¶
type GetResult struct { Index string `json:"_index"` // index meta field Type string `json:"_type"` // type meta field Id string `json:"_id"` // id meta field Uid string `json:"_uid"` // uid meta field (see MapperService.java for all meta fields) Routing string `json:"_routing"` // routing meta field Parent string `json:"_parent"` // parent meta field Version *int64 `json:"_version"` // version number, when Version is set to true in SearchService Source *json.RawMessage `json:"_source,omitempty"` Found bool `json:"found,omitempty"` Fields map[string]interface{} `json:"fields,omitempty"` //Error string `json:"error,omitempty"` // used only in MultiGet // TODO double-check that MultiGet now returns details error information Error *ErrorDetails `json:"error,omitempty"` // only used in MultiGet }
GetResult is the outcome of GetService.Do.
type GetService ¶
type GetService struct {
// contains filtered or unexported fields
}
GetService allows to get a typed JSON document from the index based on its id.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-get.html for details.
func NewGetService ¶
func NewGetService(client *Client) *GetService
NewGetService creates a new GetService.
func (*GetService) Do ¶
func (s *GetService) Do(ctx context.Context) (*GetResult, error)
Do executes the operation.
func (*GetService) FetchSource ¶
func (s *GetService) FetchSource(fetchSource bool) *GetService
func (*GetService) FetchSourceContext ¶
func (s *GetService) FetchSourceContext(fetchSourceContext *FetchSourceContext) *GetService
func (*GetService) IgnoreErrorsOnGeneratedFields ¶
func (s *GetService) IgnoreErrorsOnGeneratedFields(ignore bool) *GetService
IgnoreErrorsOnGeneratedFields indicates whether to ignore fields that are generated if the transaction log is accessed.
func (*GetService) Index ¶
func (s *GetService) Index(index string) *GetService
Index is the name of the index.
func (*GetService) Parent ¶
func (s *GetService) Parent(parent string) *GetService
Parent is the ID of the parent document.
func (*GetService) Preference ¶
func (s *GetService) Preference(preference string) *GetService
Preference specifies the node or shard the operation should be performed on (default: random).
func (*GetService) Pretty ¶
func (s *GetService) Pretty(pretty bool) *GetService
Pretty indicates that the JSON response be indented and human readable.
func (*GetService) Realtime ¶
func (s *GetService) Realtime(realtime bool) *GetService
Realtime specifies whether to perform the operation in realtime or search mode.
func (*GetService) Refresh ¶
func (s *GetService) Refresh(refresh string) *GetService
Refresh the shard containing the document before performing the operation.
func (*GetService) Routing ¶
func (s *GetService) Routing(routing string) *GetService
Routing is the specific routing value.
func (*GetService) StoredFields ¶
func (s *GetService) StoredFields(storedFields ...string) *GetService
StoredFields is a list of fields to return in the response.
func (*GetService) Type ¶
func (s *GetService) Type(typ string) *GetService
Type is the type of the document (use `_all` to fetch the first document matching the ID across all types).
func (*GetService) Validate ¶
func (s *GetService) Validate() error
Validate checks if the operation is valid.
func (*GetService) Version ¶
func (s *GetService) Version(version interface{}) *GetService
Version is an explicit version number for concurrency control.
func (*GetService) VersionType ¶
func (s *GetService) VersionType(versionType string) *GetService
VersionType is the specific version type.
type Highlight ¶
type Highlight struct {
// contains filtered or unexported fields
}
Highlight allows highlighting search results on one or more fields. For details, see: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-highlighting.html
func NewHighlight ¶
func NewHighlight() *Highlight
func (*Highlight) BoundaryChars ¶
func (*Highlight) BoundaryMaxScan ¶
func (*Highlight) Fields ¶
func (hl *Highlight) Fields(fields ...*HighlighterField) *Highlight
func (*Highlight) ForceSource ¶
func (*Highlight) FragmentSize ¶
func (*Highlight) Fragmenter ¶
func (*Highlight) HighlighQuery ¶
func (*Highlight) HighlightFilter ¶
func (*Highlight) HighlighterType ¶
func (*Highlight) NoMatchSize ¶
func (*Highlight) NumOfFragments ¶
func (*Highlight) RequireFieldMatch ¶
func (*Highlight) TagsSchema ¶
func (*Highlight) UseExplicitFieldOrder ¶
type HighlighterField ¶
type HighlighterField struct { Name string // contains filtered or unexported fields }
HighlighterField specifies a highlighted field.
func NewHighlighterField ¶
func NewHighlighterField(name string) *HighlighterField
func (*HighlighterField) BoundaryChars ¶
func (f *HighlighterField) BoundaryChars(boundaryChars ...rune) *HighlighterField
func (*HighlighterField) BoundaryMaxScan ¶
func (f *HighlighterField) BoundaryMaxScan(boundaryMaxScan int) *HighlighterField
func (*HighlighterField) ForceSource ¶
func (f *HighlighterField) ForceSource(forceSource bool) *HighlighterField
func (*HighlighterField) FragmentOffset ¶
func (f *HighlighterField) FragmentOffset(fragmentOffset int) *HighlighterField
func (*HighlighterField) FragmentSize ¶
func (f *HighlighterField) FragmentSize(fragmentSize int) *HighlighterField
func (*HighlighterField) Fragmenter ¶
func (f *HighlighterField) Fragmenter(fragmenter string) *HighlighterField
func (*HighlighterField) HighlightFilter ¶
func (f *HighlighterField) HighlightFilter(highlightFilter bool) *HighlighterField
func (*HighlighterField) HighlightQuery ¶
func (f *HighlighterField) HighlightQuery(highlightQuery Query) *HighlighterField
func (*HighlighterField) HighlighterType ¶
func (f *HighlighterField) HighlighterType(highlighterType string) *HighlighterField
func (*HighlighterField) MatchedFields ¶
func (f *HighlighterField) MatchedFields(matchedFields ...string) *HighlighterField
func (*HighlighterField) NoMatchSize ¶
func (f *HighlighterField) NoMatchSize(noMatchSize int) *HighlighterField
func (*HighlighterField) NumOfFragments ¶
func (f *HighlighterField) NumOfFragments(numOfFragments int) *HighlighterField
func (*HighlighterField) Options ¶
func (f *HighlighterField) Options(options map[string]interface{}) *HighlighterField
func (*HighlighterField) Order ¶
func (f *HighlighterField) Order(order string) *HighlighterField
func (*HighlighterField) PhraseLimit ¶
func (f *HighlighterField) PhraseLimit(phraseLimit int) *HighlighterField
func (*HighlighterField) PostTags ¶
func (f *HighlighterField) PostTags(postTags ...string) *HighlighterField
func (*HighlighterField) PreTags ¶
func (f *HighlighterField) PreTags(preTags ...string) *HighlighterField
func (*HighlighterField) RequireFieldMatch ¶
func (f *HighlighterField) RequireFieldMatch(requireFieldMatch bool) *HighlighterField
func (*HighlighterField) Source ¶
func (f *HighlighterField) Source() (interface{}, error)
type IndexResponse ¶
type IndexResponse struct { // TODO _shards { total, failed, successful } Index string `json:"_index"` Type string `json:"_type"` Id string `json:"_id"` Version int `json:"_version"` Created bool `json:"created"` }
IndexResponse is the result of indexing a document in Elasticsearch.
type IndexService ¶
type IndexService struct {
// contains filtered or unexported fields
}
IndexService adds or updates a typed JSON document in a specified index, making it searchable.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-index_.html for details.
func NewIndexService ¶
func NewIndexService(client *Client) *IndexService
NewIndexService creates a new IndexService.
func (*IndexService) BodyJson ¶
func (s *IndexService) BodyJson(body interface{}) *IndexService
BodyJson is the document as a serializable JSON interface.
func (*IndexService) BodyString ¶
func (s *IndexService) BodyString(body string) *IndexService
BodyString is the document encoded as a string.
func (*IndexService) Do ¶
func (s *IndexService) Do(ctx context.Context) (*IndexResponse, error)
Do executes the operation.
func (*IndexService) Index ¶
func (s *IndexService) Index(index string) *IndexService
Index is the name of the index.
func (*IndexService) OpType ¶
func (s *IndexService) OpType(opType string) *IndexService
OpType is an explicit operation type, i.e. "create" or "index" (default).
func (*IndexService) Parent ¶
func (s *IndexService) Parent(parent string) *IndexService
Parent is the ID of the parent document.
func (*IndexService) Pipeline ¶
func (s *IndexService) Pipeline(pipeline string) *IndexService
Pipeline specifies the pipeline id to preprocess incoming documents with.
func (*IndexService) Pretty ¶
func (s *IndexService) Pretty(pretty bool) *IndexService
Pretty indicates that the JSON response be indented and human readable.
func (*IndexService) Refresh ¶
func (s *IndexService) Refresh(refresh string) *IndexService
Refresh the index after performing the operation.
func (*IndexService) Routing ¶
func (s *IndexService) Routing(routing string) *IndexService
Routing is a specific routing value.
func (*IndexService) TTL ¶
func (s *IndexService) TTL(ttl string) *IndexService
TTL is an expiration time for the document (alias for Ttl).
func (*IndexService) Timeout ¶
func (s *IndexService) Timeout(timeout string) *IndexService
Timeout is an explicit operation timeout.
func (*IndexService) Timestamp ¶
func (s *IndexService) Timestamp(timestamp string) *IndexService
Timestamp is an explicit timestamp for the document.
func (*IndexService) Ttl ¶
func (s *IndexService) Ttl(ttl string) *IndexService
Ttl is an expiration time for the document.
func (*IndexService) Type ¶
func (s *IndexService) Type(typ string) *IndexService
Type is the type of the document.
func (*IndexService) Validate ¶
func (s *IndexService) Validate() error
Validate checks if the operation is valid.
func (*IndexService) Version ¶
func (s *IndexService) Version(version interface{}) *IndexService
Version is an explicit version number for concurrency control.
func (*IndexService) VersionType ¶
func (s *IndexService) VersionType(versionType string) *IndexService
VersionType is a specific version type.
func (*IndexService) WaitForActiveShards ¶
func (s *IndexService) WaitForActiveShards(waitForActiveShards string) *IndexService
WaitForActiveShards sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1).
type IndicesCloseResponse ¶
type IndicesCloseResponse struct {
Acknowledged bool `json:"acknowledged"`
}
IndicesCloseResponse is the response of IndicesCloseService.Do.
type IndicesCloseService ¶
type IndicesCloseService struct {
// contains filtered or unexported fields
}
IndicesCloseService closes an index.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-open-close.html for details.
func NewIndicesCloseService ¶
func NewIndicesCloseService(client *Client) *IndicesCloseService
NewIndicesCloseService creates and initializes a new IndicesCloseService.
func (*IndicesCloseService) AllowNoIndices ¶
func (s *IndicesCloseService) AllowNoIndices(allowNoIndices bool) *IndicesCloseService
AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).
func (*IndicesCloseService) Do ¶
func (s *IndicesCloseService) Do(ctx context.Context) (*IndicesCloseResponse, error)
Do executes the operation.
func (*IndicesCloseService) ExpandWildcards ¶
func (s *IndicesCloseService) ExpandWildcards(expandWildcards string) *IndicesCloseService
ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.
func (*IndicesCloseService) IgnoreUnavailable ¶
func (s *IndicesCloseService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesCloseService
IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).
func (*IndicesCloseService) Index ¶
func (s *IndicesCloseService) Index(index string) *IndicesCloseService
Index is the name of the index to close.
func (*IndicesCloseService) MasterTimeout ¶
func (s *IndicesCloseService) MasterTimeout(masterTimeout string) *IndicesCloseService
MasterTimeout specifies the timeout for connection to master.
func (*IndicesCloseService) Pretty ¶
func (s *IndicesCloseService) Pretty(pretty bool) *IndicesCloseService
Pretty indicates that the JSON response be indented and human readable.
func (*IndicesCloseService) Timeout ¶
func (s *IndicesCloseService) Timeout(timeout string) *IndicesCloseService
Timeout is an explicit operation timeout.
func (*IndicesCloseService) Validate ¶
func (s *IndicesCloseService) Validate() error
Validate checks if the operation is valid.
type IndicesCreateResult ¶
type IndicesCreateResult struct { Acknowledged bool `json:"acknowledged"` ShardsAcknowledged bool `json:"shards_acknowledged"` }
IndicesCreateResult is the outcome of creating a new index.
type IndicesCreateService ¶
type IndicesCreateService struct {
// contains filtered or unexported fields
}
IndicesCreateService creates a new index.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-create-index.html for details.
func NewIndicesCreateService ¶
func NewIndicesCreateService(client *Client) *IndicesCreateService
NewIndicesCreateService returns a new IndicesCreateService.
func (*IndicesCreateService) Body ¶
func (b *IndicesCreateService) Body(body string) *IndicesCreateService
Body specifies the configuration of the index as a string. It is an alias for BodyString.
func (*IndicesCreateService) BodyJson ¶
func (b *IndicesCreateService) BodyJson(body interface{}) *IndicesCreateService
BodyJson specifies the configuration of the index. The interface{} will be serializes as a JSON document, so use a map[string]interface{}.
func (*IndicesCreateService) BodyString ¶
func (b *IndicesCreateService) BodyString(body string) *IndicesCreateService
BodyString specifies the configuration of the index as a string.
func (*IndicesCreateService) Do ¶
func (b *IndicesCreateService) Do(ctx context.Context) (*IndicesCreateResult, error)
Do executes the operation.
func (*IndicesCreateService) Index ¶
func (b *IndicesCreateService) Index(index string) *IndicesCreateService
Index is the name of the index to create.
func (*IndicesCreateService) MasterTimeout ¶
func (s *IndicesCreateService) MasterTimeout(masterTimeout string) *IndicesCreateService
MasterTimeout specifies the timeout for connection to master.
func (*IndicesCreateService) Pretty ¶
func (b *IndicesCreateService) Pretty(pretty bool) *IndicesCreateService
Pretty indicates that the JSON response be indented and human readable.
func (*IndicesCreateService) Timeout ¶
func (s *IndicesCreateService) Timeout(timeout string) *IndicesCreateService
Timeout the explicit operation timeout, e.g. "5s".
type IndicesDeleteResponse ¶
type IndicesDeleteResponse struct {
Acknowledged bool `json:"acknowledged"`
}
IndicesDeleteResponse is the response of IndicesDeleteService.Do.
type IndicesDeleteService ¶
type IndicesDeleteService struct {
// contains filtered or unexported fields
}
IndicesDeleteService allows to delete existing indices.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-delete-index.html for details.
func NewIndicesDeleteService ¶
func NewIndicesDeleteService(client *Client) *IndicesDeleteService
NewIndicesDeleteService creates and initializes a new IndicesDeleteService.
func (*IndicesDeleteService) Do ¶
func (s *IndicesDeleteService) Do(ctx context.Context) (*IndicesDeleteResponse, error)
Do executes the operation.
func (*IndicesDeleteService) Index ¶
func (s *IndicesDeleteService) Index(index []string) *IndicesDeleteService
Index adds the list of indices to delete. Use `_all` or `*` string to delete all indices.
func (*IndicesDeleteService) MasterTimeout ¶
func (s *IndicesDeleteService) MasterTimeout(masterTimeout string) *IndicesDeleteService
MasterTimeout specifies the timeout for connection to master.
func (*IndicesDeleteService) Pretty ¶
func (s *IndicesDeleteService) Pretty(pretty bool) *IndicesDeleteService
Pretty indicates that the JSON response be indented and human readable.
func (*IndicesDeleteService) Timeout ¶
func (s *IndicesDeleteService) Timeout(timeout string) *IndicesDeleteService
Timeout is an explicit operation timeout.
func (*IndicesDeleteService) Validate ¶
func (s *IndicesDeleteService) Validate() error
Validate checks if the operation is valid.
type IndicesExistsService ¶
type IndicesExistsService struct {
// contains filtered or unexported fields
}
IndicesExistsService checks if an index or indices exist or not.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-exists.html for details.
func NewIndicesExistsService ¶
func NewIndicesExistsService(client *Client) *IndicesExistsService
NewIndicesExistsService creates and initializes a new IndicesExistsService.
func (*IndicesExistsService) AllowNoIndices ¶
func (s *IndicesExistsService) AllowNoIndices(allowNoIndices bool) *IndicesExistsService
AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).
func (*IndicesExistsService) Do ¶
func (s *IndicesExistsService) Do(ctx context.Context) (bool, error)
Do executes the operation.
func (*IndicesExistsService) ExpandWildcards ¶
func (s *IndicesExistsService) ExpandWildcards(expandWildcards string) *IndicesExistsService
ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.
func (*IndicesExistsService) IgnoreUnavailable ¶
func (s *IndicesExistsService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesExistsService
IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).
func (*IndicesExistsService) Index ¶
func (s *IndicesExistsService) Index(index []string) *IndicesExistsService
Index is a list of one or more indices to check.
func (*IndicesExistsService) Local ¶
func (s *IndicesExistsService) Local(local bool) *IndicesExistsService
Local, when set, returns local information and does not retrieve the state from master node (default: false).
func (*IndicesExistsService) Pretty ¶
func (s *IndicesExistsService) Pretty(pretty bool) *IndicesExistsService
Pretty indicates that the JSON response be indented and human readable.
func (*IndicesExistsService) Validate ¶
func (s *IndicesExistsService) Validate() error
Validate checks if the operation is valid.
type IndicesExistsTypeService ¶
type IndicesExistsTypeService struct {
// contains filtered or unexported fields
}
IndicesExistsTypeService checks if one or more types exist in one or more indices.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-types-exists.html for details.
func NewIndicesExistsTypeService ¶
func NewIndicesExistsTypeService(client *Client) *IndicesExistsTypeService
NewIndicesExistsTypeService creates a new IndicesExistsTypeService.
func (*IndicesExistsTypeService) AllowNoIndices ¶
func (s *IndicesExistsTypeService) AllowNoIndices(allowNoIndices bool) *IndicesExistsTypeService
AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).
func (*IndicesExistsTypeService) Do ¶
func (s *IndicesExistsTypeService) Do(ctx context.Context) (bool, error)
Do executes the operation.
func (*IndicesExistsTypeService) ExpandWildcards ¶
func (s *IndicesExistsTypeService) ExpandWildcards(expandWildcards string) *IndicesExistsTypeService
ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.
func (*IndicesExistsTypeService) IgnoreUnavailable ¶
func (s *IndicesExistsTypeService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesExistsTypeService
IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).
func (*IndicesExistsTypeService) Index ¶
func (s *IndicesExistsTypeService) Index(indices ...string) *IndicesExistsTypeService
Index is a list of index names; use `_all` to check the types across all indices.
func (*IndicesExistsTypeService) Local ¶
func (s *IndicesExistsTypeService) Local(local bool) *IndicesExistsTypeService
Local specifies whether to return local information, i.e. do not retrieve the state from master node (default: false).
func (*IndicesExistsTypeService) Pretty ¶
func (s *IndicesExistsTypeService) Pretty(pretty bool) *IndicesExistsTypeService
Pretty indicates that the JSON response be indented and human readable.
func (*IndicesExistsTypeService) Type ¶
func (s *IndicesExistsTypeService) Type(types ...string) *IndicesExistsTypeService
Type is a list of document types to check.
func (*IndicesExistsTypeService) Validate ¶
func (s *IndicesExistsTypeService) Validate() error
Validate checks if the operation is valid.
type IndicesFlushResponse ¶
type IndicesFlushResponse struct {
Shards shardsInfo `json:"_shards"`
}
type IndicesFlushService ¶
type IndicesFlushService struct {
// contains filtered or unexported fields
}
Flush allows to flush one or more indices. The flush process of an index basically frees memory from the index by flushing data to the index storage and clearing the internal transaction log.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-flush.html for details.
func NewIndicesFlushService ¶
func NewIndicesFlushService(client *Client) *IndicesFlushService
NewIndicesFlushService creates a new IndicesFlushService.
func (*IndicesFlushService) AllowNoIndices ¶
func (s *IndicesFlushService) AllowNoIndices(allowNoIndices bool) *IndicesFlushService
AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).
func (*IndicesFlushService) Do ¶
func (s *IndicesFlushService) Do(ctx context.Context) (*IndicesFlushResponse, error)
Do executes the service.
func (*IndicesFlushService) ExpandWildcards ¶
func (s *IndicesFlushService) ExpandWildcards(expandWildcards string) *IndicesFlushService
ExpandWildcards specifies whether to expand wildcard expression to concrete indices that are open, closed or both..
func (*IndicesFlushService) Force ¶
func (s *IndicesFlushService) Force(force bool) *IndicesFlushService
Force indicates whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal).
func (*IndicesFlushService) IgnoreUnavailable ¶
func (s *IndicesFlushService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesFlushService
IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).
func (*IndicesFlushService) Index ¶
func (s *IndicesFlushService) Index(indices ...string) *IndicesFlushService
Index is a list of index names; use `_all` or empty string for all indices.
func (*IndicesFlushService) Pretty ¶
func (s *IndicesFlushService) Pretty(pretty bool) *IndicesFlushService
Pretty indicates that the JSON response be indented and human readable.
func (*IndicesFlushService) Validate ¶
func (s *IndicesFlushService) Validate() error
Validate checks if the operation is valid.
func (*IndicesFlushService) WaitIfOngoing ¶
func (s *IndicesFlushService) WaitIfOngoing(waitIfOngoing bool) *IndicesFlushService
WaitIfOngoing, if set to true, indicates that the flush operation will block until the flush can be executed if another flush operation is already executing. The default is false and will cause an exception to be thrown on the shard level if another flush operation is already running..
type IndicesGetFieldMappingService ¶
type IndicesGetFieldMappingService struct {
// contains filtered or unexported fields
}
IndicesGetFieldMappingService retrieves the mapping definitions for the fields in an index
or index/type.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-get-field-mapping.html for details.
func NewGetFieldMappingService ¶
func NewGetFieldMappingService(client *Client) *IndicesGetFieldMappingService
NewGetFieldMappingService is an alias for NewIndicesGetFieldMappingService. Use NewIndicesGetFieldMappingService.
func NewIndicesGetFieldMappingService ¶
func NewIndicesGetFieldMappingService(client *Client) *IndicesGetFieldMappingService
NewIndicesGetFieldMappingService creates a new IndicesGetFieldMappingService.
func (*IndicesGetFieldMappingService) AllowNoIndices ¶
func (s *IndicesGetFieldMappingService) AllowNoIndices(allowNoIndices bool) *IndicesGetFieldMappingService
AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices. This includes `_all` string or when no indices have been specified.
func (*IndicesGetFieldMappingService) Do ¶
func (s *IndicesGetFieldMappingService) Do(ctx context.Context) (map[string]interface{}, error)
Do executes the operation. It returns mapping definitions for an index or index/type.
func (*IndicesGetFieldMappingService) ExpandWildcards ¶
func (s *IndicesGetFieldMappingService) ExpandWildcards(expandWildcards string) *IndicesGetFieldMappingService
ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both..
func (*IndicesGetFieldMappingService) Field ¶
func (s *IndicesGetFieldMappingService) Field(fields ...string) *IndicesGetFieldMappingService
Field is a list of fields.
func (*IndicesGetFieldMappingService) IgnoreUnavailable ¶
func (s *IndicesGetFieldMappingService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesGetFieldMappingService
IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).
func (*IndicesGetFieldMappingService) Index ¶
func (s *IndicesGetFieldMappingService) Index(indices ...string) *IndicesGetFieldMappingService
Index is a list of index names.
func (*IndicesGetFieldMappingService) Local ¶
func (s *IndicesGetFieldMappingService) Local(local bool) *IndicesGetFieldMappingService
Local indicates whether to return local information, do not retrieve the state from master node (default: false).
func (*IndicesGetFieldMappingService) Pretty ¶
func (s *IndicesGetFieldMappingService) Pretty(pretty bool) *IndicesGetFieldMappingService
Pretty indicates that the JSON response be indented and human readable.
func (*IndicesGetFieldMappingService) Type ¶
func (s *IndicesGetFieldMappingService) Type(types ...string) *IndicesGetFieldMappingService
Type is a list of document types.
func (*IndicesGetFieldMappingService) Validate ¶
func (s *IndicesGetFieldMappingService) Validate() error
Validate checks if the operation is valid.
type IndicesGetMappingService ¶
type IndicesGetMappingService struct {
// contains filtered or unexported fields
}
IndicesGetMappingService retrieves the mapping definitions for an index or index/type.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-get-mapping.html for details.
func NewGetMappingService ¶
func NewGetMappingService(client *Client) *IndicesGetMappingService
NewGetMappingService is an alias for NewIndicesGetMappingService. Use NewIndicesGetMappingService.
func NewIndicesGetMappingService ¶
func NewIndicesGetMappingService(client *Client) *IndicesGetMappingService
NewIndicesGetMappingService creates a new IndicesGetMappingService.
func (*IndicesGetMappingService) AllowNoIndices ¶
func (s *IndicesGetMappingService) AllowNoIndices(allowNoIndices bool) *IndicesGetMappingService
AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices. This includes `_all` string or when no indices have been specified.
func (*IndicesGetMappingService) Do ¶
func (s *IndicesGetMappingService) Do(ctx context.Context) (map[string]interface{}, error)
Do executes the operation. It returns mapping definitions for an index or index/type.
func (*IndicesGetMappingService) ExpandWildcards ¶
func (s *IndicesGetMappingService) ExpandWildcards(expandWildcards string) *IndicesGetMappingService
ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both..
func (*IndicesGetMappingService) IgnoreUnavailable ¶
func (s *IndicesGetMappingService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesGetMappingService
IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).
func (*IndicesGetMappingService) Index ¶
func (s *IndicesGetMappingService) Index(indices ...string) *IndicesGetMappingService
Index is a list of index names.
func (*IndicesGetMappingService) Local ¶
func (s *IndicesGetMappingService) Local(local bool) *IndicesGetMappingService
Local indicates whether to return local information, do not retrieve the state from master node (default: false).
func (*IndicesGetMappingService) Pretty ¶
func (s *IndicesGetMappingService) Pretty(pretty bool) *IndicesGetMappingService
Pretty indicates that the JSON response be indented and human readable.
func (*IndicesGetMappingService) Type ¶
func (s *IndicesGetMappingService) Type(types ...string) *IndicesGetMappingService
Type is a list of document types.
func (*IndicesGetMappingService) Validate ¶
func (s *IndicesGetMappingService) Validate() error
Validate checks if the operation is valid.
type IndicesGetResponse ¶
type IndicesGetResponse struct { Aliases map[string]interface{} `json:"aliases"` Mappings map[string]interface{} `json:"mappings"` Settings map[string]interface{} `json:"settings"` Warmers map[string]interface{} `json:"warmers"` }
IndicesGetResponse is part of the response of IndicesGetService.Do.
type IndicesGetService ¶
type IndicesGetService struct {
// contains filtered or unexported fields
}
IndicesGetService retrieves information about one or more indices.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-get-index.html for more details.
func NewIndicesGetService ¶
func NewIndicesGetService(client *Client) *IndicesGetService
NewIndicesGetService creates a new IndicesGetService.
func (*IndicesGetService) AllowNoIndices ¶
func (s *IndicesGetService) AllowNoIndices(allowNoIndices bool) *IndicesGetService
AllowNoIndices indicates whether to ignore if a wildcard expression resolves to no concrete indices (default: false).
func (*IndicesGetService) Do ¶
func (s *IndicesGetService) Do(ctx context.Context) (map[string]*IndicesGetResponse, error)
Do executes the operation.
func (*IndicesGetService) ExpandWildcards ¶
func (s *IndicesGetService) ExpandWildcards(expandWildcards string) *IndicesGetService
ExpandWildcards indicates whether wildcard expressions should get expanded to open or closed indices (default: open).
func (*IndicesGetService) Feature ¶
func (s *IndicesGetService) Feature(features ...string) *IndicesGetService
Feature is a list of features.
func (*IndicesGetService) Human ¶
func (s *IndicesGetService) Human(human bool) *IndicesGetService
Human indicates whether to return version and creation date values in human-readable format (default: false).
func (*IndicesGetService) IgnoreUnavailable ¶
func (s *IndicesGetService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesGetService
IgnoreUnavailable indicates whether to ignore unavailable indexes (default: false).
func (*IndicesGetService) Index ¶
func (s *IndicesGetService) Index(indices ...string) *IndicesGetService
Index is a list of index names.
func (*IndicesGetService) Local ¶
func (s *IndicesGetService) Local(local bool) *IndicesGetService
Local indicates whether to return local information, i.e. do not retrieve the state from master node (default: false).
func (*IndicesGetService) Pretty ¶
func (s *IndicesGetService) Pretty(pretty bool) *IndicesGetService
Pretty indicates that the JSON response be indented and human readable.
func (*IndicesGetService) Validate ¶
func (s *IndicesGetService) Validate() error
Validate checks if the operation is valid.
type IndicesGetSettingsResponse ¶
type IndicesGetSettingsResponse struct {
Settings map[string]interface{} `json:"settings"`
}
IndicesGetSettingsResponse is the response of IndicesGetSettingsService.Do.
type IndicesGetSettingsService ¶
type IndicesGetSettingsService struct {
// contains filtered or unexported fields
}
IndicesGetSettingsService allows to retrieve settings of one or more indices.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-get-settings.html for more details.
func NewIndicesGetSettingsService ¶
func NewIndicesGetSettingsService(client *Client) *IndicesGetSettingsService
NewIndicesGetSettingsService creates a new IndicesGetSettingsService.
func (*IndicesGetSettingsService) AllowNoIndices ¶
func (s *IndicesGetSettingsService) AllowNoIndices(allowNoIndices bool) *IndicesGetSettingsService
AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).
func (*IndicesGetSettingsService) Do ¶
func (s *IndicesGetSettingsService) Do(ctx context.Context) (map[string]*IndicesGetSettingsResponse, error)
Do executes the operation.
func (*IndicesGetSettingsService) ExpandWildcards ¶
func (s *IndicesGetSettingsService) ExpandWildcards(expandWildcards string) *IndicesGetSettingsService
ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both. Options: open, closed, none, all. Default: open,closed.
func (*IndicesGetSettingsService) FlatSettings ¶
func (s *IndicesGetSettingsService) FlatSettings(flatSettings bool) *IndicesGetSettingsService
FlatSettings indicates whether to return settings in flat format (default: false).
func (*IndicesGetSettingsService) IgnoreUnavailable ¶
func (s *IndicesGetSettingsService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesGetSettingsService
IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).
func (*IndicesGetSettingsService) Index ¶
func (s *IndicesGetSettingsService) Index(indices ...string) *IndicesGetSettingsService
Index is a list of index names; use `_all` or empty string to perform the operation on all indices.
func (*IndicesGetSettingsService) Local ¶
func (s *IndicesGetSettingsService) Local(local bool) *IndicesGetSettingsService
Local indicates whether to return local information, do not retrieve the state from master node (default: false).
func (*IndicesGetSettingsService) Name ¶
func (s *IndicesGetSettingsService) Name(name ...string) *IndicesGetSettingsService
Name are the names of the settings that should be included.
func (*IndicesGetSettingsService) Pretty ¶
func (s *IndicesGetSettingsService) Pretty(pretty bool) *IndicesGetSettingsService
Pretty indicates that the JSON response be indented and human readable.
func (*IndicesGetSettingsService) Validate ¶
func (s *IndicesGetSettingsService) Validate() error
Validate checks if the operation is valid.
type IndicesOpenResponse ¶
type IndicesOpenResponse struct {
Acknowledged bool `json:"acknowledged"`
}
IndicesOpenResponse is the response of IndicesOpenService.Do.
type IndicesOpenService ¶
type IndicesOpenService struct {
// contains filtered or unexported fields
}
IndicesOpenService opens an index.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-open-close.html for details.
func NewIndicesOpenService ¶
func NewIndicesOpenService(client *Client) *IndicesOpenService
NewIndicesOpenService creates and initializes a new IndicesOpenService.
func (*IndicesOpenService) AllowNoIndices ¶
func (s *IndicesOpenService) AllowNoIndices(allowNoIndices bool) *IndicesOpenService
AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).
func (*IndicesOpenService) Do ¶
func (s *IndicesOpenService) Do(ctx context.Context) (*IndicesOpenResponse, error)
Do executes the operation.
func (*IndicesOpenService) ExpandWildcards ¶
func (s *IndicesOpenService) ExpandWildcards(expandWildcards string) *IndicesOpenService
ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both..
func (*IndicesOpenService) IgnoreUnavailable ¶
func (s *IndicesOpenService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesOpenService
IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).
func (*IndicesOpenService) Index ¶
func (s *IndicesOpenService) Index(index string) *IndicesOpenService
Index is the name of the index to open.
func (*IndicesOpenService) MasterTimeout ¶
func (s *IndicesOpenService) MasterTimeout(masterTimeout string) *IndicesOpenService
MasterTimeout specifies the timeout for connection to master.
func (*IndicesOpenService) Pretty ¶
func (s *IndicesOpenService) Pretty(pretty bool) *IndicesOpenService
Pretty indicates that the JSON response be indented and human readable.
func (*IndicesOpenService) Timeout ¶
func (s *IndicesOpenService) Timeout(timeout string) *IndicesOpenService
Timeout is an explicit operation timeout.
func (*IndicesOpenService) Validate ¶
func (s *IndicesOpenService) Validate() error
Validate checks if the operation is valid.
type IndicesPutMappingService ¶
type IndicesPutMappingService struct {
// contains filtered or unexported fields
}
IndicesPutMappingService allows to register specific mapping definition for a specific type.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-put-mapping.html for details.
func NewIndicesPutMappingService ¶
func NewIndicesPutMappingService(client *Client) *IndicesPutMappingService
NewIndicesPutMappingService creates a new IndicesPutMappingService.
func NewPutMappingService ¶
func NewPutMappingService(client *Client) *IndicesPutMappingService
NewPutMappingService is an alias for NewIndicesPutMappingService. Use NewIndicesPutMappingService.
func (*IndicesPutMappingService) AllowNoIndices ¶
func (s *IndicesPutMappingService) AllowNoIndices(allowNoIndices bool) *IndicesPutMappingService
AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices. This includes `_all` string or when no indices have been specified.
func (*IndicesPutMappingService) BodyJson ¶
func (s *IndicesPutMappingService) BodyJson(mapping map[string]interface{}) *IndicesPutMappingService
BodyJson contains the mapping definition.
func (*IndicesPutMappingService) BodyString ¶
func (s *IndicesPutMappingService) BodyString(mapping string) *IndicesPutMappingService
BodyString is the mapping definition serialized as a string.
func (*IndicesPutMappingService) Do ¶
func (s *IndicesPutMappingService) Do(ctx context.Context) (*PutMappingResponse, error)
Do executes the operation.
func (*IndicesPutMappingService) ExpandWildcards ¶
func (s *IndicesPutMappingService) ExpandWildcards(expandWildcards string) *IndicesPutMappingService
ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.
func (*IndicesPutMappingService) IgnoreConflicts ¶
func (s *IndicesPutMappingService) IgnoreConflicts(ignoreConflicts bool) *IndicesPutMappingService
IgnoreConflicts specifies whether to ignore conflicts while updating the mapping (default: false).
func (*IndicesPutMappingService) IgnoreUnavailable ¶
func (s *IndicesPutMappingService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesPutMappingService
IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).
func (*IndicesPutMappingService) Index ¶
func (s *IndicesPutMappingService) Index(indices ...string) *IndicesPutMappingService
Index is a list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices.
func (*IndicesPutMappingService) MasterTimeout ¶
func (s *IndicesPutMappingService) MasterTimeout(masterTimeout string) *IndicesPutMappingService
MasterTimeout specifies the timeout for connection to master.
func (*IndicesPutMappingService) Pretty ¶
func (s *IndicesPutMappingService) Pretty(pretty bool) *IndicesPutMappingService
Pretty indicates that the JSON response be indented and human readable.
func (*IndicesPutMappingService) Timeout ¶
func (s *IndicesPutMappingService) Timeout(timeout string) *IndicesPutMappingService
Timeout is an explicit operation timeout.
func (*IndicesPutMappingService) Type ¶
func (s *IndicesPutMappingService) Type(typ string) *IndicesPutMappingService
Type is the name of the document type.
func (*IndicesPutMappingService) Validate ¶
func (s *IndicesPutMappingService) Validate() error
Validate checks if the operation is valid.
type InnerHit ¶
type InnerHit struct {
// contains filtered or unexported fields
}
InnerHit implements a simple join for parent/child, nested, and even top-level documents in Elasticsearch. It is an experimental feature for Elasticsearch versions 1.5 (or greater). See http://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-inner-hits.html for documentation.
See the tests for SearchSource, HasChildFilter, HasChildQuery, HasParentFilter, HasParentQuery, NestedFilter, and NestedQuery for usage examples.
func (*InnerHit) DocvalueField ¶
func (*InnerHit) DocvalueFields ¶
func (*InnerHit) FetchSource ¶
func (*InnerHit) FetchSourceContext ¶
func (hit *InnerHit) FetchSourceContext(fetchSourceContext *FetchSourceContext) *InnerHit
func (*InnerHit) Highlighter ¶
func (*InnerHit) NoStoredFields ¶
func (*InnerHit) SortWithInfo ¶
func (*InnerHit) StoredField ¶
func (*InnerHit) StoredFields ¶
func (*InnerHit) TrackScores ¶
type Logger ¶
type Logger interface {
Printf(format string, v ...interface{})
}
Logger specifies the interface for all log operations.
type MatchAllQuery ¶
type MatchAllQuery struct {
// contains filtered or unexported fields
}
MatchAllQuery is the most simple query, which matches all documents, giving them all a _score of 1.0.
For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-match-all-query.html
func NewMatchAllQuery ¶
func NewMatchAllQuery() *MatchAllQuery
NewMatchAllQuery creates and initializes a new match all query.
func (*MatchAllQuery) Boost ¶
func (q *MatchAllQuery) Boost(boost float64) *MatchAllQuery
Boost sets the boost for this query. Documents matching this query will (in addition to the normal weightings) have their score multiplied by the boost provided.
func (MatchAllQuery) Source ¶
func (q MatchAllQuery) Source() (interface{}, error)
Source returns JSON for the function score query.
type MatchQuery ¶
type MatchQuery struct {
// contains filtered or unexported fields
}
MatchQuery is a family of queries that accepts text/numerics/dates, analyzes them, and constructs a query.
To create a new MatchQuery, use NewMatchQuery. To create specific types of queries, e.g. a match_phrase query, use NewMatchPhrQuery(...).Type("phrase"), or use one of the shortcuts e.g. NewMatchPhraseQuery(...).
For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-match-query.html
func NewMatchPhrasePrefixQuery ¶
func NewMatchPhrasePrefixQuery(name string, text interface{}) *MatchQuery
NewMatchPhrasePrefixQuery creates and initializes a new MatchQuery of type phrase_prefix.
func NewMatchPhraseQuery ¶
func NewMatchPhraseQuery(name string, text interface{}) *MatchQuery
NewMatchPhraseQuery creates and initializes a new MatchQuery of type phrase.
func NewMatchQuery ¶
func NewMatchQuery(name string, text interface{}) *MatchQuery
NewMatchQuery creates and initializes a new MatchQuery.
func (*MatchQuery) Analyzer ¶
func (q *MatchQuery) Analyzer(analyzer string) *MatchQuery
Analyzer explicitly sets the analyzer to use. It defaults to use explicit mapping config for the field, or, if not set, the default search analyzer.
func (*MatchQuery) Boost ¶
func (q *MatchQuery) Boost(boost float64) *MatchQuery
Boost sets the boost to apply to this query.
func (*MatchQuery) CutoffFrequency ¶
func (q *MatchQuery) CutoffFrequency(cutoff float64) *MatchQuery
CutoffFrequency can be a value in [0..1] (or an absolute number >=1). It represents the maximum treshold of a terms document frequency to be considered a low frequency term.
func (*MatchQuery) Fuzziness ¶
func (q *MatchQuery) Fuzziness(fuzziness string) *MatchQuery
Fuzziness sets the fuzziness when evaluated to a fuzzy query type. Defaults to "AUTO".
func (*MatchQuery) FuzzyRewrite ¶
func (q *MatchQuery) FuzzyRewrite(fuzzyRewrite string) *MatchQuery
func (*MatchQuery) FuzzyTranspositions ¶
func (q *MatchQuery) FuzzyTranspositions(fuzzyTranspositions bool) *MatchQuery
func (*MatchQuery) Lenient ¶
func (q *MatchQuery) Lenient(lenient bool) *MatchQuery
Lenient specifies whether format based failures will be ignored.
func (*MatchQuery) MaxExpansions ¶
func (q *MatchQuery) MaxExpansions(maxExpansions int) *MatchQuery
MaxExpansions is used with fuzzy or prefix type queries. It specifies the number of term expansions to use. It defaults to unbounded so that its recommended to set it to a reasonable value for faster execution.
func (*MatchQuery) MinimumShouldMatch ¶
func (q *MatchQuery) MinimumShouldMatch(minimumShouldMatch string) *MatchQuery
func (*MatchQuery) Operator ¶
func (q *MatchQuery) Operator(operator string) *MatchQuery
Operator sets the operator to use when using a boolean query. Can be "AND" or "OR" (default).
func (*MatchQuery) PrefixLength ¶
func (q *MatchQuery) PrefixLength(prefixLength int) *MatchQuery
func (*MatchQuery) QueryName ¶
func (q *MatchQuery) QueryName(queryName string) *MatchQuery
QueryName sets the query name for the filter that can be used when searching for matched filters per hit.
func (*MatchQuery) Rewrite ¶
func (q *MatchQuery) Rewrite(rewrite string) *MatchQuery
func (*MatchQuery) Slop ¶
func (q *MatchQuery) Slop(slop int) *MatchQuery
Slop sets the phrase slop if evaluated to a phrase query type.
func (*MatchQuery) Source ¶
func (q *MatchQuery) Source() (interface{}, error)
Source returns JSON for the function score query.
func (*MatchQuery) Type ¶
func (q *MatchQuery) Type(typ string) *MatchQuery
Type can be "boolean", "phrase", or "phrase_prefix". Defaults to "boolean".
func (*MatchQuery) ZeroTermsQuery ¶
func (q *MatchQuery) ZeroTermsQuery(zeroTermsQuery string) *MatchQuery
ZeroTermsQuery can be "all" or "none".
type NodesInfoNode ¶
type NodesInfoNode struct { // Name of the node, e.g. "Mister Fear" Name string `json:"name"` // TransportAddress, e.g. "127.0.0.1:9300" TransportAddress string `json:"transport_address"` // Host is the host name, e.g. "macbookair" Host string `json:"host"` // IP is the IP address, e.g. "192.168.1.2" IP string `json:"ip"` // Version is the Elasticsearch version running on the node, e.g. "1.4.3" Version string `json:"version"` // Build is the Elasticsearch build, e.g. "36a29a7" Build string `json:"build"` // HTTPAddress, e.g. "127.0.0.1:9200" HTTPAddress string `json:"http_address"` // HTTPSAddress, e.g. "127.0.0.1:9200" HTTPSAddress string `json:"https_address"` // Attributes of the node. Attributes map[string]interface{} `json:"attributes"` // Settings of the node, e.g. paths and pidfile. Settings map[string]interface{} `json:"settings"` // OS information, e.g. CPU and memory. OS *NodesInfoNodeOS `json:"os"` // Process information, e.g. max file descriptors. Process *NodesInfoNodeProcess `json:"process"` // JVM information, e.g. VM version. JVM *NodesInfoNodeJVM `json:"jvm"` // ThreadPool information. ThreadPool *NodesInfoNodeThreadPool `json:"thread_pool"` // Network information. Network *NodesInfoNodeNetwork `json:"network"` // Network information. Transport *NodesInfoNodeTransport `json:"transport"` // HTTP information. HTTP *NodesInfoNodeHTTP `json:"http"` // Plugins information. Plugins []*NodesInfoNodePlugin `json:"plugins"` }
type NodesInfoNodeHTTP ¶
type NodesInfoNodeHTTP struct { BoundAddress []string `json:"bound_address"` // e.g. ["127.0.0.1:9200", "[fe80::1]:9200", "[::1]:9200"] PublishAddress string `json:"publish_address"` // e.g. "127.0.0.1:9300" MaxContentLength string `json:"max_content_length"` // e.g. "100mb" MaxContentLengthInBytes int64 `json:"max_content_length_in_bytes"` }
type NodesInfoNodeJVM ¶
type NodesInfoNodeJVM struct { PID int `json:"pid"` // process id, e.g. 87079 Version string `json:"version"` // e.g. "1.8.0_25" VMName string `json:"vm_name"` // e.g. "Java HotSpot(TM) 64-Bit Server VM" VMVersion string `json:"vm_version"` // e.g. "25.25-b02" VMVendor string `json:"vm_vendor"` // e.g. "Oracle Corporation" StartTime time.Time `json:"start_time"` // e.g. "2015-01-03T15:18:30.982Z" StartTimeInMillis int64 `json:"start_time_in_millis"` // Mem information Mem struct { HeapInit string `json:"heap_init"` // e.g. 1gb HeapInitInBytes int `json:"heap_init_in_bytes"` HeapMax string `json:"heap_max"` // e.g. 4gb HeapMaxInBytes int `json:"heap_max_in_bytes"` NonHeapInit string `json:"non_heap_init"` // e.g. 2.4mb NonHeapInitInBytes int `json:"non_heap_init_in_bytes"` NonHeapMax string `json:"non_heap_max"` // e.g. 0b NonHeapMaxInBytes int `json:"non_heap_max_in_bytes"` DirectMax string `json:"direct_max"` // e.g. 4gb DirectMaxInBytes int `json:"direct_max_in_bytes"` } `json:"mem"` GCCollectors []string `json:"gc_collectors"` // e.g. ["ParNew"] MemoryPools []string `json:"memory_pools"` // e.g. ["Code Cache", "Metaspace"] }
type NodesInfoNodeNetwork ¶
type NodesInfoNodeNetwork struct { RefreshInterval string `json:"refresh_interval"` // e.g. 1s RefreshIntervalInMillis int `json:"refresh_interval_in_millis"` // e.g. 1000 PrimaryInterface struct { Address string `json:"address"` // e.g. 192.168.1.2 Name string `json:"name"` // e.g. en0 MACAddress string `json:"mac_address"` // e.g. 11:22:33:44:55:66 } `json:"primary_interface"` }
type NodesInfoNodeOS ¶
type NodesInfoNodeOS struct { RefreshInterval string `json:"refresh_interval"` // e.g. 1s RefreshIntervalInMillis int `json:"refresh_interval_in_millis"` // e.g. 1000 AvailableProcessors int `json:"available_processors"` // e.g. 4 // CPU information CPU struct { Vendor string `json:"vendor"` // e.g. Intel Model string `json:"model"` // e.g. iMac15,1 MHz int `json:"mhz"` // e.g. 3500 TotalCores int `json:"total_cores"` // e.g. 4 TotalSockets int `json:"total_sockets"` // e.g. 4 CoresPerSocket int `json:"cores_per_socket"` // e.g. 16 CacheSizeInBytes int `json:"cache_size_in_bytes"` // e.g. 256 } `json:"cpu"` // Mem information Mem struct { Total string `json:"total"` // e.g. 16gb TotalInBytes int `json:"total_in_bytes"` // e.g. 17179869184 } `json:"mem"` // Swap information Swap struct { Total string `json:"total"` // e.g. 1gb TotalInBytes int `json:"total_in_bytes"` // e.g. 1073741824 } `json:"swap"` }
type NodesInfoNodePlugin ¶
type NodesInfoNodeProcess ¶
type NodesInfoNodeProcess struct { RefreshInterval string `json:"refresh_interval"` // e.g. 1s RefreshIntervalInMillis int `json:"refresh_interval_in_millis"` // e.g. 1000 ID int `json:"id"` // process id, e.g. 87079 MaxFileDescriptors int `json:"max_file_descriptors"` // e.g. 32768 Mlockall bool `json:"mlockall"` // e.g. false }
type NodesInfoNodeThreadPool ¶
type NodesInfoNodeThreadPool struct { Percolate *NodesInfoNodeThreadPoolSection `json:"percolate"` Bench *NodesInfoNodeThreadPoolSection `json:"bench"` Listener *NodesInfoNodeThreadPoolSection `json:"listener"` Index *NodesInfoNodeThreadPoolSection `json:"index"` Refresh *NodesInfoNodeThreadPoolSection `json:"refresh"` Suggest *NodesInfoNodeThreadPoolSection `json:"suggest"` Generic *NodesInfoNodeThreadPoolSection `json:"generic"` Warmer *NodesInfoNodeThreadPoolSection `json:"warmer"` Search *NodesInfoNodeThreadPoolSection `json:"search"` Flush *NodesInfoNodeThreadPoolSection `json:"flush"` Optimize *NodesInfoNodeThreadPoolSection `json:"optimize"` Management *NodesInfoNodeThreadPoolSection `json:"management"` Get *NodesInfoNodeThreadPoolSection `json:"get"` Merge *NodesInfoNodeThreadPoolSection `json:"merge"` Bulk *NodesInfoNodeThreadPoolSection `json:"bulk"` Snapshot *NodesInfoNodeThreadPoolSection `json:"snapshot"` }
type NodesInfoNodeTransport ¶
type NodesInfoNodeTransport struct { BoundAddress []string `json:"bound_address"` PublishAddress string `json:"publish_address"` Profiles map[string]*NodesInfoNodeTransportProfile `json:"profiles"` }
type NodesInfoResponse ¶
type NodesInfoResponse struct { ClusterName string `json:"cluster_name"` Nodes map[string]*NodesInfoNode `json:"nodes"` }
NodesInfoResponse is the response of NodesInfoService.Do.
type NodesInfoService ¶
type NodesInfoService struct {
// contains filtered or unexported fields
}
NodesInfoService allows to retrieve one or more or all of the cluster nodes information. It is documented at https://www.elastic.co/guide/en/elasticsearch/reference/5.2/cluster-nodes-info.html.
func NewNodesInfoService ¶
func NewNodesInfoService(client *Client) *NodesInfoService
NewNodesInfoService creates a new NodesInfoService.
func (*NodesInfoService) Do ¶
func (s *NodesInfoService) Do(ctx context.Context) (*NodesInfoResponse, error)
Do executes the operation.
func (*NodesInfoService) FlatSettings ¶
func (s *NodesInfoService) FlatSettings(flatSettings bool) *NodesInfoService
FlatSettings returns settings in flat format (default: false).
func (*NodesInfoService) Human ¶
func (s *NodesInfoService) Human(human bool) *NodesInfoService
Human indicates whether to return time and byte values in human-readable format.
func (*NodesInfoService) Metric ¶
func (s *NodesInfoService) Metric(metric ...string) *NodesInfoService
Metric is a list of metrics you wish returned. Leave empty to return all. Valid metrics are: settings, os, process, jvm, thread_pool, network, transport, http, and plugins.
func (*NodesInfoService) NodeId ¶
func (s *NodesInfoService) NodeId(nodeId ...string) *NodesInfoService
NodeId is a list of node IDs or names to limit the returned information. Use "_local" to return information from the node you're connecting to, leave empty to get information from all nodes.
func (*NodesInfoService) Pretty ¶
func (s *NodesInfoService) Pretty(pretty bool) *NodesInfoService
Pretty indicates whether to indent the returned JSON.
func (*NodesInfoService) Validate ¶
func (s *NodesInfoService) Validate() error
Validate checks if the operation is valid.
type Notify ¶
type Notify func(error)
Notify is a notify-on-error function. It receives error returned from an operation.
Notice that if the backoff policy stated to stop retrying, the notify function isn't called.
type Operation ¶
type Operation func() error
An Operation is executing by Retry() or RetryNotify(). The operation will be retried using a backoff policy if it returns an error.
type PingResult ¶
type PingResult struct { Name string `json:"name"` ClusterName string `json:"cluster_name"` Version struct { Number string `json:"number"` BuildHash string `json:"build_hash"` BuildTimestamp string `json:"build_timestamp"` BuildSnapshot bool `json:"build_snapshot"` LuceneVersion string `json:"lucene_version"` } `json:"version"` TagLine string `json:"tagline"` }
PingResult is the result returned from querying the Elasticsearch server.
type PingService ¶
type PingService struct {
// contains filtered or unexported fields
}
PingService checks if an Elasticsearch server on a given URL is alive. When asked for, it can also return various information about the Elasticsearch server, e.g. the Elasticsearch version number.
Ping simply starts a HTTP GET request to the URL of the server. If the server responds with HTTP Status code 200 OK, the server is alive.
func NewPingService ¶
func NewPingService(client *Client) *PingService
func (*PingService) Do ¶
func (s *PingService) Do(ctx context.Context) (*PingResult, int, error)
Do returns the PingResult, the HTTP status code of the Elasticsearch server, and an error.
func (*PingService) HttpHeadOnly ¶
func (s *PingService) HttpHeadOnly(httpHeadOnly bool) *PingService
HeadOnly makes the service to only return the status code in Do; the PingResult will be nil.
func (*PingService) Pretty ¶
func (s *PingService) Pretty(pretty bool) *PingService
func (*PingService) Timeout ¶
func (s *PingService) Timeout(timeout string) *PingService
func (*PingService) URL ¶
func (s *PingService) URL(url string) *PingService
type ProfileResult ¶
type ProfileResult struct { Type string `json:"type"` Description string `json:"description,omitempty"` NodeTime string `json:"time,omitempty"` NodeTimeNanos int64 `json:"time_in_nanos,omitempty"` Breakdown map[string]int64 `json:"breakdown,omitempty"` Children []ProfileResult `json:"children,omitempty"` }
ProfileResult is the internal representation of a profiled query, corresponding to a single node in the query tree.
type PutMappingResponse ¶
type PutMappingResponse struct {
Acknowledged bool `json:"acknowledged"`
}
PutMappingResponse is the response of IndicesPutMappingService.Do.
type Query ¶
type Query interface { // Source returns the JSON-serializable query request. Source() (interface{}, error) }
Query represents the generic query interface. A query's sole purpose is to return the source of the query as a JSON-serializable object. Returning map[string]interface{} is the norm for queries.
type QueryProfileShardResult ¶
type QueryProfileShardResult struct { Query []ProfileResult `json:"query,omitempty"` RewriteTime int64 `json:"rewrite_time,omitempty"` Collector []interface{} `json:"collector,omitempty"` }
QueryProfileShardResult is a container class to hold the profile results for a single shard in the request. It comtains a list of query profiles, a collector tree and a total rewrite tree.
type QueryRescorer ¶
type QueryRescorer struct {
// contains filtered or unexported fields
}
func NewQueryRescorer ¶
func NewQueryRescorer(query Query) *QueryRescorer
func (*QueryRescorer) Name ¶
func (r *QueryRescorer) Name() string
func (*QueryRescorer) QueryWeight ¶
func (r *QueryRescorer) QueryWeight(queryWeight float64) *QueryRescorer
func (*QueryRescorer) RescoreQueryWeight ¶
func (r *QueryRescorer) RescoreQueryWeight(rescoreQueryWeight float64) *QueryRescorer
func (*QueryRescorer) ScoreMode ¶
func (r *QueryRescorer) ScoreMode(scoreMode string) *QueryRescorer
func (*QueryRescorer) Source ¶
func (r *QueryRescorer) Source() (interface{}, error)
type RefreshResult ¶
type RefreshResult struct {
Shards shardsInfo `json:"_shards,omitempty"`
}
RefreshResult is the outcome of RefreshService.Do.
type RefreshService ¶
type RefreshService struct {
// contains filtered or unexported fields
}
RefreshService explicitly refreshes one or more indices. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-refresh.html.
func NewRefreshService ¶
func NewRefreshService(client *Client) *RefreshService
NewRefreshService creates a new instance of RefreshService.
func (*RefreshService) Do ¶
func (s *RefreshService) Do(ctx context.Context) (*RefreshResult, error)
Do executes the request.
func (*RefreshService) Force ¶
func (s *RefreshService) Force(force bool) *RefreshService
Force forces a refresh.
func (*RefreshService) Index ¶
func (s *RefreshService) Index(index ...string) *RefreshService
Index specifies the indices to refresh.
func (*RefreshService) Pretty ¶
func (s *RefreshService) Pretty(pretty bool) *RefreshService
Pretty asks Elasticsearch to return indented JSON.
type Request ¶
Elasticsearch-specific HTTP request
func NewRequest ¶
NewRequest is a http.Request and adds features such as encoding the body.
func (*Request) SetBasicAuth ¶
SetBasicAuth wraps http.Request's SetBasicAuth.
type Rescore ¶
type Rescore struct {
// contains filtered or unexported fields
}
func NewRescore ¶
func NewRescore() *Rescore
func (*Rescore) WindowSize ¶
type Response ¶
type Response struct { // StatusCode is the HTTP status code, e.g. 200. StatusCode int // Header is the HTTP header from the HTTP response. // Keys in the map are canonicalized (see http.CanonicalHeaderKey). Header http.Header // Body is the deserialized response body. Body json.RawMessage }
Response represents a response from Elasticsearch.
type Retrier ¶
type Retrier interface { // Retry is called when a request has failed. It decides whether to retry // the call, how long to wait for the next call, or whether to return an // error (which will be returned to the service that started the HTTP // request in the first place). // // Callers may also use this to inspect the HTTP request/response and // the error that happened. Additional data can be passed through via // the context. Retry(ctx context.Context, retry int, req *http.Request, resp *http.Response, err error) (time.Duration, bool, error) }
Retrier decides whether to retry a failed HTTP request with Elasticsearch.
type RetrierFunc ¶
type RetrierFunc func(context.Context, int, *http.Request, *http.Response, error) (time.Duration, bool, error)
RetrierFunc specifies the signature of a Retry function.
type ScoreSort ¶
type ScoreSort struct { Sorter // contains filtered or unexported fields }
ScoreSort sorts by relevancy score.
type SearchExplanation ¶
type SearchExplanation struct { Value float64 `json:"value"` // e.g. 1.0 Description string `json:"description"` // e.g. "boost" or "ConstantScore(*:*), product of:" Details []SearchExplanation `json:"details,omitempty"` // recursive details }
SearchExplanation explains how the score for a hit was computed. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-explain.html.
type SearchHit ¶
type SearchHit struct { Score *float64 `json:"_score"` // computed score Index string `json:"_index"` // index name Type string `json:"_type"` // type meta field Id string `json:"_id"` // external or internal Uid string `json:"_uid"` // uid meta field (see MapperService.java for all meta fields) Routing string `json:"_routing"` // routing meta field Parent string `json:"_parent"` // parent meta field Version *int64 `json:"_version"` // version number, when Version is set to true in SearchService Sort []interface{} `json:"sort"` // sort information Highlight SearchHitHighlight `json:"highlight"` // highlighter information Source *json.RawMessage `json:"_source"` // stored document source Fields map[string]interface{} `json:"fields"` // returned (stored) fields Explanation *SearchExplanation `json:"_explanation"` // explains how the score was computed MatchedQueries []string `json:"matched_queries"` // matched queries InnerHits map[string]*SearchHitInnerHits `json:"inner_hits"` // inner hits with ES >= 1.5.0 }
SearchHit is a single hit.
type SearchHitHighlight ¶
SearchHitHighlight is the highlight information of a search hit. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-highlighting.html for a general discussion of highlighting.
type SearchHitInnerHits ¶
type SearchHitInnerHits struct {
Hits *SearchHits `json:"hits"`
}
type SearchHits ¶
type SearchHits struct { TotalHits int64 `json:"total"` // total number of hits found MaxScore *float64 `json:"max_score"` // maximum score of all hits Hits []*SearchHit `json:"hits"` // the actual hits returned }
SearchHits specifies the list of search hits.
type SearchProfile ¶
type SearchProfile struct {
Shards []SearchProfileShardResult `json:"shards"`
}
SearchProfile is a list of shard profiling data collected during query execution in the "profile" section of a SearchResult
type SearchProfileShardResult ¶
type SearchProfileShardResult struct { ID string `json:"id"` Searches []QueryProfileShardResult `json:"searches"` Aggregations []ProfileResult `json:"aggregations"` }
SearchProfileShardResult returns the profiling data for a single shard accessed during the search query or aggregation.
type SearchRequest ¶
type SearchRequest struct {
// contains filtered or unexported fields
}
SearchRequest combines a search request and its query details (see SearchSource). It is used in combination with MultiSearch.
func NewSearchRequest ¶
func NewSearchRequest() *SearchRequest
NewSearchRequest creates a new search request.
func (*SearchRequest) AllowNoIndices ¶
func (s *SearchRequest) AllowNoIndices(allowNoIndices bool) *SearchRequest
AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).
func (*SearchRequest) ExpandWildcards ¶
func (s *SearchRequest) ExpandWildcards(expandWildcards string) *SearchRequest
ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.
func (*SearchRequest) HasIndices ¶
func (r *SearchRequest) HasIndices() bool
func (*SearchRequest) IgnoreUnavailable ¶
func (s *SearchRequest) IgnoreUnavailable(ignoreUnavailable bool) *SearchRequest
IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).
func (*SearchRequest) Index ¶
func (r *SearchRequest) Index(indices ...string) *SearchRequest
func (*SearchRequest) Preference ¶
func (r *SearchRequest) Preference(preference string) *SearchRequest
func (*SearchRequest) RequestCache ¶
func (r *SearchRequest) RequestCache(requestCache bool) *SearchRequest
func (*SearchRequest) Routing ¶
func (r *SearchRequest) Routing(routing string) *SearchRequest
func (*SearchRequest) Routings ¶
func (r *SearchRequest) Routings(routings ...string) *SearchRequest
func (*SearchRequest) Scroll ¶
func (r *SearchRequest) Scroll(scroll string) *SearchRequest
func (*SearchRequest) SearchSource ¶
func (r *SearchRequest) SearchSource(searchSource *SearchSource) *SearchRequest
func (*SearchRequest) SearchType ¶
func (r *SearchRequest) SearchType(searchType string) *SearchRequest
SearchRequest must be one of "query_then_fetch", "query_and_fetch", "scan", "count", "dfs_query_then_fetch", or "dfs_query_and_fetch". Use one of the constants defined via SearchType.
func (*SearchRequest) SearchTypeCount ¶
func (r *SearchRequest) SearchTypeCount() *SearchRequest
func (*SearchRequest) SearchTypeDfsQueryAndFetch ¶
func (r *SearchRequest) SearchTypeDfsQueryAndFetch() *SearchRequest
func (*SearchRequest) SearchTypeDfsQueryThenFetch ¶
func (r *SearchRequest) SearchTypeDfsQueryThenFetch() *SearchRequest
func (*SearchRequest) SearchTypeQueryAndFetch ¶
func (r *SearchRequest) SearchTypeQueryAndFetch() *SearchRequest
func (*SearchRequest) SearchTypeQueryThenFetch ¶
func (r *SearchRequest) SearchTypeQueryThenFetch() *SearchRequest
func (*SearchRequest) SearchTypeScan ¶
func (r *SearchRequest) SearchTypeScan() *SearchRequest
func (*SearchRequest) Source ¶
func (r *SearchRequest) Source(source interface{}) *SearchRequest
func (*SearchRequest) Type ¶
func (r *SearchRequest) Type(types ...string) *SearchRequest
type SearchResult ¶
type SearchResult struct { TookInMillis int64 `json:"took"` // search time in milliseconds ScrollId string `json:"_scroll_id"` // only used with Scroll and Scan operations Hits *SearchHits `json:"hits"` // the actual search hits Suggest SearchSuggest `json:"suggest"` // results from suggesters Aggregations Aggregations `json:"aggregations"` // results from aggregations TimedOut bool `json:"timed_out"` // true if the search timed out Error *ErrorDetails `json:"error,omitempty"` // only used in MultiGet Profile *SearchProfile `json:"profile,omitempty"` // profiling results, if optional Profile API was active for this search Shards *shardsInfo `json:"_shards,omitempty"` // shard information }
SearchResult is the result of a search in Elasticsearch.
Example ¶
package main import ( "context" "encoding/json" "fmt" "reflect" "time" elastic "github.com/venicegeo/pz-gocommon/elasticsearch/elastic-5-api" ) type Tweet struct { User string `json:"user"` Message string `json:"message"` Retweets int `json:"retweets"` Image string `json:"image,omitempty"` Created time.Time `json:"created,omitempty"` Tags []string `json:"tags,omitempty"` Location string `json:"location,omitempty"` } func main() { client, err := elastic.NewClient() if err != nil { panic(err) } // Do a search searchResult, err := client.Search().Index("twitter").Query(elastic.NewMatchAllQuery()).Do(context.Background()) if err != nil { panic(err) } // searchResult is of type SearchResult and returns hits, suggestions, // and all kinds of other information from Elasticsearch. fmt.Printf("Query took %d milliseconds\n", searchResult.TookInMillis) // Each is a utility function that iterates over hits in a search result. // It makes sure you don't need to check for nil values in the response. // However, it ignores errors in serialization. If you want full control // over iterating the hits, see below. var ttyp Tweet for _, item := range searchResult.Each(reflect.TypeOf(ttyp)) { t := item.(Tweet) fmt.Printf("Tweet by %s: %s\n", t.User, t.Message) } fmt.Printf("Found a total of %d tweets\n", searchResult.TotalHits()) // Here's how you iterate hits with full control. if searchResult.Hits.TotalHits > 0 { fmt.Printf("Found a total of %d tweets\n", searchResult.Hits.TotalHits) // Iterate through results for _, hit := range searchResult.Hits.Hits { // hit.Index contains the name of the index // Deserialize hit.Source into a Tweet (could also be just a map[string]interface{}). var t Tweet err := json.Unmarshal(*hit.Source, &t) if err != nil { // Deserialization failed } // Work with tweet fmt.Printf("Tweet by %s: %s\n", t.User, t.Message) } } else { // No hits fmt.Print("Found no tweets\n") } }
Output:
func (*SearchResult) Each ¶
func (r *SearchResult) Each(typ reflect.Type) []interface{}
Each is a utility function to iterate over all hits. It saves you from checking for nil values. Notice that Each will ignore errors in serializing JSON.
func (*SearchResult) TotalHits ¶
func (r *SearchResult) TotalHits() int64
TotalHits is a convenience function to return the number of hits for a search result.
type SearchService ¶
type SearchService struct {
// contains filtered or unexported fields
}
Search for documents in Elasticsearch.
Example ¶
package main import ( "context" "encoding/json" "fmt" "time" elastic "github.com/venicegeo/pz-gocommon/elasticsearch/elastic-5-api" ) type Tweet struct { User string `json:"user"` Message string `json:"message"` Retweets int `json:"retweets"` Image string `json:"image,omitempty"` Created time.Time `json:"created,omitempty"` Tags []string `json:"tags,omitempty"` Location string `json:"location,omitempty"` } func main() { // Get a client to the local Elasticsearch instance. client, err := elastic.NewClient() if err != nil { // Handle error panic(err) } // Search with a term query termQuery := elastic.NewTermQuery("user", "olivere") searchResult, err := client.Search(). Index("twitter"). // search in index "twitter" Query(termQuery). // specify the query Sort("user", true). // sort by "user" field, ascending From(0).Size(10). // take documents 0-9 Pretty(true). // pretty print request and response JSON Do(context.Background()) // execute if err != nil { // Handle error panic(err) } // searchResult is of type SearchResult and returns hits, suggestions, // and all kinds of other information from Elasticsearch. fmt.Printf("Query took %d milliseconds\n", searchResult.TookInMillis) // Number of hits if searchResult.Hits.TotalHits > 0 { fmt.Printf("Found a total of %d tweets\n", searchResult.Hits.TotalHits) // Iterate through results for _, hit := range searchResult.Hits.Hits { // hit.Index contains the name of the index // Deserialize hit.Source into a Tweet (could also be just a map[string]interface{}). var t Tweet err := json.Unmarshal(*hit.Source, &t) if err != nil { // Deserialization failed } // Work with tweet fmt.Printf("Tweet by %s: %s\n", t.User, t.Message) } } else { // No hits fmt.Print("Found no tweets\n") } }
Output:
func NewSearchService ¶
func NewSearchService(client *Client) *SearchService
NewSearchService creates a new service for searching in Elasticsearch.
func (*SearchService) Aggregation ¶
func (s *SearchService) Aggregation(name string, aggregation Aggregation) *SearchService
Aggregation adds an aggreation to perform as part of the search.
func (*SearchService) AllowNoIndices ¶
func (s *SearchService) AllowNoIndices(allowNoIndices bool) *SearchService
AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).
func (*SearchService) Do ¶
func (s *SearchService) Do(ctx context.Context) (*SearchResult, error)
Do executes the search and returns a SearchResult.
func (*SearchService) ExpandWildcards ¶
func (s *SearchService) ExpandWildcards(expandWildcards string) *SearchService
ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.
func (*SearchService) Explain ¶
func (s *SearchService) Explain(explain bool) *SearchService
Explain indicates whether each search hit should be returned with an explanation of the hit (ranking).
func (*SearchService) FetchSource ¶
func (s *SearchService) FetchSource(fetchSource bool) *SearchService
FetchSource indicates whether the response should contain the stored _source for every hit.
func (*SearchService) FetchSourceContext ¶
func (s *SearchService) FetchSourceContext(fetchSourceContext *FetchSourceContext) *SearchService
FetchSourceContext indicates how the _source should be fetched.
func (*SearchService) FilterPath ¶
func (s *SearchService) FilterPath(filterPath ...string) *SearchService
FilterPath allows reducing the response, a mechanism known as response filtering and described here: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/common-options.html#common-options-response-filtering.
func (*SearchService) From ¶
func (s *SearchService) From(from int) *SearchService
From index to start the search from. Defaults to 0.
func (*SearchService) GlobalSuggestText ¶
func (s *SearchService) GlobalSuggestText(globalText string) *SearchService
GlobalSuggestText defines the global text to use with all suggesters. This avoids repetition.
func (*SearchService) Highlight ¶
func (s *SearchService) Highlight(highlight *Highlight) *SearchService
Highlight adds highlighting to the search.
func (*SearchService) IgnoreUnavailable ¶
func (s *SearchService) IgnoreUnavailable(ignoreUnavailable bool) *SearchService
IgnoreUnavailable indicates whether the specified concrete indices should be ignored when unavailable (missing or closed).
func (*SearchService) Index ¶
func (s *SearchService) Index(index ...string) *SearchService
Index sets the names of the indices to use for search.
func (*SearchService) MinScore ¶
func (s *SearchService) MinScore(minScore float64) *SearchService
MinScore sets the minimum score below which docs will be filtered out.
func (*SearchService) NoStoredFields ¶
func (s *SearchService) NoStoredFields() *SearchService
NoStoredFields indicates that no stored fields should be loaded, resulting in only id and type to be returned per field.
func (*SearchService) PostFilter ¶
func (s *SearchService) PostFilter(postFilter Query) *SearchService
PostFilter will be executed after the query has been executed and only affects the search hits, not the aggregations. This filter is always executed as the last filtering mechanism.
func (*SearchService) Preference ¶
func (s *SearchService) Preference(preference string) *SearchService
Preference sets the preference to execute the search. Defaults to randomize across shards ("random"). Can be set to "_local" to prefer local shards, "_primary" to execute on primary shards only, or a custom value which guarantees that the same order will be used across different requests.
func (*SearchService) Pretty ¶
func (s *SearchService) Pretty(pretty bool) *SearchService
Pretty enables the caller to indent the JSON output.
func (*SearchService) Profile ¶
func (s *SearchService) Profile(profile bool) *SearchService
Profile sets the Profile API flag on the search source. When enabled, a search executed by this service will return query profiling data.
func (*SearchService) Query ¶
func (s *SearchService) Query(query Query) *SearchService
Query sets the query to perform, e.g. MatchAllQuery.
func (*SearchService) RequestCache ¶
func (s *SearchService) RequestCache(requestCache bool) *SearchService
RequestCache indicates whether the cache should be used for this request or not, defaults to index level setting.
func (*SearchService) Routing ¶
func (s *SearchService) Routing(routings ...string) *SearchService
Routing is a list of specific routing values to control the shards the search will be executed on.
func (*SearchService) SearchAfter ¶
func (s *SearchService) SearchAfter(sortValues ...interface{}) *SearchService
SearchAfter allows a different form of pagination by using a live cursor, using the results of the previous page to help the retrieval of the next.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-search-after.html
func (*SearchService) SearchSource ¶
func (s *SearchService) SearchSource(searchSource *SearchSource) *SearchService
SearchSource sets the search source builder to use with this service.
func (*SearchService) SearchType ¶
func (s *SearchService) SearchType(searchType string) *SearchService
SearchType sets the search operation type. Valid values are: "query_then_fetch", "query_and_fetch", "dfs_query_then_fetch", "dfs_query_and_fetch", "count", "scan". See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-search-type.html for details.
func (*SearchService) Size ¶
func (s *SearchService) Size(size int) *SearchService
Size is the number of search hits to return. Defaults to 10.
func (*SearchService) Sort ¶
func (s *SearchService) Sort(field string, ascending bool) *SearchService
Sort adds a sort order.
func (*SearchService) SortBy ¶
func (s *SearchService) SortBy(sorter ...Sorter) *SearchService
SortBy adds a sort order.
func (*SearchService) SortWithInfo ¶
func (s *SearchService) SortWithInfo(info SortInfo) *SearchService
SortWithInfo adds a sort order.
func (*SearchService) Source ¶
func (s *SearchService) Source(source interface{}) *SearchService
Source allows the user to set the request body manually without using any of the structs and interfaces in Elastic.
func (*SearchService) StoredField ¶
func (s *SearchService) StoredField(fieldName string) *SearchService
StoredField adds a single field to load and return (note, must be stored) as part of the search request. If none are specified, the source of the document will be returned.
func (*SearchService) StoredFields ¶
func (s *SearchService) StoredFields(fields ...string) *SearchService
StoredFields sets the fields to load and return as part of the search request. If none are specified, the source of the document will be returned.
func (*SearchService) Timeout ¶
func (s *SearchService) Timeout(timeout string) *SearchService
Timeout sets the timeout to use, e.g. "1s" or "1000ms".
func (*SearchService) TimeoutInMillis ¶
func (s *SearchService) TimeoutInMillis(timeoutInMillis int) *SearchService
TimeoutInMillis sets the timeout in milliseconds.
func (*SearchService) Type ¶
func (s *SearchService) Type(typ ...string) *SearchService
Types adds search restrictions for a list of types.
func (*SearchService) Validate ¶
func (s *SearchService) Validate() error
Validate checks if the operation is valid.
func (*SearchService) Version ¶
func (s *SearchService) Version(version bool) *SearchService
Version indicates whether each search hit should be returned with a version associated to it.
type SearchSource ¶
type SearchSource struct {
// contains filtered or unexported fields
}
SearchSource enables users to build the search source. It resembles the SearchSourceBuilder in Elasticsearch.
func NewSearchSource ¶
func NewSearchSource() *SearchSource
NewSearchSource initializes a new SearchSource.
func (*SearchSource) Aggregation ¶
func (s *SearchSource) Aggregation(name string, aggregation Aggregation) *SearchSource
Aggregation adds an aggreation to perform as part of the search.
func (*SearchSource) ClearRescorers ¶
func (s *SearchSource) ClearRescorers() *SearchSource
ClearRescorers removes all rescorers from the search.
func (*SearchSource) DefaultRescoreWindowSize ¶
func (s *SearchSource) DefaultRescoreWindowSize(defaultRescoreWindowSize int) *SearchSource
DefaultRescoreWindowSize sets the rescore window size for rescores that don't specify their window.
func (*SearchSource) DocvalueField ¶
func (s *SearchSource) DocvalueField(fieldDataField string) *SearchSource
DocvalueField adds a single field to load from the field data cache and return as part of the search request.
func (*SearchSource) DocvalueFields ¶
func (s *SearchSource) DocvalueFields(docvalueFields ...string) *SearchSource
DocvalueFields adds one or more fields to load from the field data cache and return as part of the search request.
func (*SearchSource) Explain ¶
func (s *SearchSource) Explain(explain bool) *SearchSource
Explain indicates whether each search hit should be returned with an explanation of the hit (ranking).
func (*SearchSource) FetchSource ¶
func (s *SearchSource) FetchSource(fetchSource bool) *SearchSource
FetchSource indicates whether the response should contain the stored _source for every hit.
func (*SearchSource) FetchSourceContext ¶
func (s *SearchSource) FetchSourceContext(fetchSourceContext *FetchSourceContext) *SearchSource
FetchSourceContext indicates how the _source should be fetched.
func (*SearchSource) From ¶
func (s *SearchSource) From(from int) *SearchSource
From index to start the search from. Defaults to 0.
func (*SearchSource) GlobalSuggestText ¶
func (s *SearchSource) GlobalSuggestText(text string) *SearchSource
GlobalSuggestText defines the global text to use with all suggesters. This avoids repetition.
func (*SearchSource) Highlight ¶
func (s *SearchSource) Highlight(highlight *Highlight) *SearchSource
Highlight adds highlighting to the search.
func (*SearchSource) Highlighter ¶
func (s *SearchSource) Highlighter() *Highlight
Highlighter returns the highlighter.
func (*SearchSource) IndexBoost ¶
func (s *SearchSource) IndexBoost(index string, boost float64) *SearchSource
IndexBoost sets the boost that a specific index will receive when the query is executed against it.
func (*SearchSource) InnerHit ¶
func (s *SearchSource) InnerHit(name string, innerHit *InnerHit) *SearchSource
InnerHit adds an inner hit to return with the result.
func (*SearchSource) MinScore ¶
func (s *SearchSource) MinScore(minScore float64) *SearchSource
MinScore sets the minimum score below which docs will be filtered out.
func (*SearchSource) NoStoredFields ¶
func (s *SearchSource) NoStoredFields() *SearchSource
NoStoredFields indicates that no fields should be loaded, resulting in only id and type to be returned per field.
func (*SearchSource) PostFilter ¶
func (s *SearchSource) PostFilter(postFilter Query) *SearchSource
PostFilter will be executed after the query has been executed and only affects the search hits, not the aggregations. This filter is always executed as the last filtering mechanism.
func (*SearchSource) Profile ¶
func (s *SearchSource) Profile(profile bool) *SearchSource
Profile specifies that this search source should activate the Profile API for queries made on it.
func (*SearchSource) Query ¶
func (s *SearchSource) Query(query Query) *SearchSource
Query sets the query to use with this search source.
func (*SearchSource) Rescorer ¶
func (s *SearchSource) Rescorer(rescore *Rescore) *SearchSource
Rescorer adds a rescorer to the search.
func (*SearchSource) SearchAfter ¶
func (s *SearchSource) SearchAfter(sortValues ...interface{}) *SearchSource
SearchAfter allows a different form of pagination by using a live cursor, using the results of the previous page to help the retrieval of the next.
See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-search-after.html
func (*SearchSource) Size ¶
func (s *SearchSource) Size(size int) *SearchSource
Size is the number of search hits to return. Defaults to 10.
func (*SearchSource) Slice ¶
func (s *SearchSource) Slice(sliceQuery Query) *SearchSource
Slice allows partitioning the documents in multiple slices. It is e.g. used to slice a scroll operation, supported in Elasticsearch 5.0 or later. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-scroll.html#sliced-scroll for details.
func (*SearchSource) Sort ¶
func (s *SearchSource) Sort(field string, ascending bool) *SearchSource
Sort adds a sort order.
func (*SearchSource) SortBy ¶
func (s *SearchSource) SortBy(sorter ...Sorter) *SearchSource
SortBy adds a sort order.
func (*SearchSource) SortWithInfo ¶
func (s *SearchSource) SortWithInfo(info SortInfo) *SearchSource
SortWithInfo adds a sort order.
func (*SearchSource) Source ¶
func (s *SearchSource) Source() (interface{}, error)
Source returns the serializable JSON for the source builder.
func (*SearchSource) Stats ¶
func (s *SearchSource) Stats(statsGroup ...string) *SearchSource
Stats group this request will be aggregated under.
func (*SearchSource) StoredField ¶
func (s *SearchSource) StoredField(storedFieldName string) *SearchSource
StoredField adds a single field to load and return (note, must be stored) as part of the search request. If none are specified, the source of the document will be returned.
func (*SearchSource) StoredFields ¶
func (s *SearchSource) StoredFields(storedFieldNames ...string) *SearchSource
StoredFields sets the fields to load and return as part of the search request. If none are specified, the source of the document will be returned.
func (*SearchSource) TerminateAfter ¶
func (s *SearchSource) TerminateAfter(terminateAfter int) *SearchSource
TerminateAfter allows the request to stop after the given number of search hits are collected.
func (*SearchSource) Timeout ¶
func (s *SearchSource) Timeout(timeout string) *SearchSource
Timeout controls how long a search is allowed to take, e.g. "1s" or "500ms".
func (*SearchSource) TimeoutInMillis ¶
func (s *SearchSource) TimeoutInMillis(timeoutInMillis int) *SearchSource
TimeoutInMillis controls how many milliseconds a search is allowed to take before it is canceled.
func (*SearchSource) TrackScores ¶
func (s *SearchSource) TrackScores(trackScores bool) *SearchSource
TrackScores is applied when sorting and controls if scores will be tracked as well. Defaults to false.
func (*SearchSource) Version ¶
func (s *SearchSource) Version(version bool) *SearchSource
Version indicates whether each search hit should be returned with a version associated to it.
type SearchSuggest ¶
type SearchSuggest map[string][]SearchSuggestion
SearchSuggest is a map of suggestions. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-suggesters.html.
type SearchSuggestion ¶
type SearchSuggestion struct { Text string `json:"text"` Offset int `json:"offset"` Length int `json:"length"` Options []SearchSuggestionOption `json:"options"` }
SearchSuggestion is a single search suggestion. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-suggesters.html.
type SearchSuggestionOption ¶
type SearchSuggestionOption struct { Text string `json:"text"` Index string `json:"_index"` Type string `json:"_type"` Id string `json:"_id"` Score float64 `json:"_score"` Source *json.RawMessage `json:"_source"` }
SearchSuggestionOption is an option of a SearchSuggestion. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-suggesters.html.
type SimpleBackoff ¶
SimpleBackoff takes a list of fixed values for backoff intervals. Each call to Next returns the next value from that fixed list. After each value is returned, subsequent calls to Next will only return the last element. The values are optionally "jittered" (off by default).
func NewSimpleBackoff ¶
func NewSimpleBackoff(ticks ...int) *SimpleBackoff
NewSimpleBackoff creates a SimpleBackoff algorithm with the specified list of fixed intervals in milliseconds.
func (*SimpleBackoff) Jitter ¶
func (b *SimpleBackoff) Jitter(flag bool) *SimpleBackoff
Jitter enables or disables jittering values.
type SnifferCallback ¶
type SnifferCallback func(*NodesInfoNode) bool
SnifferCallback defines the protocol for sniffing decisions.
type SortByDoc ¶
type SortByDoc struct {
Sorter
}
SortByDoc sorts by the "_doc" field, as described in https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-scroll.html.
Example:
ss := elastic.NewSearchSource() ss = ss.SortBy(elastic.SortByDoc{})
type SortInfo ¶
type SortInfo struct { Sorter Field string Ascending bool Missing interface{} IgnoreUnmapped *bool SortMode string NestedFilter Query NestedPath string }
SortInfo contains information about sorting a field.
type Sorter ¶
type Sorter interface {
Source() (interface{}, error)
}
Sorter is an interface for sorting strategies, e.g. ScoreSort or FieldSort. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-sort.html.
type StopBackoff ¶
type StopBackoff struct{}
StopBackoff is a fixed backoff policy that always returns false for Next(), meaning that the operation should never be retried.
type StopRetrier ¶
type StopRetrier struct { }
StopRetrier is an implementation that does no retries.
func NewStopRetrier ¶
func NewStopRetrier() *StopRetrier
NewStopRetrier returns a retrier that does no retries.
type TermQuery ¶
type TermQuery struct {
// contains filtered or unexported fields
}
TermQuery finds documents that contain the exact term specified in the inverted index.
For details, see https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-term-query.html
func NewTermQuery ¶
NewTermQuery creates and initializes a new TermQuery.
type UpdateResponse ¶
type UpdateResponse struct { Index string `json:"_index"` Type string `json:"_type"` Id string `json:"_id"` Version int `json:"_version"` Created bool `json:"created"` GetResult *GetResult `json:"get"` }
UpdateResponse is the result of updating a document in Elasticsearch.
type UpdateService ¶
type UpdateService struct {
// contains filtered or unexported fields
}
UpdateService updates a document in Elasticsearch. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-update.html for details.
func NewUpdateService ¶
func NewUpdateService(client *Client) *UpdateService
NewUpdateService creates the service to update documents in Elasticsearch.
func (*UpdateService) DetectNoop ¶
func (b *UpdateService) DetectNoop(detectNoop bool) *UpdateService
DetectNoop will instruct Elasticsearch to check if changes will occur when updating via Doc. It there aren't any changes, the request will turn into a no-op.
func (*UpdateService) Do ¶
func (b *UpdateService) Do(ctx context.Context) (*UpdateResponse, error)
Do executes the update operation.
func (*UpdateService) Doc ¶
func (b *UpdateService) Doc(doc interface{}) *UpdateService
Doc allows for updating a partial document.
func (*UpdateService) DocAsUpsert ¶
func (b *UpdateService) DocAsUpsert(docAsUpsert bool) *UpdateService
DocAsUpsert can be used to insert the document if it doesn't already exist.
func (*UpdateService) Fields ¶
func (b *UpdateService) Fields(fields ...string) *UpdateService
Fields is a list of fields to return in the response.
func (*UpdateService) Id ¶
func (b *UpdateService) Id(id string) *UpdateService
Id is the identifier of the document to update (required).
func (*UpdateService) Index ¶
func (b *UpdateService) Index(name string) *UpdateService
Index is the name of the Elasticsearch index (required).
func (*UpdateService) Parent ¶
func (b *UpdateService) Parent(parent string) *UpdateService
Parent sets the id of the parent document.
func (*UpdateService) Pretty ¶
func (b *UpdateService) Pretty(pretty bool) *UpdateService
Pretty instructs to return human readable, prettified JSON.
func (*UpdateService) Refresh ¶
func (b *UpdateService) Refresh(refresh string) *UpdateService
Refresh the index after performing the update.
func (*UpdateService) RetryOnConflict ¶
func (b *UpdateService) RetryOnConflict(retryOnConflict int) *UpdateService
RetryOnConflict specifies how many times the operation should be retried when a conflict occurs (default: 0).
func (*UpdateService) Routing ¶
func (b *UpdateService) Routing(routing string) *UpdateService
Routing specifies a specific routing value.
func (*UpdateService) ScriptedUpsert ¶
func (b *UpdateService) ScriptedUpsert(scriptedUpsert bool) *UpdateService
ScriptedUpsert should be set to true if the referenced script (defined in Script or ScriptId) should be called to perform an insert. The default is false.
func (*UpdateService) Timeout ¶
func (b *UpdateService) Timeout(timeout string) *UpdateService
Timeout is an explicit timeout for the operation, e.g. "1000", "1s" or "500ms".
func (*UpdateService) Type ¶
func (b *UpdateService) Type(typ string) *UpdateService
Type is the type of the document (required).
func (*UpdateService) Upsert ¶
func (b *UpdateService) Upsert(doc interface{}) *UpdateService
Upsert can be used to index the document when it doesn't exist yet. Use this e.g. to initialize a document with a default value.
func (*UpdateService) Version ¶
func (b *UpdateService) Version(version int64) *UpdateService
Version defines the explicit version number for concurrency control.
func (*UpdateService) VersionType ¶
func (b *UpdateService) VersionType(versionType string) *UpdateService
VersionType is one of "internal" or "force".
func (*UpdateService) WaitForActiveShards ¶
func (b *UpdateService) WaitForActiveShards(waitForActiveShards string) *UpdateService
WaitForActiveShards sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1).
type ZeroBackoff ¶
type ZeroBackoff struct{}
ZeroBackoff is a fixed backoff policy whose backoff time is always zero, meaning that the operation is retried immediately without waiting, indefinitely.
Source Files ¶
- acknowledged_response.go
- backoff.go
- canonicalize.go
- client.go
- cluster_health.go
- connection.go
- count.go
- decoder.go
- delete.go
- errors.go
- exists.go
- fetch_source_context.go
- get.go
- highlight.go
- index.go
- indices_close.go
- indices_create.go
- indices_delete.go
- indices_exists.go
- indices_exists_type.go
- indices_flush.go
- indices_get.go
- indices_get_field_mapping.go
- indices_get_mapping.go
- indices_get_settings.go
- indices_open.go
- indices_put_alias.go
- indices_put_mapping.go
- indices_refresh.go
- inner_hit.go
- logger.go
- nodes_info.go
- ping.go
- query.go
- request.go
- rescore.go
- rescorer.go
- response.go
- retrier.go
- retry.go
- search.go
- search_aggs.go
- search_queries_match.go
- search_queries_match_all.go
- search_queries_term.go
- search_request.go
- search_source.go
- sort.go
- update.go
Directories ¶
Path | Synopsis |
---|---|
Package uritemplates is a level 4 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570).
|
Package uritemplates is a level 4 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570). |