Categorygithub.com/xitonix/elastic
modulepackage
2.0.61+incompatible
Repository: https://github.com/xitonix/elastic.git
Documentation: pkg.go.dev

# README

Elastic

Elastic is an Elasticsearch client for the Go programming language.

Build Status Godoc license

See the wiki for additional information about Elastic.

Releases

The release branches (e.g. release-branch.v2) are actively being worked on and can break at any time. If you want to use stable versions of Elastic, please use the packages released via gopkg.in.

Here's the version matrix:

Elasticsearch versionElastic version -Package URL
2.x3.0gopkg.in/olivere/elastic.v3 (source doc)
1.x2.0gopkg.in/olivere/elastic.v2 (source doc)
0.9-1.31.0gopkg.in/olivere/elastic.v1 (source doc)

Example:

You have installed Elasticsearch 1.7.4 and want to use Elastic. As listed above, you should use Elastic 2.0. So you first install the stable release of Elastic 2.0 from gopkg.in.

$ go get gopkg.in/olivere/elastic.v2

You then import it with this import path:

import "gopkg.in/olivere/elastic.v2"

Elastic 3.0

Elastic 3.0 targets Elasticsearch 2.0 and later. Elasticsearch 2.0.0 was released on 28th October 2015.

Notice that there are a lot of breaking changes in Elasticsearch 2.0 and we used this as an opportunity to clean up and refactor Elastic as well.

Elastic 2.0

Elastic 2.0 targets Elasticsearch 1.x and published via gopkg.in/olivere/elastic.v2.

Elastic 1.0

Elastic 1.0 is deprecated. You should really update Elasticsearch and Elastic to a recent version.

However, if you cannot update for some reason, don't worry. Version 1.0 is still available. All you need to do is go-get it and change your import path as described above.

Status

We use Elastic in production since 2012. Although Elastic is quite stable from our experience, we don't have a stable API yet. The reason for this is that Elasticsearch changes quite often and at a fast pace. At this moment we focus on features, not on a stable API.

Having said that, there have been no big API changes that required you to rewrite your application big time. More often than not it's renaming APIs and adding/removing features so that we are in sync with the Elasticsearch API.

Elastic has been used in production with the following Elasticsearch versions: 0.90, 1.0-1.7. Furthermore, we use Travis CI to test Elastic with the most recent versions of Elasticsearch and Go. See the .travis.yml file for the exact matrix and Travis for the results.

Elasticsearch has quite a few features. A lot of them are not yet implemented in Elastic (see below for details). I add features and APIs as required. It's straightforward to implement missing pieces. I'm accepting pull requests :-)

Having said that, I hope you find the project useful.

Usage

The first thing you do is to create a Client. The client connects to Elasticsearch on http://127.0.0.1:9200 by default.

You typically create one client for your app. Here's a complete example.

// Create a client
client, err := elastic.NewClient()
if err != nil {
    // Handle error
}

// Create an index
_, err = client.CreateIndex("twitter").Do()
if err != nil {
    // Handle error
    panic(err)
}

// Add a document to the index
tweet := Tweet{User: "olivere", Message: "Take Five"}
_, err = client.Index().
    Index("twitter").
    Type("tweet").
    Id("1").
    BodyJson(tweet).
    Do()
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()                // 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)) {
    if t, ok := item.(Tweet); ok {
        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 the index again
_, err = client.DeleteIndex("twitter").Do()
if err != nil {
    // Handle error
    panic(err)
}

See the wiki for more details.

API Status

Here's the current API status.

APIs

  • Search (most queries, filters, facets, aggregations etc. are implemented: see below)
  • Index
  • Get
  • Delete
  • Delete By Query
  • Update
  • Multi Get
  • Bulk
  • Bulk UDP
  • Term vectors
  • Multi term vectors
  • Count
  • Validate
  • Explain
  • Search
  • Search shards
  • Search template
  • Facets (most are implemented, see below)
  • Aggregates (most are implemented, see below)
  • Multi Search
  • Percolate
  • More like this
  • Benchmark

Indices

  • Create index
  • Delete index
  • Get index
  • Indices exists
  • Open/close index
  • Put mapping
  • Get mapping
  • Get field mapping
  • Types exist
  • Delete mapping
  • Index aliases
  • Update indices settings
  • Get settings
  • Analyze
  • Index templates
  • Warmers
  • Status
  • Indices stats
  • Indices segments
  • Indices recovery
  • Clear cache
  • Flush
  • Refresh
  • Optimize
  • Upgrade

Snapshot and Restore

  • Snapshot
  • Restore
  • Snapshot status
  • Monitoring snapshot/restore progress
  • Partial restore

Cat APIs

Not implemented. Those are better suited for operating with Elasticsearch on the command line.

Cluster

  • Health
  • State
  • Stats
  • Pending cluster tasks
  • Cluster reroute
  • Cluster update settings
  • Nodes stats
  • Nodes info
  • Nodes hot_threads
  • Nodes shutdown

Search

  • Inner hits (for ES >= 1.5.0; see docs)

Query DSL

Queries

  • match
  • multi_match
  • bool
  • boosting
  • common_terms
  • constant_score
  • dis_max
  • filtered
  • fuzzy_like_this_query (flt)
  • fuzzy_like_this_field_query (flt_field)
  • function_score
  • fuzzy
  • geo_shape
  • has_child
  • has_parent
  • ids
  • indices
  • match_all
  • mlt
  • mlt_field
  • nested
  • prefix
  • query_string
  • simple_query_string
  • range
  • regexp
  • span_first
  • span_multi_term
  • span_near
  • span_not
  • span_or
  • span_term
  • term
  • terms
  • top_children
  • wildcard
  • minimum_should_match
  • multi_term_query_rewrite
  • template_query

Filters

  • and
  • bool
  • exists
  • geo_bounding_box
  • geo_distance
  • geo_distance_range
  • geo_polygon
  • geoshape
  • geohash
  • has_child
  • has_parent
  • ids
  • indices
  • limit
  • match_all
  • missing
  • nested
  • not
  • or
  • prefix
  • query
  • range
  • regexp
  • script
  • term
  • terms
  • type

Facets

  • Terms
  • Range
  • Histogram
  • Date Histogram
  • Filter
  • Query
  • Statistical
  • Terms Stats
  • Geo Distance

Aggregations

  • min
  • max
  • sum
  • avg
  • stats
  • extended stats
  • value count
  • percentiles
  • percentile ranks
  • cardinality
  • geo bounds
  • top hits
  • scripted metric
  • global
  • filter
  • filters
  • missing
  • nested
  • reverse nested
  • children
  • terms
  • significant terms
  • range
  • date range
  • ipv4 range
  • histogram
  • date histogram
  • geo distance
  • geohash grid

Sorting

  • Sort by score
  • Sort by field
  • Sort by geo distance
  • Sort by script

Scan

Scrolling through documents (e.g. search_type=scan) are implemented via the Scroll and Scan services. The ClearScroll API is implemented as well.

How to contribute

Read the contribution guidelines.

Credits

Thanks a lot for the great folks working hard on Elasticsearch and Go.

Elastic uses portions of the uritemplates library by Joshua Tacoma and backoff by Cenk Altı.

LICENSE

MIT-LICENSE. See LICENSE or the LICENSE file provided in the repository for details.

# Packages

No description provided by the author
No description provided by the author
Package uritemplates is a level 4 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570).

# Functions

CopyToTargetIndex returns a ReindexerFunc that copies the SearchHit's _source, _parent, and _routing attributes into the targetIndex.
GeoPointFromLatLon initializes a new GeoPoint by latitude and longitude.
GeoPointFromString initializes a new GeoPoint by a string that is formatted as "{latitude},{longitude}", e.g.
NewAliasAddAction returns an action to add an alias.
No description provided by the author
NewAliasRemoveAction returns an action to remove an alias.
NewAliasService implements a service to manage aliases.
No description provided by the author
No description provided by the author
NewBackoffRetrier returns a retrier that uses the given backoff strategy.
NewBoolFilter creates a new bool filter.
Creates a new bool query.
Creates a new boosting query.
NewBulkDeleteRequest returns a new BulkDeleteRequest.
NewBulkIndexRequest returns a new BulkIndexRequest.
NewBulkProcessorService creates a new BulkProcessorService.
NewBulkService initializes a new BulkService.
NewBulkUpdateRequest returns a new BulkUpdateRequest.
No description provided by the author
No description provided by the author
NewClearScrollService creates a new ClearScrollService.
NewClient creates a new client to work with Elasticsearch.
NewCloseIndexService creates a new CloseIndexService.
NewClusterHealthService creates a new ClusterHealthService.
NewClusterStateService creates a new ClusterStateService.
NewClusterStatsService creates a new ClusterStatsService.
Creates a new common query.
Creates a new completion suggester.
NewConstantBackoff returns a new ConstantBackoff.
NewConstantScoreQuery creates a new constant score query.
NewCountService creates a new CountService.
NewCreateIndexService returns a new CreateIndexService.
Creates a new custom_filters_score query.
Creates a new custom_score query.
No description provided by the author
No description provided by the author
No description provided by the author
NewDeleteByQueryService creates a new DeleteByQueryService.
No description provided by the author
NewDeleteMappingService creates a new DeleteMappingService.
No description provided by the author
NewDeleteTemplateService creates a new DeleteTemplateService.
No description provided by the author
Creates a new dis_max query.
No description provided by the author
NewExistsService creates a new ExistsService.
NewExplainService creates a new ExplainService.
NewExponentialBackoff returns a ExponentialBackoff backoff policy.
NewExponentialDecayFunction creates a new ExponentialDecayFunction.
No description provided by the author
NewFactorFunction initializes and returns a new FactorFunction.
No description provided by the author
NewFieldSort creates a new FieldSort.
NewFieldStatsService creates a new FieldStatsService.
NewFieldValueFactorFunction initializes and returns a new FieldValueFactorFunction.
No description provided by the author
NewFilteredQuery creates a new filtered query.
No description provided by the author
NewFiltersAggregation initializes a new FiltersAggregation.
No description provided by the author
NewFunctionScoreQuery creates a new function score query.
Creates a new completion suggester.
NewFuzzyLikeThisFieldQuery creates a new fuzzy like this field query.
NewFuzzyLikeThisQuery creates a new fuzzy query.
NewFuzzyQuery creates a new fuzzy query.
NewGaussDecayFunction returns a new GaussDecayFunction.
No description provided by the author
No description provided by the author
No description provided by the author
NewGeoDistanceFilter creates a new GeoDistanceFilter.
NewGeoDistanceSort creates a new sorter for geo distances.
No description provided by the author
No description provided by the author
NewGetMappingService creates a new GetMappingService.
No description provided by the author
NewGetTemplateService creates a new GetTemplateService.
No description provided by the author
NewHasChildFilter creates a new has_child query.
NewHasChildQuery creates a new has_child query.
NewHasParentFilter creates a new has_parent filter.
NewHasParentQuery creates a new has_parent query.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewIdsQuery creates a new ids query.
No description provided by the author
No description provided by the author
NewIndicesDeleteTemplateService creates a new IndicesDeleteTemplateService.
NewIndicesDeleteWarmerService creates a new IndicesDeleteWarmerService.
NewIndicesExistsTemplateService creates a new IndicesExistsTemplateService.
NewIndicesExistsTypeService creates a new IndicesExistsTypeService.
NewIndicesGetService creates a new IndicesGetService.
NewIndicesGetSettingsService creates a new IndicesGetSettingsService.
NewIndicesGetTemplateService creates a new IndicesGetTemplateService.
NewIndicesGetWarmerService creates a new IndicesGetWarmerService.
NewIndicesPutSettingsService creates a new IndicesPutSettingsService.
NewIndicesPutTemplateService creates a new IndicesPutTemplateService.
NewIndicesPutWarmerService creates a new IndicesPutWarmerService.
NewIndicesStatsService creates a new IndicesStatsService.
NewInnerHit creates a new InnerHit.
No description provided by the author
No description provided by the author
NewLinearDecayFunction initializes and returns a new LinearDecayFunction.
No description provided by the author
No description provided by the author
NewMatchAllQuery creates a new match all query.
NewMatchPhrasePrefixQuery creates a new MatchQuery with type phrase_prefix.
NewMatchPhraseQuery creates a new MatchQuery with type phrase.
NewMatchQuery creates a new MatchQuery.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Creates a new mlt_field query.
NewMoreLikeThisQuery creates a new more-like-this query.
NewMoreLikeThisQueryItem creates and initializes a MoreLikeThisQueryItem.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewMultiTermvectorService creates a new MultiTermvectorService.
No description provided by the author
No description provided by the author
Creates a new nested_query query.
NewNodesInfoService creates a new NodesInfoService.
NewNodesStatsService creates a new NodesStatsService.
No description provided by the author
NewOpenIndexService creates a new OpenIndexService.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewPercolateService creates a new PercolateService.
Creates a new phrase suggester.
No description provided by the author
No description provided by the author
Creates a new prefix query.
NewPutMappingService creates a new PutMappingService.
NewPutTemplateService creates a new PutTemplateService.
No description provided by the author
No description provided by the author
No description provided by the author
Creates a new query string query.
NewRandomFunction initializes and returns a new RandomFunction.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewRawStringQuery ininitializes a new RawStringQuery.
No description provided by the author
NewRegexpFilter sets up a new RegexpFilter.
NewRegexpQuery creates a new regexp query.
NewReindexer returns a new Reindexer.
NewRequest is a http.Request and adds features such as encoding the body.
No description provided by the author
NewReverseNestedAggregation initializes a new ReverseNestedAggregation bucket aggregation.
NewScanCursor returns new scanCursor without context.
NewScanCursorC returns a new initialized instance of scanCursor.
NewScanService creates a new service to iterate through the results of a query.
NewScoreSort creates a new ScoreSort.
No description provided by the author
NewScriptFunction initializes and returns a new ScriptFunction.
NewScriptSort creates a new ScriptSort.
No description provided by the author
NewSearchRequest creates a new search request.
NewSearchService creates a new service for searching in Elasticsearch.
NewSearchSource initializes a new SearchSource.
No description provided by the author
NewSimpleBackoff creates a SimpleBackoff algorithm with the specified list of fixed intervals in milliseconds.
NewSimpleClient creates a new short-lived Client that can be used in use cases where you need e.g.
Creates a new simple query string query.
No description provided by the author
No description provided by the author
No description provided by the author
NewStopRetrier returns a retrier that does no retries.
No description provided by the author
NewSuggesterCategoryMapping creates a new SuggesterCategoryMapping.
NewSuggesterCategoryQuery creates a new SuggesterCategoryQuery.
NewSuggesterGeoMapping creates a new SuggesterGeoMapping.
NewSuggesterGeoQuery creates a new SuggesterGeoQuery.
No description provided by the author
No description provided by the author
No description provided by the author
NewTemplateQuery creates a new TemplateQuery.
No description provided by the author
Creates a new term query.
No description provided by the author
No description provided by the author
No description provided by the author
NewTermsQuery creates a new terms query.
No description provided by the author
Creates a new term suggester.
NewTermvectorService creates a new TermvectorService.
No description provided by the author
No description provided by the author
NewUpdateService creates the service to update documents in Elasticsearch.
No description provided by the author
NewWeightFactorFunction initializes and returns a new WeightFactorFunction.
NewWildcardQuery creates a new wildcard query.
SetBasicAuth can be used to specify the HTTP Basic Auth credentials to use when making HTTP requests to Elasticsearch.
SetDecoder sets the Decoder to use when decoding data from Elasticsearch.
SetErrorLog sets the logger for critical messages like nodes joining or leaving the cluster or failing requests.
SetGzip enables or disables gzip compression (disabled by default).
SetHealthcheck enables or disables healthchecks (enabled by default).
SetHealthcheckInterval sets the interval between two health checks.
SetHealthcheckTimeout sets the timeout for periodic health checks.
SetHealthcheckTimeoutStartup sets the timeout for the initial health check.
SetHttpClient can be used to specify the http.Client to use when making HTTP requests to Elasticsearch.
SetInfoLog sets the logger for informational messages, e.g.
SetMaxRetries sets the maximum number of retries before giving up when performing a HTTP request to Elasticsearch.
SetRetrier specifies the retry strategy that handles errors during HTTP request/response with Elasticsearch.
SetScheme sets the HTTP scheme to look for when sniffing (http or https).
SendGetBodyAs specifies the HTTP method to use when sending a GET request with a body.
SetSniff enables or disables the sniffer (enabled by default).
SetSnifferInterval sets the interval between two sniffing processes.
SetSnifferTimeout sets the timeout for the sniffer that finds the nodes in a cluster.
SetSnifferTimeoutStartup sets the timeout for the sniffer that is used when creating a new client.
SetTraceLog specifies the log.Logger to use for output of HTTP requests and responses which is helpful during debugging.
SetURL defines the URL endpoints of the Elasticsearch nodes.

# Constants

DefaultGzipEnabled specifies if gzip compression is enabled by default.
DefaultHealthcheckEnabled specifies if healthchecks are enabled by default.
DefaultHealthcheckInterval is the default interval between two health checks of the nodes in the cluster.
DefaultHealthcheckTimeout specifies the time a running client waits for a response from Elasticsearch.
DefaultHealthcheckTimeoutStartup is the time the healthcheck waits for a response from Elasticsearch on startup, i.e.
DefaultScheme is the default protocol scheme to use when sniffing the Elasticsearch cluster.
DefaultSendGetBodyAs is the HTTP method to use when elastic is sending a GET request with a body.
DefaultSnifferEnabled specifies if the sniffer is enabled by default.
DefaultSnifferInterval is the interval between two sniffing procedures, i.e.
DefaultSnifferTimeout is the default timeout after which the sniffing process times out.
DefaultSnifferTimeoutStartup is the default timeout for the sniffing process that is initiated while creating a new client.
DefaultURL is the default endpoint of Elasticsearch on the local machine.
No description provided by the author
No description provided by the author
Version is the current version of Elastic.

# Variables

End of stream (or scan).
ErrMissingId is returned e.g.
ErrMissingIndex is returned e.g.
ErrMissingType is returned e.g.
ErrNoClient is raised when no Elasticsearch node is available.
No ScrollId.
ErrRetry is raised when a request cannot be executed after the configured number of retries.
ErrTimeout is raised when a request timed out, e.g.

# Structs

AggregationBucketFilters is a multi-bucket aggregation that is returned with a filters aggregation.
AggregationBucketHistogramItem is a single bucket of an AggregationBucketHistogramItems structure.
AggregationBucketHistogramItems is a bucket aggregation that is returned with a date histogram aggregation.
AggregationBucketKeyedRangeItems is a bucket aggregation that is e.g.
AggregationBucketKeyItem is a single bucket of an AggregationBucketKeyItems structure.
AggregationBucketKeyItems is a bucket aggregation that is e.g.
AggregationBucketRangeItem is a single bucket of an AggregationBucketRangeItems structure.
AggregationBucketRangeItems is a bucket aggregation that is e.g.
AggregationBucketSignificantTerm is a single bucket of an AggregationBucketSignificantTerms structure.
AggregationBucketSignificantTerms is a bucket aggregation returned with a significant terms aggregation.
AggregationExtendedStatsMetric is a multi-value metric, returned by an ExtendedStats aggregation.
AggregationGeoBoundsMetric is a metric as returned by a GeoBounds aggregation.
AggregationPercentilesMetric is a multi-value metric, returned by a Percentiles aggregation.
AggregationSingleBucket is a single bucket, returned e.g.
AggregationStatsMetric is a multi-value metric, returned by a Stats aggregation.
AggregationTopHitsMetric is a metric returned by a TopHits aggregation.
AggregationValueMetric is a single-value metric, returned e.g.
AliasAddAction is an action to add to an alias.
No description provided by the author
No description provided by the author
AliasRemoveAction is an action to remove an alias.
AliasResult is the outcome of calling Do on AliasService.
AliasService enables users to add or remove an alias.
A filter that matches documents using AND boolean operator on other filters.
AvgAggregation is a single-value metrics aggregation that computes the average of numeric values that are extracted from the aggregated documents.
BackoffRetrier is an implementation that does nothing but return nil on Retry.
A filter that matches documents matching boolean combinations of other queries.
A bool query matches documents matching boolean combinations of other queries.
A boosting query can be used to effectively demote results that match a given query.
BulkDeleteRequest is a bulk request to remove a document from Elasticsearch.
BulkIndexRequest is a bulk request to add a document to Elasticsearch.
BulkProcessor encapsulates a task that accepts bulk requests and orchestrates committing them to Elasticsearch via one or more workers.
BulkProcessorService allows to easily process bulk requests.
BulkProcessorStats contains various statistics of a bulk processor while it is running.
BulkProcessorWorkerStats represents per-worker statistics.
BulkResponse is a response to a bulk execution.
BulkResponseItem is the result of a single bulk request.
BulkService allows for batching bulk requests and sending them to Elasticsearch in one roundtrip.
Bulk request to update a document in Elasticsearch.
CardinalityAggregation is a single-value metrics aggregation that calculates an approximate count of distinct values.
ChildrenAggregation is a special single bucket aggregation that enables aggregating from buckets on parent document types to buckets on child documents.
ClearScrollResponse is the response of ClearScrollService.Do.
ClearScrollService is documented at http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.4/search-request-scroll.html.
Client is an Elasticsearch client.
CloseIndexResponse is the response of CloseIndexService.Do.
CloseIndexService closes an index.
ClusterHealthResponse is the response of ClusterHealthService.Do.
ClusterHealthService allows to get the status of the cluster.
No description provided by the author
No description provided by the author
ClusterStateResponse is the response of ClusterStateService.Do.
No description provided by the author
No description provided by the author
ClusterStateService returns the state of the cluster.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ClusterStatsResponse is the response of ClusterStatsService.Do.
ClusterStatsService is documented at http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.4/cluster-stats.html.
The common terms query is a modern alternative to stopwords which improves the precision and recall of search results (by taking stopwords into account), without sacrificing performance.
CompletionSuggester is a fast suggester for e.g.
ConstantBackoff is a backoff policy that always returns the same delay.
ConstantScoreQuery wraps a filter or another query and simply returns a constant score equal to the query boost for every document in the filter.
CountResponse is the response of using the Count API.
CountService is a convenient service for determining the number of documents in an index.
CreateIndexResult is the outcome of creating a new index.
CreateIndexService creates a new index.
A custom_filters_score query allows to execute a query, and if the hit matches a provided filter (ordered), use either a boost or a script associated with it to compute the score.
custom_score query allows to wrap another query and customize the scoring of it optionally with a computation derived from other field values in the doc (numeric ones) using script expression.
DateHistogramAggregation is a multi-bucket aggregation similar to the histogram except it can only be applied on date values.
A specific histogram facet that can work with date field types enhancing it over the regular histogram facet.
DateRangeAggregation is a range aggregation that is dedicated for date values.
No description provided by the author
DefaultDecoder uses json.Unmarshal from the Go standard library to decode JSON data.
DeleteByQueryResult is the outcome of executing Do with DeleteByQueryService.
DeleteByQueryService deletes documents that match a query.
No description provided by the author
No description provided by the author
DeleteMappingResponse is the response of DeleteMappingService.Do.
DeleteMappingService allows to delete a mapping along with its data.
No description provided by the author
No description provided by the author
DeleteTemplateResponse is the response of DeleteTemplateService.Do.
DeleteTemplateService deletes a search template.
DeleteWarmerResponse is the response of IndicesDeleteWarmerService.Do.
DirectCandidateGenerator implements a direct candidate generator.
A query that generates the union of documents produced by its subqueries, and that scores each document with the maximum score for that document as produced by any subquery, plus a tie breaking increment for any additional matching subqueries.
Error encapsulates error details as returned from Elasticsearch.
Filters documents where a specific field has a value in them.
ExistsService checks if a document exists.
ExplainResponse is the response of ExplainService.Do.
ExplainService computes a score explanation for a query and a specific document.
ExponentialBackoff implements the simple exponential backoff described by Douglas Thain at http://dthain.blogspot.de/2009/02/exponential-backoff-in-distributed.html.
ExponentialDecayFunction builds an exponential decay score function.
ExtendedExtendedStatsAggregation is a multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents.
FactorFunction is deprecated.
No description provided by the author
FieldSort sorts by a given field.
No description provided by the author
FieldStats contains stats of an individual field.
FieldStatsComparison contain all comparison operations that can be used in FieldStatsConstraints.
FieldStatsConstraints is a constraint on a field.
FieldStatsRequest can be used to set up the body to be used in the Field Stats API.
FieldStatsResponse is the response body content.
FieldStatsService allows finding statistical properties of a field without executing a search, but looking up measurements that are natively available in the Lucene index.
FieldValueFactorFunction is a function score function that allows you to use a field from a document to influence the score.
FilterAggregation defines a single bucket of all the documents in the current document set context that match a specified filter.
FilteredQuery is a query that applies a filter to the results of another query.
A filter facet (not to be confused with a facet filter) allows you to return a count of the hits matching the filter.
FiltersAggregation defines a multi bucket aggregations where each bucket is associated with a filter.
No description provided by the author
Flush allows to flush one or more indices.
The function_score allows you to modify the score of documents that are retrieved by a query.
Fuzziness defines the fuzziness which is used in FuzzyCompletionSuggester.
FuzzyFuzzyCompletionSuggester is a FuzzyCompletionSuggester that allows fuzzy completion.
FuzzyLikeThisFieldQuery is the same as the fuzzy_like_this query, except that it runs against a single field.
FuzzyLikeThisQuery finds documents that are "like" provided text by running it against one or more fields.
FuzzyQuery uses similarity based on Levenshtein edit distance for string fields, and a +/- margin on numeric and date fields.
GaussDecayFunction builds a gauss decay score function.
GeoBoundsAggregation is a metric aggregation that computes the bounding box containing all geo_point values for a field.
GeoDistanceAggregation is a multi-bucket aggregation that works on geo_point fields and conceptually works very similar to the range aggregation.
The geo_distance facet is a facet providing information for ranges of distances from a provided geo_point including count of the number of hits that fall within each range, and aggregation information (like total).
GeoDistanceFilter filters documents that include only hits that exists within a specific distance from a geo point.
GeoDistanceSort allows for sorting by geographic distance.
No description provided by the author
GeoPoint is a geographic position described via latitude and longitude.
A filter allowing to include hits that only fall within a polygon of points.
GetMappingService retrieves the mapping definitions for an index or index/type.
No description provided by the author
No description provided by the author
No description provided by the author
GetTemplateService reads a search template.
GlobalAggregation defines a single bucket of all the documents within the search execution context.
The has_child query works the same as the has_child filter, by automatically wrapping the filter with a constant_score (when using the default score type).
The has_child query works the same as the has_child filter, by automatically wrapping the filter with a constant_score (when using the default score type).
The has_parent filter accepts a query and a parent type.
The has_parent query works the same as the has_parent filter, by automatically wrapping the filter with a constant_score (when using the default score type).
Highlight allows highlighting search results on one or more fields.
HighlighterField specifies a highlighted field.
HistogramAggregation is a multi-bucket values source based aggregation that can be applied on numeric values extracted from the documents.
Histogram Facet See: http://www.elasticsearch.org/guide/reference/api/search/facets/histogram-facet.html.
Histogram Facet See: http://www.elasticsearch.org/guide/reference/api/search/facets/histogram-facet.html.
Filters documents that only have the provided ids.
Filters documents that only have the provided ids.
IndexDeleteByQueryResult is the result of a delete-by-query for a specific index.
No description provided by the author
IndexFieldStats contains field stats for an index.
IndexResult is the result of indexing a document in Elasticsearch.
IndexService adds documents to Elasticsearch.
IndexStats is index stats for a specific index.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
IndicesDeleteTemplateResponse is the response of IndicesDeleteTemplateService.Do.
IndicesDeleteTemplateService deletes index templates.
IndicesDeleteWarmerService allows to delete a warmer.
IndicesExistsTemplateService checks if a given template exists.
IndicesExistsTypeService checks if one or more types exist in one or more indices.
IndicesGetResponse is part of the response of IndicesGetService.Do.
IndicesGetService retrieves information about one or more indices.
IndicesGetSettingsResponse is the response of IndicesGetSettingsService.Do.
IndicesGetSettingsService allows to retrieve settings of one or more indices.
IndicesGetTemplateResponse is the response of IndicesGetTemplateService.Do.
IndicesGetTemplateService returns an index template.
IndicesGetWarmerService allows to get the definition of a warmer for a specific index (or alias, or several indices) based on its name.
IndicesPutSettingsResponse is the response of IndicesPutSettingsService.Do.
IndicesPutSettingsService changes specific index level settings in real time.
IndicesPutTemplateResponse is the response of IndicesPutTemplateService.Do.
IndicesPutTemplateService creates or updates index mappings.
IndicesPutWarmerService allows to register a warmer.
IndicesStatsResponse is the response of IndicesStatsService.Do.
IndicesStatsService provides stats on various metrics of one or more indices.
InnerHit implements a simple join for parent/child, nested, and even top-level documents in Elasticsearch.
LaplaceSmoothingModel implements a laplace smoothing model.
A limit filter limits the number of documents (per shard) to execute on.
LinearDecayFunction builds a linear decay score function.
LinearInterpolationSmoothingModel implements a linear interpolation smoothing model.
A filter that matches on all documents.
A query that matches all documents.
MatchQuery is a family of queries that accept text/numerics/dates, analyzes it, and constructs a query out of it.
MaxAggregation is a single-value metrics aggregation that keeps track and returns the maximum value among the numeric values extracted from the aggregated documents.
MinAggregation is a single-value metrics aggregation that keeps track and returns the minimum value among numeric values extracted from the aggregated documents.
MissingAggregation is a field data based single bucket aggregation, that creates a bucket of all documents in the current document set context that are missing a field value (effectively, missing a field or having the configured NULL value set).
Filters documents where a specific field has no value in them.
The more_like_this_field query is the same as the more_like_this query, except it runs against a single field.
More like this query find documents that are “like” provided text by running it against one or more fields.
MoreLikeThisQueryItem represents a single item of a MoreLikeThisQuery to be "liked" or "unliked".
MultiGetItem is a single document to retrieve via the MultiGetService.
No description provided by the author
No description provided by the author
The multi_match query builds further on top of the match query by allowing multiple fields to be specified.
No description provided by the author
MultiSearch executes one or more searches in one roundtrip.
MultiTermvectorItem is a single document to retrieve via MultiTermvectorService.
MultiTermvectorResponse is the response of MultiTermvectorService.Do.
MultiTermvectorService returns information and statistics on terms in the fields of a particular document.
NestedAggregation is a special single bucket aggregation that enables aggregating nested documents.
A nested filter, works in a similar fashion to the nested query, except used as a filter.
Nested query allows to query nested objects / docs (see nested mapping).
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NodesInfoResponse is the response of NodesInfoService.Do.
NodesInfoService allows to retrieve one or more or all of the cluster nodes information.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NodesStatsResponse is the response of NodesStatsService.Do.
No description provided by the author
No description provided by the author
No description provided by the author
NodesStatsService returns node statistics.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
A filter that filters out matched documents using a query.
OpenIndexResponse is the response of OpenIndexService.Do.
OpenIndexService opens an index.
No description provided by the author
No description provided by the author
A filter that matches documents using OR boolean operator on other queries.
No description provided by the author
PercentileRanksAggregation See: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-percentile-rank-aggregation.html.
PercentilesAggregation See: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-percentile-aggregation.html.
PercolateMatch returns a single match in a PercolateResponse.
PercolateResponse is the response of PercolateService.Do.
PercolateService is documented at http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.4/search-percolate.html.
For more details, see http://www.elasticsearch.org/guide/reference/api/search/phrase-suggest/.
PingResult is the result returned from querying the Elasticsearch server.
PingService checks if an Elasticsearch server on a given URL is alive.
Filters documents that have fields containing terms with a specified prefix (not analyzed).
Matches documents that have fields containing terms with a specified prefix (not analyzed).
PutMappingResponse is the response of PutMappingService.Do.
PutMappingService allows to register specific mapping definition for a specific type.
PutTemplateResponse is the response of PutTemplateService.Do.
PutTemplateService creates or updates a search template.
PutWarmerResponse is the response of IndicesPutWarmerService.Do.
Query Facet See: http://www.elasticsearch.org/guide/reference/api/search/facets/query-facet.html.
QueryFilter wraps any query to be used as a filter.
No description provided by the author
A query that uses the query parser in order to parse its content.
RandomFunction builds a random score function.
RangeAggregation is a multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket.
Range facet allows to specify a set of ranges and get both the number of docs (count) that fall within each range, and aggregated data either based on the field, or using another field.
Filters documents with fields that have terms within a certain range.
Matches documents with fields that have terms within a certain range.
No description provided by the author
No description provided by the author
RegexpFilter allows filtering for regular expressions.
RegexpQuery allows you to use regular expression term queries.
Reindexer simplifies the process of reindexing an index.
ReindexerResponse is returned from the Do func in a Reindexer.
No description provided by the author
Response represents a response from Elasticsearch.
ReverseNestedAggregation defines a special single bucket aggregation that enables aggregating on parent docs from nested documents.
scanCursor represents a single page of results from an Elasticsearch Scan operation.
ScanService manages a cursor through documents in Elasticsearch.
ScoreSort sorts by relevancy score.
No description provided by the author
ScriptFunction builds a script score function.
ScriptSort sorts by a custom script.
ScrollService manages a cursor through documents in Elasticsearch.
SearchExplanation explains how the score for a hit was computed.
SearchFacet is a single facet.
SearchHit is a single hit.
No description provided by the author
SearchHits specifies the list of search hits.
SearchRequest combines a search request and its query details (see SearchSource).
SearchResult is the result of a search in Elasticsearch.
SearchService for documents in Elasticsearch.
SearchSource enables users to build the search source.
SearchSuggestion is a single search suggestion.
SearchSuggestionOption is an option of a SearchSuggestion.
SignificantSignificantTermsAggregation is an aggregation that returns interesting or unusual occurrences of terms in a set.
SimpleBackoff takes a list of fixed values for backoff intervals.
SimpleQueryStringQuery is a query that uses the SimpleQueryParser to parse its context.
SortInfo contains information about sorting a field.
Statistical facet allows to compute statistical data on a numeric fields.
Statistical facet allows to compute statistical data on a numeric fields.
StatsAggregation is a multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents.
StopBackoff is a fixed backoff policy that always returns false for Next(), meaning that the operation should never be retried.
StopRetrier is an implementation that does no retries.
StupidBackoffSmoothingModel implements a stupid backoff smoothing model.
SuggesterCategoryMapping provides a mapping for a category context in a suggester.
SuggesterCategoryQuery provides querying a category context in a suggester.
SuggesterGeoMapping provides a mapping for a geolocation context in a suggester.
SuggesterGeoQuery provides querying a geolocation context in a suggester.
SuggestField can be used by the caller to specify a suggest field at index time.
No description provided by the author
SuggestService returns suggestions for text.
SumAggregation is a single-value metrics aggregation that sums up numeric values that are extracted from the aggregated documents.
TemplateQuery is a query that accepts a query template and a map of key/value pairs to fill in template parameters.
Filters documents that have fields that contain a term (not analyzed).
A term query matches documents that contain a term (not analyzed).
TermsAggregation is a multi-bucket value source based aggregation where buckets are dynamically built - one per unique value.
Allow to specify field facets that return the N most frequent terms.
Filters documents that have fields that match any of the provided terms (not analyzed).
No description provided by the author
A query that match on any (configurable) of the provided terms.
The terms_stats facet combines both the terms and statistical allowing to compute stats computed on a field, per term value driven by another field.
For more details, see http://www.elasticsearch.org/guide/reference/api/search/term-suggest/.
TermvectorService returns information and statistics on terms in the fields of a particular document.
No description provided by the author
TermvectorsResponse is the response of TermvectorService.Do.
No description provided by the author
TopHitsAggregation keeps track of the most relevant document being aggregated.
Filters documents matching the provided document / mapping type.
UpdateResult is the result of updating a document in Elasticsearch.
UpdateService updates a document in Elasticsearch.
ValueCountAggregation is a single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents.
WeightFactorFunction builds a weight factor function that multiplies the weight to the score.
WildcardQuery matches documents that have fields matching a wildcard expression (not analyzed).
ZeroBackoff is a fixed backoff policy whose backoff time is always zero, meaning that the operation is retried immediately without waiting, indefinitely.

# Interfaces

Aggregations can be seen as a unit-of-work that build analytic information over a set of documents.
AliasAction is an action to apply to an alias, e.g.
Backoff allows callers to implement their own Backoff strategy.
Generic interface to bulkable requests.
No description provided by the author
Decoder is used to decode responses from Elasticsearch.
Represents a glimpse into the data.
No description provided by the author
Logger specifies the interface for all log operations.
Represents the generic query interface.
No description provided by the author
Retrier decides whether to retry a failed HTTP request with Elasticsearch.
ScoreFunction is used in combination with the Function Score Query.
No description provided by the author
Sorter is an interface for sorting strategies, e.g.
Represents the generic suggester interface.
SuggesterContextQuery is used to define context information within a suggestion request.

# Type aliases

Aggregations is a list of aggregations that are part of a search result.
BackoffFunc specifies the signature of a function that returns the time to wait before the next call to a resource.
BulkAfterFunc defines the signature of callbacks that are executed after a commit to Elasticsearch.
BulkBeforeFunc defines the signature of callbacks that are executed before a commit to Elasticsearch.
ClientOptionFunc is a function that configures a Client.
RawStringQuery can be used to treat a string representation of an ES query as a Query.
A ReindexerFunc receives each hit from the sourceIndex.
ReindexerProgressFunc is a callback that can be used with Reindexer to report progress while reindexing data.
Elasticsearch-specific HTTP request.
RetrierFunc specifies the signature of a Retry function.
SearchFacets is a map of facets.
SearchHitHighlight is the highlight information of a search hit.
SearchSuggest is a map of suggestions.
No description provided by the author