elastic

package module
v7.0.32 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: MIT Imports: 29 Imported by: 1,561

README

Elastic

This is a development branch that is actively being worked on. DO NOT USE IN PRODUCTION! If you want to use stable versions of Elastic, please use Go modules for the 7.x release (or later) or a dependency manager like dep for earlier releases.

Elastic is an Elasticsearch client for the Go programming language.

Build Status Godoc license

See the wiki for additional information about Elastic.

Buy Me A Coffee

Releases

The release branches (e.g. release-branch.v7) are actively being worked on and can break at any time. If you want to use stable versions of Elastic, please use Go modules.

Here's the version matrix:

Elasticsearch version Elastic version Package URL Remarks
7.x                   7.0             github.com/olivere/elastic/v7 (source doc) Use Go modules.
6.x                   6.0             github.com/olivere/elastic (source doc) Use a dependency manager (see below).
5.x 5.0 gopkg.in/olivere/elastic.v5 (source doc) Actively maintained.
2.x 3.0 gopkg.in/olivere/elastic.v3 (source doc) Deprecated. Please update.
1.x 2.0 gopkg.in/olivere/elastic.v2 (source doc) Deprecated. Please update.
0.9-1.3 1.0 gopkg.in/olivere/elastic.v1 (source doc) Deprecated. Please update.

Example:

You have installed Elasticsearch 7.0.0 and want to use Elastic. As listed above, you should use Elastic 7.0 (code is in release-branch.v7).

To use the required version of Elastic in your application, you should use Go modules to manage dependencies. Make sure to use a version such as 7.0.0 or later.

To use Elastic, import:

import "github.com/olivere/elastic/v7"
Elastic 7.0

Elastic 7.0 targets Elasticsearch 7.x which was released on April 10th 2019.

As always with major version, there are a lot of breaking changes. We will use this as an opportunity to clean up and refactor Elastic, as we already did in earlier (major) releases.

Elastic 6.0

Elastic 6.0 targets Elasticsearch 6.x which was released on 14th November 2017.

Notice that there are a lot of breaking changes in Elasticsearch 6.0 and we used this as an opportunity to clean up and refactor Elastic as we did in the transition from earlier versions of Elastic.

Elastic 5.0

Elastic 5.0 targets Elasticsearch 5.0.0 and later. Elasticsearch 5.0.0 was released on 26th October 2016.

Notice that there are will be a lot of breaking changes in Elasticsearch 5.0 and we used this as an opportunity to clean up and refactor Elastic as we did in the transition from Elastic 2.0 (for Elasticsearch 1.x) to Elastic 3.0 (for Elasticsearch 2.x).

Furthermore, the jump in version numbers will give us a chance to be in sync with the Elastic Stack.

Elastic 3.0

Elastic 3.0 targets Elasticsearch 2.x and is published via gopkg.in/olivere/elastic.v3.

Elastic 3.0 will only get critical bug fixes. You should update to a recent version.

Elastic 2.0

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

Elastic 2.0 will only get critical bug fixes. You should update to a recent version.

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. Elastic is stable but the API changes now and then. We strive for API compatibility. However, Elasticsearch sometimes introduces breaking changes and we sometimes have to adapt.

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 Elastic is in sync with Elasticsearch.

Elastic has been used in production starting with Elasticsearch 0.90 up to recent 7.x versions. We recently switched to GitHub Actions for testing. Before that, we used Travis CI successfully for years).

Elasticsearch has quite a few features. Most of them are implemented by Elastic. 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.

Getting Started

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 of creating a client, creating an index, adding a document, executing a search etc.

An example is available here.

Here's a link to a complete working example for v6.

Here are a few tips on how to get used to Elastic:

  1. Head over to the Wiki for detailed information and topics like e.g. how to add a middleware or how to connect to AWS.
  2. If you are unsure how to implement something, read the tests (all _test.go files). They not only serve as a guard against changes, but also as a reference.
  3. The recipes contains small examples on how to implement something, e.g. bulk indexing, scrolling etc.

API Status

Document APIs
  • Index API
  • Get API
  • Delete API
  • Delete By Query API
  • Update API
  • Update By Query API
  • Multi Get API
  • Bulk API
  • Reindex API
  • Term Vectors
  • Multi termvectors API
Search APIs
  • Search
  • Search Template
  • Multi Search Template
  • Search Shards API
  • Suggesters
    • Term Suggester
    • Phrase Suggester
    • Completion Suggester
    • Context Suggester
  • Multi Search API
  • Count API
  • Validate API
  • Explain API
  • Profile API
  • Field Capabilities API
Aggregations
  • Metrics Aggregations
    • Avg
    • Boxplot (X-pack)
    • Cardinality
    • Extended Stats
    • Geo Bounds
    • Geo Centroid
    • Matrix stats
    • Max
    • Median absolute deviation
    • Min
    • Percentile Ranks
    • Percentiles
    • Rate (X-pack)
    • Scripted Metric
    • Stats
    • String stats (X-pack)
    • Sum
    • T-test (X-pack)
    • Top Hits
    • Top metrics (X-pack)
    • Value Count
    • Weighted avg
  • Bucket Aggregations
    • Adjacency Matrix
    • Auto-interval Date Histogram
    • Children
    • Composite
    • Date Histogram
    • Date Range
    • Diversified Sampler
    • Filter
    • Filters
    • Geo Distance
    • Geohash Grid
    • Geotile grid
    • Global
    • Histogram
    • IP Range
    • Missing
    • Nested
    • Parent
    • Range
    • Rare terms
    • Reverse Nested
    • Sampler
    • Significant Terms
    • Significant Text
    • Terms
    • Variable width histogram
  • Pipeline Aggregations
    • Avg Bucket
    • Bucket Script
    • Bucket Selector
    • Bucket Sort
    • Cumulative cardinality (X-pack)
    • Cumulative Sum
    • Derivative
    • Extended Stats Bucket
    • Inference bucket (X-pack)
    • Max Bucket
    • Min Bucket
    • Moving Average
    • Moving function
    • Moving percentiles (X-pack)
    • Normalize (X-pack)
    • Percentiles Bucket
    • Serial Differencing
    • Stats Bucket
    • Sum Bucket
  • Aggregation Metadata
Indices APIs
  • Create Index
  • Delete Index
  • Get Index
  • Indices Exists
  • Open / Close Index
  • Shrink Index
  • Rollover Index
  • Put Mapping
  • Get Mapping
  • Get Field Mapping
  • Types Exists
  • Index Aliases
  • Update Indices Settings
  • Get Settings
  • Analyze
    • Explain Analyze
  • Index Templates
  • Indices Stats
  • Indices Segments
  • Indices Recovery
  • Indices Shard Stores
  • Clear Cache
  • Flush
    • Synced Flush
  • Refresh
  • Force Merge
Index Lifecycle Management APIs
  • Create Policy
  • Get Policy
  • Delete Policy
  • Move to Step
  • Remove Policy
  • Retry Policy
  • Get Ilm Status
  • Explain Lifecycle
  • Start Ilm
  • Stop Ilm
cat APIs
  • cat aliases
  • cat allocation
  • cat count
  • cat fielddata
  • cat health
  • cat indices
  • cat master
  • cat nodeattrs
  • cat nodes
  • cat pending tasks
  • cat plugins
  • cat recovery
  • cat repositories
  • cat thread pool
  • cat shards
  • cat segments
  • cat snapshots
  • cat templates
Cluster APIs
  • Cluster Health
  • Cluster State
  • Cluster Stats
  • Pending Cluster Tasks
  • Cluster Reroute
  • Cluster Update Settings
  • Nodes Stats
  • Nodes Info
  • Nodes Feature Usage
  • Remote Cluster Info
  • Task Management API
  • Nodes hot_threads
  • Cluster Allocation Explain API
Rollup APIs (XPack)
  • Create Job
  • Delete Job
  • Get Job
  • Start Job
  • Stop Job
Query DSL
  • Match All Query
  • Inner hits
  • Full text queries
    • Match Query
    • Match Boolean Prefix Query
    • Match Phrase Query
    • Match Phrase Prefix Query
    • Multi Match Query
    • Common Terms Query
    • Query String Query
    • Simple Query String Query
    • Combined Fields Query
    • Intervals Query
  • Term level queries
    • Term Query
    • Terms Query
    • Terms Set Query
    • Range Query
    • Exists Query
    • Prefix Query
    • Wildcard Query
    • Regexp Query
    • Fuzzy Query
    • Type Query
    • Ids Query
  • Compound queries
    • Constant Score Query
    • Bool Query
    • Dis Max Query
    • Function Score Query
    • Boosting Query
  • Joining queries
    • Nested Query
    • Has Child Query
    • Has Parent Query
    • Parent Id Query
  • Geo queries
    • GeoShape Query
    • Geo Bounding Box Query
    • Geo Distance Query
    • Geo Polygon Query
  • Specialized queries
    • Distance Feature Query
    • More Like This Query
    • Script Query
    • Script Score Query
    • Percolate Query
  • Span queries
    • Span Term Query
    • Span Multi Term Query
    • Span First Query
    • Span Near Query
    • Span Or Query
    • Span Not Query
    • Span Containing Query
    • Span Within Query
    • Span Field Masking Query
  • Minimum Should Match
  • Multi Term Query Rewrite
Modules
  • Snapshot and Restore
    • Repositories
    • Snapshot get
    • Snapshot create
    • Snapshot delete
    • Restore
    • Snapshot status
    • Monitoring snapshot/restore status
    • Stopping currently running snapshot and restore
  • Scripting
    • GetScript
    • PutScript
    • DeleteScript
Sorting
  • Sort by score
  • Sort by field
  • Sort by geo distance
  • Sort by script
  • Sort by doc
Scrolling

Scrolling is supported via a ScrollService. It supports an iterator-like interface. The ClearScroll API is implemented as well.

A pattern for efficiently scrolling in parallel is described in the Wiki.

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, backoff by Cenk Altı and leaktest by Ian Chiles.

LICENSE

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

Documentation

Overview

Package elastic provides an interface to the Elasticsearch server (https://www.elastic.co/products/elasticsearch).

The first thing you do is to create a Client. If you have Elasticsearch installed and running with its default settings (i.e. available at http://127.0.0.1:9200), all you need to do is:

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

If your Elasticsearch server is running on a different IP and/or port, just provide a URL to NewClient:

// Create a client and connect to http://192.168.2.10:9201
client, err := elastic.NewClient(elastic.SetURL("http://192.168.2.10:9201"))
if err != nil {
  // Handle error
}

You can pass many more configuration parameters to NewClient. Review the documentation of NewClient for more information.

If no Elasticsearch server is available, services will fail when creating a new request and will return ErrNoClient.

A Client provides services. The services usually come with a variety of methods to prepare the query and a Do function to execute it against the Elasticsearch REST interface and return a response. Here is an example of the IndexExists service that checks if a given index already exists.

exists, err := client.IndexExists("twitter").Do(context.Background())
if err != nil {
	// Handle error
}
if !exists {
	// Index does not exist yet.
}

Look up the documentation for Client to get an idea of the services provided and what kinds of responses you get when executing the Do function of a service. Also see the wiki on Github for more details.

Copyright 2012-present Oliver Eilhard. All rights reserved. Use of this source code is governed by a MIT-license. See http://olivere.mit-license.org/license.txt for details.

Example
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))
// Trace request and response details like this
// client, err := elastic.NewClient(elastic.SetTraceLog(log.New(os.Stdout, "", 0)))
if err != nil {
	// Handle error
	panic(err)
}

// 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":{
		"doc":{
			"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").
	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").
	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").
	Id("1").
	Do(context.Background())
if err != nil {
	switch {
	case elastic.IsNotFound(err):
		panic(fmt.Sprintf("Document not found: %v", err))
	case elastic.IsTimeout(err):
		panic(fmt.Sprintf("Timeout retrieving document: %v", err))
	case elastic.IsConnErr(err):
		panic(fmt.Sprintf("Connection problem: %v", err))
	default:
		// Some other kind of error
		panic(err)
	}
}
fmt.Printf("Got document %s in version %d from index %s, type %s\n", get1.Id, get1.Version, get1.Index, get1.Type)

// Refresh to make sure the documents are searchable.
_, err = client.Refresh().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.TotalHits() > 0 {
	fmt.Printf("Found a total of %d tweets\n", searchResult.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")
}

// Update a tweet by the update API of Elasticsearch.
// We just increment the number of retweets.
script := elastic.NewScript("ctx._source.retweets += params.num").Param("num", 1)
update, err := client.Update().Index("twitter").Id("1").
	Script(script).
	Upsert(map[string]interface{}{"retweets": 0}).
	Do(context.Background())
if err != nil {
	// Handle error
	panic(err)
}
fmt.Printf("New version of tweet %q is now %d", update.Id, update.Version)

// ...

// 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

Examples

Constants

View Source
const (
	// Version is the current version of Elastic.
	Version = "7.0.32"

	// 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
)
View Source
const (
	// DefaultScrollKeepAlive is the default time a scroll cursor will be kept alive.
	DefaultScrollKeepAlive = "5m"
)

Variables

View Source
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")
)
View Source
var (
	// ErrBulkItemRetry is returned in BulkProcessor from a worker when
	// a response item needs to be retried.
	ErrBulkItemRetry = errors.New("elastic: uncommitted bulk response items")
)
View Source
var (
	// ErrResponseSize is raised if a response body exceeds the given max body size.
	ErrResponseSize = errors.New("elastic: response size too large")
)

Functions

func ErrorReason added in v7.0.20

func ErrorReason(err error) string

ErrorReason returns the reason of an error that Elasticsearch reported, if err is of kind Error and has ErrorDetails with a Reason. Any other value of err will return an empty string.

func IsConflict

func IsConflict(err interface{}) bool

IsConflict returns true if the given error indicates that the Elasticsearch operation resulted in a version conflict. This can occur in operations like `update` or `index` with `op_type=create`. The err parameter can be of type *elastic.Error, elastic.Error, *http.Response or int (indicating the HTTP status code).

func IsConnErr

func IsConnErr(err error) bool

IsConnErr returns true if the error indicates that Elastic could not find an Elasticsearch host to connect to.

func IsContextErr

func IsContextErr(err error) bool

IsContextErr returns true if the error is from a context that was canceled or deadline exceeded

func IsForbidden

func IsForbidden(err interface{}) bool

IsForbidden returns true if the given error indicates that Elasticsearch returned HTTP status 403. This happens e.g. due to a missing license. The err parameter can be of type *elastic.Error, elastic.Error, *http.Response or int (indicating the HTTP status code).

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 IsStatusCode

func IsStatusCode(err interface{}, code int) bool

IsStatusCode returns true if the given error indicates that the Elasticsearch operation returned the specified HTTP status code. The err parameter can be of type *http.Response, *Error, Error, 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).

func IsUnauthorized added in v7.0.19

func IsUnauthorized(err interface{}) bool

IsUnauthorized returns true if the given error indicates that Elasticsearch returned HTTP status 401. This happens e.g. when the cluster is configured to require HTTP Basic Auth. The err parameter can be of type *elastic.Error, elastic.Error, *http.Response or int (indicating the HTTP status code).

func Retry

func Retry(o Operation, b Backoff) error

Retry the function f until it does not return error or BackOff stops. f is guaranteed to be run at least once. It is the caller's responsibility to reset b after Retry returns.

Retry sleeps the goroutine for the duration returned by BackOff after a failed operation returns.

func RetryNotify

func RetryNotify(operation Operation, b Backoff, notify Notify) error

RetryNotify calls notify function with the error and wait duration for each failed attempt before sleep.

Types

type AcknowledgedResponse

type AcknowledgedResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

AcknowledgedResponse is returned from various APIs. It simply indicates whether the operation is acknowledged or not.

type AdjacencyMatrixAggregation

type AdjacencyMatrixAggregation struct {
	// contains filtered or unexported fields
}

AdjacencyMatrixAggregation returning a form of adjacency matrix. The request provides a collection of named filter expressions, similar to the filters aggregation request. Each bucket in the response represents a non-empty cell in the matrix of intersecting filters.

For details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-adjacency-matrix-aggregation.html

func NewAdjacencyMatrixAggregation

func NewAdjacencyMatrixAggregation() *AdjacencyMatrixAggregation

NewAdjacencyMatrixAggregation initializes a new AdjacencyMatrixAggregation.

func (*AdjacencyMatrixAggregation) Filters

Filters adds the filter

func (*AdjacencyMatrixAggregation) Meta

func (a *AdjacencyMatrixAggregation) Meta(metaData map[string]interface{}) *AdjacencyMatrixAggregation

Meta sets the meta data to be included in the aggregation response.

func (*AdjacencyMatrixAggregation) Source

func (a *AdjacencyMatrixAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

func (*AdjacencyMatrixAggregation) SubAggregation

func (a *AdjacencyMatrixAggregation) SubAggregation(name string, subAggregation Aggregation) *AdjacencyMatrixAggregation

SubAggregation adds a sub-aggregation to this aggregation.

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/7.0/search-aggregations.html

type AggregationBucketAdjacencyMatrix

type AggregationBucketAdjacencyMatrix struct {
	Aggregations

	Buckets []*AggregationBucketKeyItem //`json:"buckets"`
	Meta    map[string]interface{}      // `json:"meta,omitempty"`
}

AggregationBucketAdjacencyMatrix is a multi-bucket aggregation that is returned with a AdjacencyMatrix aggregation.

func (*AggregationBucketAdjacencyMatrix) UnmarshalJSON

func (a *AggregationBucketAdjacencyMatrix) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON data and initializes an AggregationBucketAdjacencyMatrix structure.

type AggregationBucketCompositeItem

type AggregationBucketCompositeItem struct {
	Aggregations

	Key      map[string]interface{} //`json:"key"`
	DocCount int64                  //`json:"doc_count"`
}

AggregationBucketCompositeItem is a single bucket of an AggregationBucketCompositeItems structure.

func (*AggregationBucketCompositeItem) UnmarshalJSON

func (a *AggregationBucketCompositeItem) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON data and initializes an AggregationBucketCompositeItem structure.

type AggregationBucketCompositeItems

type AggregationBucketCompositeItems struct {
	Aggregations

	Buckets  []*AggregationBucketCompositeItem //`json:"buckets"`
	Meta     map[string]interface{}            // `json:"meta,omitempty"`
	AfterKey map[string]interface{}            // `json:"after_key,omitempty"`
}

AggregationBucketCompositeItems implements the response structure for a bucket aggregation of type composite.

func (*AggregationBucketCompositeItems) UnmarshalJSON

func (a *AggregationBucketCompositeItems) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON data and initializes an AggregationBucketCompositeItems structure.

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 AggregationBucketKeyedHistogramItems

type AggregationBucketKeyedHistogramItems struct {
	Aggregations

	Buckets map[string]*AggregationBucketHistogramItem //`json:"buckets"`
	Meta    map[string]interface{}                     // `json:"meta,omitempty"`
}

AggregationBucketKeyedHistogramItems is a bucket aggregation that is returned with a (keyed) date histogram aggregation.

func (*AggregationBucketKeyedHistogramItems) UnmarshalJSON

func (a *AggregationBucketKeyedHistogramItems) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON data and initializes an AggregationBucketKeyedHistogramItems 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 AggregationBucketMultiKeyItem added in v7.0.25

type AggregationBucketMultiKeyItem struct {
	Aggregations

	Key         []interface{} //`json:"key"`
	KeyAsString *string       //`json:"key_as_string"`
	KeyNumber   []json.Number
	DocCount    int64 //`json:"doc_count"`
}

AggregationBucketMultiKeyItem is a single bucket of an AggregationBucketMultiKeyItems structure.

func (*AggregationBucketMultiKeyItem) UnmarshalJSON added in v7.0.25

func (a *AggregationBucketMultiKeyItem) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON data and initializes an AggregationBucketMultiKeyItem structure.

type AggregationBucketMultiKeyItems added in v7.0.25

type AggregationBucketMultiKeyItems struct {
	Aggregations

	DocCountErrorUpperBound int64                            //`json:"doc_count_error_upper_bound"`
	SumOfOtherDocCount      int64                            //`json:"sum_other_doc_count"`
	Buckets                 []*AggregationBucketMultiKeyItem //`json:"buckets"`
	Meta                    map[string]interface{}           // `json:"meta,omitempty"`
}

AggregationBucketMultiKeyItems is a bucket aggregation that is returned with a multi terms aggregation.

func (*AggregationBucketMultiKeyItems) UnmarshalJSON added in v7.0.25

func (a *AggregationBucketMultiKeyItems) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON data and initializes an AggregationBucketMultiKeyItems 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 AggregationGeoCentroidMetric

type AggregationGeoCentroidMetric struct {
	Aggregations

	Location struct {
		Latitude  float64 `json:"lat"`
		Longitude float64 `json:"lon"`
	} `json:"location"`

	Count int // `json:"count,omitempty"`

	Meta map[string]interface{} // `json:"meta,omitempty"`
}

AggregationGeoCentroidMetric is a metric as returned by a GeoCentroid aggregation.

func (*AggregationGeoCentroidMetric) UnmarshalJSON

func (a *AggregationGeoCentroidMetric) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON data and initializes an AggregationGeoCentroidMetric 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 AggregationPipelinePercentilesMetric

type AggregationPipelinePercentilesMetric struct {
	Aggregations

	Values map[string]float64     // `json:"values"`
	Meta   map[string]interface{} // `json:"meta,omitempty"`
}

AggregationPipelinePercentilesMetric is the value returned by a pipeline percentiles Metric aggregation

func (*AggregationPipelinePercentilesMetric) UnmarshalJSON

func (a *AggregationPipelinePercentilesMetric) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON data and initializes an AggregationPipelinePercentilesMetric 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 AggregationScriptedMetric added in v7.0.4

type AggregationScriptedMetric struct {
	Aggregations

	Value interface{}            //`json:"value"`
	Meta  map[string]interface{} //`json:"meta,omitempty"`
}

AggregationScriptedMetric is the value return by a scripted metric aggregation. Value maybe one of map[string]interface{}/[]interface{}/string/bool/json.Number

func (*AggregationScriptedMetric) UnmarshalJSON added in v7.0.4

func (a *AggregationScriptedMetric) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON data and initializes an AggregationScriptedMetric 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 AggregationTopMetricsItem added in v7.0.25

type AggregationTopMetricsItem struct {
	Sort    []interface{}          `json:"sort"`    // sort information
	Metrics map[string]interface{} `json:"metrics"` // returned metrics
}

AggregationTopMetricsItem is a set of metrics returned for the top document or documents

type AggregationTopMetricsItems added in v7.0.25

type AggregationTopMetricsItems struct {
	Aggregations

	Top []AggregationTopMetricsItem `json:"top"`
}

AggregationTopMetricsItems is the value returned by the top metrics aggregation

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.

Example
// Get a client to the local Elasticsearch instance.
client, err := elastic.NewClient()
if err != nil {
	// Handle error
	panic(err)
}

// Create an aggregation for users and a sub-aggregation for a date histogram of tweets (per year).
timeline := elastic.NewTermsAggregation().Field("user").Size(10).OrderByCountDesc()
histogram := elastic.NewDateHistogramAggregation().Field("created").CalendarInterval("year")
timeline = timeline.SubAggregation("history", histogram)

// Search with a term query
searchResult, err := client.Search().
	Index("twitter").                  // search in index "twitter"
	Query(elastic.NewMatchAllQuery()). // return all results, but ...
	SearchType("count").               // ... do not return hits, just the count
	Aggregation("timeline", timeline). // add our aggregation to the query
	Pretty(true).                      // pretty print request and response JSON
	Do(context.Background())           // execute
if err != nil {
	// Handle error
	panic(err)
}

// Access "timeline" aggregate in search result.
agg, found := searchResult.Aggregations.Terms("timeline")
if !found {
	log.Fatalf("we should have a terms aggregation called %q", "timeline")
}
for _, userBucket := range agg.Buckets {
	// Every bucket should have the user field as key.
	user := userBucket.Key

	// The sub-aggregation history should have the number of tweets per year.
	histogram, found := userBucket.DateHistogram("history")
	if found {
		for _, year := range histogram.Buckets {
			var key string
			if s := year.KeyAsString; s != nil {
				key = *s
			}
			fmt.Printf("user %q has %d tweets in %q\n", user, year.DocCount, key)
		}
	}
}
Output:

func (Aggregations) AutoDateHistogram added in v7.0.5

func (a Aggregations) AutoDateHistogram(name string) (*AggregationBucketHistogramItems, bool)

AutoDateHistogram returns auto date histogram aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-datehistogram-aggregation.html

func (Aggregations) AvgBucket

AvgBucket returns average bucket pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/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/7.0/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/7.0/search-aggregations-metrics-cardinality-aggregation.html

func (Aggregations) Composite

Composite returns composite bucket aggregation results.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-composite-aggregation.html for details.

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/7.0/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/7.0/search-aggregations-bucket-datehistogram-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/7.0/search-aggregations-pipeline-derivative-aggregation.html

func (Aggregations) DiversifiedSampler

func (a Aggregations) DiversifiedSampler(name string) (*AggregationSingleBucket, bool)

DiversifiedSampler returns diversified_sampler aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-diversified-sampler-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/7.0/search-aggregations-metrics-extendedstats-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/7.0/search-aggregations-bucket-geodistance-aggregation.html

func (Aggregations) GeoTile added in v7.0.23

func (a Aggregations) GeoTile(name string) (*AggregationBucketKeyItems, bool)

GeoTile returns geo-tile aggregation results. https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-geotilegrid-aggregation.html

func (Aggregations) KeyedDateHistogram

func (a Aggregations) KeyedDateHistogram(name string) (*AggregationBucketKeyedHistogramItems, bool)

KeyedDateHistogram returns date histogram aggregation results for keyed responses.

See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-datehistogram-aggregation.html#_keyed_response_3

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/7.0/search-aggregations-matrix-stats-aggregation.html

func (Aggregations) MaxBucket

MaxBucket returns maximum bucket pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-max-bucket-aggregation.html

func (Aggregations) MedianAbsoluteDeviation added in v7.0.15

func (a Aggregations) MedianAbsoluteDeviation(name string) (*AggregationValueMetric, bool)

MedianAbsoluteDeviation returns median absolute deviation aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/7.6/search-aggregations-metrics-median-absolute-deviation-aggregation.html for details.

func (Aggregations) MinBucket

MinBucket returns minimum bucket pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-min-bucket-aggregation.html

func (Aggregations) MovAvg deprecated

MovAvg returns moving average pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-movavg-aggregation.html

Deprecated: The MovAvgAggregation has been deprecated in 6.4.0. Use the more generate MovFnAggregation instead.

func (Aggregations) MovFn

MovFn returns moving function pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-movfn-aggregation.html

func (Aggregations) MultiTerms added in v7.0.25

func (a Aggregations) MultiTerms(name string) (*AggregationBucketMultiKeyItems, bool)

MultiTerms returns multi terms aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.13/search-aggregations-bucket-multi-terms-aggregation.html

func (Aggregations) PercentilesBucket

func (a Aggregations) PercentilesBucket(name string) (*AggregationPipelinePercentilesMetric, bool)

PercentilesBucket returns stats bucket pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-percentiles-bucket-aggregation.html

func (Aggregations) RareTerms added in v7.0.15

func (a Aggregations) RareTerms(name string) (*AggregationBucketKeyItems, bool)

RareTerms returns rate terms aggregation results. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-rare-terms-aggregation.html

func (Aggregations) ScriptedMetric added in v7.0.4

func (a Aggregations) ScriptedMetric(name string) (*AggregationScriptedMetric, bool)

ScriptedMetric returns scripted metric aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/7.2/search-aggregations-metrics-scripted-metric-aggregation.html for details.

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/7.0/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/7.0/search-aggregations-bucket-significantterms-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/7.0/search-aggregations-pipeline-stats-bucket-aggregation.html

func (Aggregations) SumBucket

SumBucket returns sum bucket pipeline aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-sum-bucket-aggregation.html

func (Aggregations) TopMetrics added in v7.0.25

func (a Aggregations) TopMetrics(name string) (*AggregationTopMetricsItems, bool)

TopMetrics returns top metrics aggregation results. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-metrics-top-metrics.html for details

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/7.0/search-aggregations-metrics-valuecount-aggregation.html

func (Aggregations) WeightedAvg

func (a Aggregations) WeightedAvg(name string) (*AggregationValueMetric, bool)

WeightedAvg computes the weighted average of numeric values that are extracted from the aggregated documents. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-metrics-weight-avg-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) IsWriteIndex

func (a *AliasAddAction) IsWriteIndex(flag bool) *AliasAddAction

IsWriteIndex associates an is_write_index flag 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 AliasRemoveIndexAction

type AliasRemoveIndexAction struct {
	// contains filtered or unexported fields
}

AliasRemoveIndexAction is an action to remove an index during an alias operation.

func NewAliasRemoveIndexAction

func NewAliasRemoveIndexAction(index string) *AliasRemoveIndexAction

NewAliasRemoveIndexAction returns an action to remove an index.

func (*AliasRemoveIndexAction) Source

func (a *AliasRemoveIndexAction) Source() (interface{}, error)

Source returns the JSON-serializable data.

func (*AliasRemoveIndexAction) Validate

func (a *AliasRemoveIndexAction) Validate() error

Validate checks if the operation is valid.

type AliasResult

type AliasResult struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

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/7.0/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) ErrorTrace added in v7.0.7

func (s *AliasService) ErrorTrace(errorTrace bool) *AliasService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*AliasService) FilterPath added in v7.0.7

func (s *AliasService) FilterPath(filterPath ...string) *AliasService

FilterPath specifies a list of filters used to reduce the response.

func (*AliasService) Header added in v7.0.7

func (s *AliasService) Header(name string, value string) *AliasService

Header adds a header to the request.

func (*AliasService) Headers added in v7.0.7

func (s *AliasService) Headers(headers http.Header) *AliasService

Headers specifies the headers of the request.

func (*AliasService) Human added in v7.0.7

func (s *AliasService) Human(human bool) *AliasService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*AliasService) Pretty

func (s *AliasService) Pretty(pretty bool) *AliasService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*AliasService) Remove

func (s *AliasService) Remove(indexName string, aliasName string) *AliasService

Remove removes an alias.

type AliasesResult

type AliasesResult struct {
	Indices map[string]indexResult
}

AliasesResult is the outcome of calling AliasesService.Do.

func (AliasesResult) IndicesByAlias

func (ar AliasesResult) IndicesByAlias(aliasName string) []string

IndicesByAlias returns all indices given a specific alias name.

type AliasesService

type AliasesService struct {
	// contains filtered or unexported fields
}

AliasesService returns the aliases associated with one or more indices, or the indices associated with one or more aliases, or a combination of those filters. See http://www.elastic.co/guide/en/elasticsearch/reference/7.0/indices-aliases.html.

func NewAliasesService

func NewAliasesService(client *Client) *AliasesService

NewAliasesService instantiates a new AliasesService.

func (*AliasesService) Alias

func (s *AliasesService) Alias(alias ...string) *AliasesService

Alias adds one or more aliases.

func (*AliasesService) Do

func (*AliasesService) ErrorTrace added in v7.0.7

func (s *AliasesService) ErrorTrace(errorTrace bool) *AliasesService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*AliasesService) FilterPath added in v7.0.7

func (s *AliasesService) FilterPath(filterPath ...string) *AliasesService

FilterPath specifies a list of filters used to reduce the response.

func (*AliasesService) Header added in v7.0.7

func (s *AliasesService) Header(name string, value string) *AliasesService

Header adds a header to the request.

func (*AliasesService) Headers added in v7.0.7

func (s *AliasesService) Headers(headers http.Header) *AliasesService

Headers specifies the headers of the request.

func (*AliasesService) Human added in v7.0.7

func (s *AliasesService) Human(human bool) *AliasesService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*AliasesService) Index

func (s *AliasesService) Index(index ...string) *AliasesService

Index adds one or more indices.

func (*AliasesService) Pretty

func (s *AliasesService) Pretty(pretty bool) *AliasesService

Pretty tells Elasticsearch whether to return a formatted JSON response.

type AllocateEmptyPrimaryAllocationCommand

type AllocateEmptyPrimaryAllocationCommand struct {
	// contains filtered or unexported fields
}

AllocateEmptyPrimaryAllocationCommand allocates an unassigned empty primary shard to a specific node. Use with extreme care as this will result in data loss. Allocation deciders are ignored.

func NewAllocateEmptyPrimaryAllocationCommand

func NewAllocateEmptyPrimaryAllocationCommand(index string, shardId int, node string, acceptDataLoss bool) *AllocateEmptyPrimaryAllocationCommand

NewAllocateEmptyPrimaryAllocationCommand creates a new AllocateEmptyPrimaryAllocationCommand.

func (*AllocateEmptyPrimaryAllocationCommand) Name

Name of the command in a request to the Cluster Reroute API.

func (*AllocateEmptyPrimaryAllocationCommand) Source

func (cmd *AllocateEmptyPrimaryAllocationCommand) Source() (interface{}, error)

Source generates the (inner) JSON to be used when serializing the command.

type AllocateReplicaAllocationCommand

type AllocateReplicaAllocationCommand struct {
	// contains filtered or unexported fields
}

AllocateReplicaAllocationCommand allocates an unassigned replica shard to a specific node. Checks if allocation deciders allow allocation.

func NewAllocateReplicaAllocationCommand

func NewAllocateReplicaAllocationCommand(index string, shardId int, node string) *AllocateReplicaAllocationCommand

NewAllocateReplicaAllocationCommand creates a new AllocateReplicaAllocationCommand.

func (*AllocateReplicaAllocationCommand) Name

Name of the command in a request to the Cluster Reroute API.

func (*AllocateReplicaAllocationCommand) Source

func (cmd *AllocateReplicaAllocationCommand) Source() (interface{}, error)

Source generates the (inner) JSON to be used when serializing the command.

type AllocateStalePrimaryAllocationCommand

type AllocateStalePrimaryAllocationCommand struct {
	// contains filtered or unexported fields
}

AllocateStalePrimaryAllocationCommand allocates an unassigned stale primary shard to a specific node. Use with extreme care as this will result in data loss. Allocation deciders are ignored.

func NewAllocateStalePrimaryAllocationCommand

func NewAllocateStalePrimaryAllocationCommand(index string, shardId int, node string, acceptDataLoss bool) *AllocateStalePrimaryAllocationCommand

NewAllocateStalePrimaryAllocationCommand creates a new AllocateStalePrimaryAllocationCommand.

func (*AllocateStalePrimaryAllocationCommand) Name

Name of the command in a request to the Cluster Reroute API.

func (*AllocateStalePrimaryAllocationCommand) Source

func (cmd *AllocateStalePrimaryAllocationCommand) Source() (interface{}, error)

Source generates the (inner) JSON to be used when serializing the command.

type AllocationCommand

type AllocationCommand interface {
	Name() string
	Source() (interface{}, error)
}

AllocationCommand is a command to be executed in a call to Cluster Reroute API.

type AllocationId

type AllocationId struct {
	Id           string `json:"id"`
	RelocationId string `json:"relocation_id,omitempty"`
}

type AnalyzeToken added in v7.0.7

type AnalyzeToken struct {
	Token          string `json:"token"`
	Type           string `json:"type"` // e.g. "<ALPHANUM>"
	StartOffset    int    `json:"start_offset"`
	EndOffset      int    `json:"end_offset"`
	Bytes          string `json:"bytes"` // e.g. "[67 75 79]"
	Position       int    `json:"position"`
	PositionLength int    `json:"positionLength"` // seems to be wrong in 7.2+ (no snake_case), see https://github.com/elastic/elasticsearch/blob/7.2/server/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeResponse.java
	TermFrequency  int    `json:"termFrequency"`
	Keyword        bool   `json:"keyword"`
}

type AnalyzeTokenList added in v7.0.7

type AnalyzeTokenList struct {
	Name   string         `json:"name"`
	Tokens []AnalyzeToken `json:"tokens,omitempty"`
}

type AutoDateHistogramAggregation added in v7.0.5

type AutoDateHistogramAggregation struct {
	// contains filtered or unexported fields
}

AutoDateHistogramAggregation is a multi-bucket aggregation similar to the histogram except it can only be applied on date values, and the buckets num can bin pointed. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.3/search-aggregations-bucket-autodatehistogram-aggregation.html

func NewAutoDateHistogramAggregation added in v7.0.5

func NewAutoDateHistogramAggregation() *AutoDateHistogramAggregation

NewAutoDateHistogramAggregation creates a new AutoDateHistogramAggregation.

func (*AutoDateHistogramAggregation) Buckets added in v7.0.5

Buckets buckets num by which the aggregation gets processed.

func (*AutoDateHistogramAggregation) Field added in v7.0.5

Field on which the aggregation is processed.

func (*AutoDateHistogramAggregation) Format added in v7.0.5

Format sets the format to use for dates.

func (*AutoDateHistogramAggregation) Meta added in v7.0.5

func (a *AutoDateHistogramAggregation) Meta(metaData map[string]interface{}) *AutoDateHistogramAggregation

Meta sets the meta data to be included in the aggregation response.

func (*AutoDateHistogramAggregation) MinDocCount added in v7.0.5

MinDocCount sets the minimum document count per bucket. Buckets with less documents than this min value will not be returned.

func (*AutoDateHistogramAggregation) MinimumInterval added in v7.0.5

MinimumInterval accepted units for minimum_interval are: year/month/day/hour/minute/second

func (*AutoDateHistogramAggregation) Missing added in v7.0.5

func (a *AutoDateHistogramAggregation) Missing(missing interface{}) *AutoDateHistogramAggregation

Missing configures the value to use when documents miss a value.

func (*AutoDateHistogramAggregation) Script added in v7.0.5

Script on which th

func (*AutoDateHistogramAggregation) Source added in v7.0.5

func (a *AutoDateHistogramAggregation) Source() (interface{}, error)

Source source for AutoDateHistogramAggregation

func (*AutoDateHistogramAggregation) SubAggregation added in v7.0.5

func (a *AutoDateHistogramAggregation) SubAggregation(name string, subAggregation Aggregation) *AutoDateHistogramAggregation

SubAggregation sub aggregation

func (*AutoDateHistogramAggregation) TimeZone added in v7.0.5

TimeZone sets the timezone in which to translate dates before computing buckets.

type AvgAggregation

type AvgAggregation struct {
	// contains filtered or unexported fields
}

AvgAggregation is a single-value metrics aggregation that computes the average of numeric values that are extracted from the aggregated documents. These values can be extracted either from specific numeric fields in the documents, or be generated by a provided script.

See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-metrics-avg-aggregation.html

func NewAvgAggregation

func NewAvgAggregation() *AvgAggregation

func (*AvgAggregation) Field

func (a *AvgAggregation) Field(field string) *AvgAggregation

func (*AvgAggregation) Format

func (a *AvgAggregation) Format(format string) *AvgAggregation

func (*AvgAggregation) Meta

func (a *AvgAggregation) Meta(metaData map[string]interface{}) *AvgAggregation

Meta sets the meta data to be included in the aggregation response.

func (*AvgAggregation) Missing

func (a *AvgAggregation) Missing(missing interface{}) *AvgAggregation

func (*AvgAggregation) Script

func (a *AvgAggregation) Script(script *Script) *AvgAggregation

func (*AvgAggregation) Source

func (a *AvgAggregation) Source() (interface{}, error)

func (*AvgAggregation) SubAggregation

func (a *AvgAggregation) SubAggregation(name string, subAggregation Aggregation) *AvgAggregation

type AvgBucketAggregation

type AvgBucketAggregation struct {
	// contains filtered or unexported fields
}

AvgBucketAggregation is a sibling pipeline aggregation which calculates the (mean) average value of a specified metric in a sibling aggregation. The specified metric must be numeric and the sibling aggregation must be a multi-bucket aggregation.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-avg-bucket-aggregation.html

func NewAvgBucketAggregation

func NewAvgBucketAggregation() *AvgBucketAggregation

NewAvgBucketAggregation creates and initializes a new AvgBucketAggregation.

func (*AvgBucketAggregation) BucketsPath

func (a *AvgBucketAggregation) BucketsPath(bucketsPaths ...string) *AvgBucketAggregation

BucketsPath sets the paths to the buckets to use for this pipeline aggregator.

func (*AvgBucketAggregation) Format

Format to use on the output of this aggregation.

func (*AvgBucketAggregation) GapInsertZeros

func (a *AvgBucketAggregation) GapInsertZeros() *AvgBucketAggregation

GapInsertZeros inserts zeros for gaps in the series.

func (*AvgBucketAggregation) GapPolicy

func (a *AvgBucketAggregation) GapPolicy(gapPolicy string) *AvgBucketAggregation

GapPolicy defines what should be done when a gap in the series is discovered. Valid values include "insert_zeros" or "skip". Default is "insert_zeros".

func (*AvgBucketAggregation) GapSkip

GapSkip skips gaps in the series.

func (*AvgBucketAggregation) Meta

func (a *AvgBucketAggregation) Meta(metaData map[string]interface{}) *AvgBucketAggregation

Meta sets the meta data to be included in the aggregation response.

func (*AvgBucketAggregation) Source

func (a *AvgBucketAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

type Backoff

type Backoff interface {
	// Next implements a BackoffFunc.
	Next(retry int) (time.Duration, bool)
}

Backoff allows callers to implement their own Backoff strategy.

type BackoffFunc

type BackoffFunc func(retry int) (time.Duration, bool)

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.

func (*BackoffRetrier) Retry

func (r *BackoffRetrier) Retry(ctx context.Context, retry int, req *http.Request, resp *http.Response, err error) (time.Duration, bool, error)

Retry calls into the backoff strategy and its wait interval.

type BoolQuery

type BoolQuery struct {
	Query
	// contains filtered or unexported fields
}

A bool query matches documents matching boolean combinations of other queries. For more details, see: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-bool-query.html

func NewBoolQuery

func NewBoolQuery() *BoolQuery

Creates a new bool query.

func (*BoolQuery) AdjustPureNegative

func (q *BoolQuery) AdjustPureNegative(adjustPureNegative bool) *BoolQuery

func (*BoolQuery) Boost

func (q *BoolQuery) Boost(boost float64) *BoolQuery

func (*BoolQuery) Filter

func (q *BoolQuery) Filter(filters ...Query) *BoolQuery

func (*BoolQuery) MinimumNumberShouldMatch

func (q *BoolQuery) MinimumNumberShouldMatch(minimumNumberShouldMatch int) *BoolQuery

func (*BoolQuery) MinimumShouldMatch

func (q *BoolQuery) MinimumShouldMatch(minimumShouldMatch string) *BoolQuery

func (*BoolQuery) Must

func (q *BoolQuery) Must(queries ...Query) *BoolQuery

func (*BoolQuery) MustNot

func (q *BoolQuery) MustNot(queries ...Query) *BoolQuery

func (*BoolQuery) QueryName

func (q *BoolQuery) QueryName(queryName string) *BoolQuery

func (*BoolQuery) Should

func (q *BoolQuery) Should(queries ...Query) *BoolQuery

func (*BoolQuery) Source

func (q *BoolQuery) Source() (interface{}, error)

Creates the query source for the bool query.

type BoostingQuery

type BoostingQuery struct {
	Query
	// contains filtered or unexported fields
}

A boosting query can be used to effectively demote results that match a given query. For more details, see: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-boosting-query.html

func NewBoostingQuery

func NewBoostingQuery() *BoostingQuery

Creates a new boosting query.

func (*BoostingQuery) Boost

func (q *BoostingQuery) Boost(boost float64) *BoostingQuery

func (*BoostingQuery) Negative

func (q *BoostingQuery) Negative(negative Query) *BoostingQuery

func (*BoostingQuery) NegativeBoost

func (q *BoostingQuery) NegativeBoost(negativeBoost float64) *BoostingQuery

func (*BoostingQuery) Positive

func (q *BoostingQuery) Positive(positive Query) *BoostingQuery

func (*BoostingQuery) Source

func (q *BoostingQuery) Source() (interface{}, error)

Creates the query source for the boosting query.

type BoundingBox added in v7.0.23

type BoundingBox struct {
	TopLeft     GeoPoint `json:"top_left"`
	BottomRight GeoPoint `json:"bottom_right"`
}

BoundingBox bounding box

type BroadcastResponse added in v7.0.32

type BroadcastResponse struct {
	Shards     *ShardsInfo                      `json:"_shards,omitempty"`
	Total      int                              `json:"total"`
	Successful int                              `json:"successful"`
	Failed     int                              `json:"failed"`
	Failures   []*ShardOperationFailedException `json:"failures,omitempty"`
}

type BucketCountThresholds

type BucketCountThresholds struct {
	MinDocCount      *int64
	ShardMinDocCount *int64
	RequiredSize     *int
	ShardSize        *int
}

BucketCountThresholds is used in e.g. terms and significant text aggregations.

type BucketScriptAggregation

type BucketScriptAggregation struct {
	// contains filtered or unexported fields
}

BucketScriptAggregation is a parent pipeline aggregation which executes a script which can perform per bucket computations on specified metrics in the parent multi-bucket aggregation. The specified metric must be numeric and the script must return a numeric value.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-bucket-script-aggregation.html

func NewBucketScriptAggregation

func NewBucketScriptAggregation() *BucketScriptAggregation

NewBucketScriptAggregation creates and initializes a new BucketScriptAggregation.

func (*BucketScriptAggregation) AddBucketsPath

func (a *BucketScriptAggregation) AddBucketsPath(name, path string) *BucketScriptAggregation

AddBucketsPath adds a bucket path to use for this pipeline aggregator.

func (*BucketScriptAggregation) BucketsPathsMap

func (a *BucketScriptAggregation) BucketsPathsMap(bucketsPathsMap map[string]string) *BucketScriptAggregation

BucketsPathsMap sets the paths to the buckets to use for this pipeline aggregator.

func (*BucketScriptAggregation) Format

Format to use on the output of this aggregation.

func (*BucketScriptAggregation) GapInsertZeros

func (a *BucketScriptAggregation) GapInsertZeros() *BucketScriptAggregation

GapInsertZeros inserts zeros for gaps in the series.

func (*BucketScriptAggregation) GapPolicy

func (a *BucketScriptAggregation) GapPolicy(gapPolicy string) *BucketScriptAggregation

GapPolicy defines what should be done when a gap in the series is discovered. Valid values include "insert_zeros" or "skip". Default is "insert_zeros".

func (*BucketScriptAggregation) GapSkip

GapSkip skips gaps in the series.

func (*BucketScriptAggregation) Meta

func (a *BucketScriptAggregation) Meta(metaData map[string]interface{}) *BucketScriptAggregation

Meta sets the meta data to be included in the aggregation response.

func (*BucketScriptAggregation) Script

Script is the script to run.

func (*BucketScriptAggregation) Source

func (a *BucketScriptAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

type BucketSelectorAggregation

type BucketSelectorAggregation struct {
	// contains filtered or unexported fields
}

BucketSelectorAggregation is a parent pipeline aggregation which determines whether the current bucket will be retained in the parent multi-bucket aggregation. The specific metric must be numeric and the script must return a boolean value. If the script language is expression then a numeric return value is permitted. In this case 0.0 will be evaluated as false and all other values will evaluate to true.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-bucket-selector-aggregation.html

func NewBucketSelectorAggregation

func NewBucketSelectorAggregation() *BucketSelectorAggregation

NewBucketSelectorAggregation creates and initializes a new BucketSelectorAggregation.

func (*BucketSelectorAggregation) AddBucketsPath

func (a *BucketSelectorAggregation) AddBucketsPath(name, path string) *BucketSelectorAggregation

AddBucketsPath adds a bucket path to use for this pipeline aggregator.

func (*BucketSelectorAggregation) BucketsPathsMap

func (a *BucketSelectorAggregation) BucketsPathsMap(bucketsPathsMap map[string]string) *BucketSelectorAggregation

BucketsPathsMap sets the paths to the buckets to use for this pipeline aggregator.

func (*BucketSelectorAggregation) Format

Format to use on the output of this aggregation.

func (*BucketSelectorAggregation) GapInsertZeros

GapInsertZeros inserts zeros for gaps in the series.

func (*BucketSelectorAggregation) GapPolicy

GapPolicy defines what should be done when a gap in the series is discovered. Valid values include "insert_zeros" or "skip". Default is "insert_zeros".

func (*BucketSelectorAggregation) GapSkip

GapSkip skips gaps in the series.

func (*BucketSelectorAggregation) Meta

func (a *BucketSelectorAggregation) Meta(metaData map[string]interface{}) *BucketSelectorAggregation

Meta sets the meta data to be included in the aggregation response.

func (*BucketSelectorAggregation) Script

Script is the script to run.

func (*BucketSelectorAggregation) Source

func (a *BucketSelectorAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

type BucketSortAggregation

type BucketSortAggregation struct {
	// contains filtered or unexported fields
}

BucketSortAggregation parent pipeline aggregation which sorts the buckets of its parent multi-bucket aggregation. Zero or more sort fields may be specified together with the corresponding sort order. Each bucket may be sorted based on its _key, _count or its sub-aggregations. In addition, parameters from and size may be set in order to truncate the result buckets.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-bucket-sort-aggregation.html

func NewBucketSortAggregation

func NewBucketSortAggregation() *BucketSortAggregation

NewBucketSortAggregation creates and initializes a new BucketSortAggregation.

func (*BucketSortAggregation) From

From adds the "from" parameter to the aggregation.

func (*BucketSortAggregation) GapInsertZeros

func (a *BucketSortAggregation) GapInsertZeros() *BucketSortAggregation

GapInsertZeros inserts zeros for gaps in the series.

func (*BucketSortAggregation) GapPolicy

func (a *BucketSortAggregation) GapPolicy(gapPolicy string) *BucketSortAggregation

GapPolicy defines what should be done when a gap in the series is discovered. Valid values include "insert_zeros" or "skip". Default is "skip".

func (*BucketSortAggregation) GapSkip

GapSkip skips gaps in the series.

func (*BucketSortAggregation) Meta

func (a *BucketSortAggregation) Meta(meta map[string]interface{}) *BucketSortAggregation

Meta sets the meta data in the aggregation. Although metadata is supported for this aggregation by Elasticsearch, it's important to note that there's no use to it because this aggregation does not include new data in the response. It merely reorders parent buckets.

func (*BucketSortAggregation) Size

Size adds the "size" parameter to the aggregation.

func (*BucketSortAggregation) Sort

func (a *BucketSortAggregation) Sort(field string, ascending bool) *BucketSortAggregation

Sort adds a sort order to the list of sorters.

func (*BucketSortAggregation) SortWithInfo

func (a *BucketSortAggregation) SortWithInfo(info SortInfo) *BucketSortAggregation

SortWithInfo adds a SortInfo to the list of sorters.

func (*BucketSortAggregation) Source

func (a *BucketSortAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

type BulkAfterFunc

type BulkAfterFunc func(executionId int64, requests []BulkableRequest, response *BulkResponse, err error)

BulkAfterFunc defines the signature of callbacks that are executed after a commit to Elasticsearch. The err parameter signals an error.

type BulkBeforeFunc

type BulkBeforeFunc func(executionId int64, requests []BulkableRequest)

BulkBeforeFunc defines the signature of callbacks that are executed before a commit to Elasticsearch.

type BulkCreateRequest added in v7.0.24

type BulkCreateRequest struct {
	BulkableRequest
	// contains filtered or unexported fields
}

BulkCreateRequest is a request to add a new document to Elasticsearch.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html for details.

func NewBulkCreateRequest added in v7.0.24

func NewBulkCreateRequest() *BulkCreateRequest

NewBulkCreateRequest returns a new BulkCreateRequest. The operation type is "create" by default.

func (*BulkCreateRequest) Doc added in v7.0.24

func (r *BulkCreateRequest) Doc(doc interface{}) *BulkCreateRequest

Doc specifies the document to create.

func (*BulkCreateRequest) Id added in v7.0.24

Id specifies the identifier of the document to create.

func (*BulkCreateRequest) IfPrimaryTerm added in v7.0.24

func (r *BulkCreateRequest) IfPrimaryTerm(ifPrimaryTerm int64) *BulkCreateRequest

IfPrimaryTerm indicates to only perform the create operation if the last operation that has changed the document has the specified primary term.

func (*BulkCreateRequest) IfSeqNo added in v7.0.24

func (r *BulkCreateRequest) IfSeqNo(ifSeqNo int64) *BulkCreateRequest

IfSeqNo indicates to only perform the create operation if the last operation that has changed the document has the specified sequence number.

func (*BulkCreateRequest) Index added in v7.0.24

func (r *BulkCreateRequest) Index(index string) *BulkCreateRequest

Index specifies the Elasticsearch index to use for this create request. If unspecified, the index set on the BulkService will be used.

func (*BulkCreateRequest) Parent added in v7.0.24

func (r *BulkCreateRequest) Parent(parent string) *BulkCreateRequest

Parent specifies the identifier of the parent document (if available).

func (*BulkCreateRequest) Pipeline added in v7.0.24

func (r *BulkCreateRequest) Pipeline(pipeline string) *BulkCreateRequest

Pipeline to use while processing the request.

func (*BulkCreateRequest) RetryOnConflict added in v7.0.24

func (r *BulkCreateRequest) RetryOnConflict(retryOnConflict int) *BulkCreateRequest

RetryOnConflict specifies how often to retry in case of a version conflict.

func (*BulkCreateRequest) Routing added in v7.0.24

func (r *BulkCreateRequest) Routing(routing string) *BulkCreateRequest

Routing specifies a routing value for the request.

func (*BulkCreateRequest) Source added in v7.0.24

func (r *BulkCreateRequest) Source() ([]string, error)

Source returns the on-wire representation of the create request, split into an action-and-meta-data line and an (optional) source line. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html for details.

func (*BulkCreateRequest) String added in v7.0.24

func (r *BulkCreateRequest) String() string

String returns the on-wire representation of the create request, concatenated as a single string.

func (*BulkCreateRequest) Type added in v7.0.24

Type specifies the Elasticsearch type to use for this create request. If unspecified, the type set on the BulkService will be used.

func (*BulkCreateRequest) UseEasyJSON added in v7.0.24

func (r *BulkCreateRequest) UseEasyJSON(enable bool) *BulkCreateRequest

UseEasyJSON is an experimental setting that enables serialization with github.com/mailru/easyjson, which should in faster serialization time and less allocations, but removed compatibility with encoding/json, usage of unsafe etc. See https://github.com/mailru/easyjson#issues-notes-and-limitations for details. This setting is disabled by default.

func (*BulkCreateRequest) Version added in v7.0.24

func (r *BulkCreateRequest) Version(version int64) *BulkCreateRequest

Version indicates the version of the document as part of an optimistic concurrency model.

func (*BulkCreateRequest) VersionType added in v7.0.24

func (r *BulkCreateRequest) VersionType(versionType string) *BulkCreateRequest

VersionType specifies how versions are created. It can be e.g. internal, external, external_gte, or force.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-index_.html#index-versioning for details.

type BulkDeleteRequest

type BulkDeleteRequest struct {
	BulkableRequest
	// contains filtered or unexported fields
}

BulkDeleteRequest is a request to remove a document from Elasticsearch.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html for details.

func NewBulkDeleteRequest

func NewBulkDeleteRequest() *BulkDeleteRequest

NewBulkDeleteRequest returns a new BulkDeleteRequest.

func (*BulkDeleteRequest) Id

Id specifies the identifier of the document to delete.

func (*BulkDeleteRequest) IfPrimaryTerm added in v7.0.5

func (r *BulkDeleteRequest) IfPrimaryTerm(ifPrimaryTerm int64) *BulkDeleteRequest

IfPrimaryTerm indicates to only perform the delete operation if the last operation that has changed the document has the specified primary term.

func (*BulkDeleteRequest) IfSeqNo added in v7.0.5

func (r *BulkDeleteRequest) IfSeqNo(ifSeqNo int64) *BulkDeleteRequest

IfSeqNo indicates to only perform the delete operation if the last operation that has changed the document has the specified sequence number.

func (*BulkDeleteRequest) Index

func (r *BulkDeleteRequest) Index(index string) *BulkDeleteRequest

Index specifies the Elasticsearch index to use for this delete request. If unspecified, the index set on the BulkService will be used.

func (*BulkDeleteRequest) Parent

func (r *BulkDeleteRequest) Parent(parent string) *BulkDeleteRequest

Parent specifies the parent of the request, which is used in parent/child mappings.

func (*BulkDeleteRequest) Routing

func (r *BulkDeleteRequest) Routing(routing string) *BulkDeleteRequest

Routing specifies a routing value for the request.

func (*BulkDeleteRequest) Source

func (r *BulkDeleteRequest) Source() ([]string, error)

Source returns the on-wire representation of the delete request, split into an action-and-meta-data line and an (optional) source line. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html for details.

func (*BulkDeleteRequest) String

func (r *BulkDeleteRequest) String() string

String returns the on-wire representation of the delete request, concatenated as a single string.

func (*BulkDeleteRequest) Type

Type specifies the Elasticsearch type to use for this delete request. If unspecified, the type set on the BulkService will be used.

func (*BulkDeleteRequest) UseEasyJSON

func (r *BulkDeleteRequest) UseEasyJSON(enable bool) *BulkDeleteRequest

UseEasyJSON is an experimental setting that enables serialization with github.com/mailru/easyjson, which should in faster serialization time and less allocations, but removed compatibility with encoding/json, usage of unsafe etc. See https://github.com/mailru/easyjson#issues-notes-and-limitations for details. This setting is disabled by default.

func (*BulkDeleteRequest) Version

func (r *BulkDeleteRequest) Version(version int64) *BulkDeleteRequest

Version indicates the version to be deleted as part of an optimistic concurrency model.

func (*BulkDeleteRequest) VersionType

func (r *BulkDeleteRequest) VersionType(versionType string) *BulkDeleteRequest

VersionType can be "internal" (default), "external", "external_gte", or "external_gt".

type BulkIndexByScrollResponse

type BulkIndexByScrollResponse struct {
	Header           http.Header `json:"-"`
	Took             int64       `json:"took"`
	SliceId          *int64      `json:"slice_id,omitempty"`
	TimedOut         bool        `json:"timed_out"`
	Total            int64       `json:"total"`
	Updated          int64       `json:"updated,omitempty"`
	Created          int64       `json:"created,omitempty"`
	Deleted          int64       `json:"deleted"`
	Batches          int64       `json:"batches"`
	VersionConflicts int64       `json:"version_conflicts"`
	Noops            int64       `json:"noops"`
	Retries          struct {
		Bulk   int64 `json:"bulk"`
		Search int64 `json:"search"`
	} `json:"retries,omitempty"`
	Throttled            string                             `json:"throttled"`
	ThrottledMillis      int64                              `json:"throttled_millis"`
	RequestsPerSecond    float64                            `json:"requests_per_second"`
	Canceled             string                             `json:"canceled,omitempty"`
	ThrottledUntil       string                             `json:"throttled_until"`
	ThrottledUntilMillis int64                              `json:"throttled_until_millis"`
	Failures             []bulkIndexByScrollResponseFailure `json:"failures"`
}

BulkIndexByScrollResponse is the outcome of executing Do with DeleteByQueryService and UpdateByQueryService.

type BulkIndexRequest

type BulkIndexRequest struct {
	BulkableRequest
	// contains filtered or unexported fields
}

BulkIndexRequest is a request to add or replace a document to Elasticsearch.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html for details.

func NewBulkIndexRequest

func NewBulkIndexRequest() *BulkIndexRequest

NewBulkIndexRequest returns a new BulkIndexRequest. The operation type is "index" by default.

func (*BulkIndexRequest) Doc

func (r *BulkIndexRequest) Doc(doc interface{}) *BulkIndexRequest

Doc specifies the document to index.

func (*BulkIndexRequest) Id

Id specifies the identifier of the document to index.

func (*BulkIndexRequest) IfPrimaryTerm added in v7.0.5

func (r *BulkIndexRequest) IfPrimaryTerm(ifPrimaryTerm int64) *BulkIndexRequest

IfPrimaryTerm indicates to only perform the index operation if the last operation that has changed the document has the specified primary term.

func (*BulkIndexRequest) IfSeqNo added in v7.0.5

func (r *BulkIndexRequest) IfSeqNo(ifSeqNo int64) *BulkIndexRequest

IfSeqNo indicates to only perform the index operation if the last operation that has changed the document has the specified sequence number.

func (*BulkIndexRequest) Index

func (r *BulkIndexRequest) Index(index string) *BulkIndexRequest

Index specifies the Elasticsearch index to use for this index request. If unspecified, the index set on the BulkService will be used.

func (*BulkIndexRequest) OpType

func (r *BulkIndexRequest) OpType(opType string) *BulkIndexRequest

OpType specifies if this request should follow create-only or upsert behavior. This follows the OpType of the standard document index API. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-index_.html#operation-type for details.

func (*BulkIndexRequest) Parent

func (r *BulkIndexRequest) Parent(parent string) *BulkIndexRequest

Parent specifies the identifier of the parent document (if available).

func (*BulkIndexRequest) Pipeline

func (r *BulkIndexRequest) Pipeline(pipeline string) *BulkIndexRequest

Pipeline to use while processing the request.

func (*BulkIndexRequest) RetryOnConflict

func (r *BulkIndexRequest) RetryOnConflict(retryOnConflict int) *BulkIndexRequest

RetryOnConflict specifies how often to retry in case of a version conflict.

func (*BulkIndexRequest) Routing

func (r *BulkIndexRequest) Routing(routing string) *BulkIndexRequest

Routing specifies a routing value for the request.

func (*BulkIndexRequest) Source

func (r *BulkIndexRequest) Source() ([]string, error)

Source returns the on-wire representation of the index request, split into an action-and-meta-data line and an (optional) source line. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html for details.

func (*BulkIndexRequest) String

func (r *BulkIndexRequest) String() string

String returns the on-wire representation of the index request, concatenated as a single string.

func (*BulkIndexRequest) Type

Type specifies the Elasticsearch type to use for this index request. If unspecified, the type set on the BulkService will be used.

func (*BulkIndexRequest) UseEasyJSON

func (r *BulkIndexRequest) UseEasyJSON(enable bool) *BulkIndexRequest

UseEasyJSON is an experimental setting that enables serialization with github.com/mailru/easyjson, which should in faster serialization time and less allocations, but removed compatibility with encoding/json, usage of unsafe etc. See https://github.com/mailru/easyjson#issues-notes-and-limitations for details. This setting is disabled by default.

func (*BulkIndexRequest) Version

func (r *BulkIndexRequest) Version(version int64) *BulkIndexRequest

Version indicates the version of the document as part of an optimistic concurrency model.

func (*BulkIndexRequest) VersionType

func (r *BulkIndexRequest) VersionType(versionType string) *BulkIndexRequest

VersionType specifies how versions are created. It can be e.g. internal, external, external_gte, or force.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-index_.html#index-versioning for details.

type BulkProcessor

type BulkProcessor struct {
	// contains filtered or unexported fields
}

BulkProcessor encapsulates a task that accepts bulk requests and orchestrates committing them to Elasticsearch via one or more workers.

BulkProcessor is returned by setting up a BulkProcessorService and calling the Do method.

func (*BulkProcessor) Add

func (p *BulkProcessor) Add(request BulkableRequest)

Add adds a single request to commit by the BulkProcessorService.

The caller is responsible for setting the index and type on the request.

func (*BulkProcessor) Close

func (p *BulkProcessor) Close() error

Close stops the bulk processor previously started with Do. If it is already stopped, this is a no-op and nil is returned.

By implementing Close, BulkProcessor implements the io.Closer interface.

func (*BulkProcessor) Flush

func (p *BulkProcessor) Flush() error

Flush manually asks all workers to commit their outstanding requests. It returns only when all workers acknowledge completion.

func (*BulkProcessor) Start

func (p *BulkProcessor) Start(ctx context.Context) error

Start starts the bulk processor. If the processor is already started, nil is returned.

func (*BulkProcessor) Stats

func (p *BulkProcessor) Stats() BulkProcessorStats

Stats returns the latest bulk processor statistics. Collecting stats must be enabled first by calling Stats(true) on the service that created this processor.

func (*BulkProcessor) Stop

func (p *BulkProcessor) Stop() error

Stop is an alias for Close.

type BulkProcessorService

type BulkProcessorService struct {
	// contains filtered or unexported fields
}

BulkProcessorService allows to easily process bulk requests. It allows setting policies when to flush new bulk requests, e.g. based on a number of actions, on the size of the actions, and/or to flush periodically. It also allows to control the number of concurrent bulk requests allowed to be executed in parallel.

BulkProcessorService, by default, commits either every 1000 requests or when the (estimated) size of the bulk requests exceeds 5 MB. However, it does not commit periodically. BulkProcessorService also does retry by default, using an exponential backoff algorithm. It also will automatically re-enqueue items returned with a status of 408, 429, 503 or 507. You can change this behavior with RetryItemStatusCodes.

The caller is responsible for setting the index and type on every bulk request added to BulkProcessorService.

BulkProcessorService takes ideas from the BulkProcessor of the Elasticsearch Java API as documented in https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-bulk-processor.html.

func NewBulkProcessorService

func NewBulkProcessorService(client *Client) *BulkProcessorService

NewBulkProcessorService creates a new BulkProcessorService.

func (*BulkProcessorService) After

After specifies a function to be executed when bulk requests have been committed to Elasticsearch. The After callback executes both when the commit was successful as well as on failures.

func (*BulkProcessorService) Backoff

func (s *BulkProcessorService) Backoff(backoff Backoff) *BulkProcessorService

Backoff sets the backoff strategy to use for errors.

func (*BulkProcessorService) Before

Before specifies a function to be executed before bulk requests get committed to Elasticsearch.

func (*BulkProcessorService) BulkActions

func (s *BulkProcessorService) BulkActions(bulkActions int) *BulkProcessorService

BulkActions specifies when to flush based on the number of actions currently added. Defaults to 1000 and can be set to -1 to be disabled.

func (*BulkProcessorService) BulkSize

func (s *BulkProcessorService) BulkSize(bulkSize int) *BulkProcessorService

BulkSize specifies when to flush based on the size (in bytes) of the actions currently added. Defaults to 5 MB and can be set to -1 to be disabled.

func (*BulkProcessorService) Do

Do creates a new BulkProcessor and starts it. Consider the BulkProcessor as a running instance that accepts bulk requests and commits them to Elasticsearch, spreading the work across one or more workers.

You can interoperate with the BulkProcessor returned by Do, e.g. Start and Stop (or Close) it.

Context is an optional context that is passed into the bulk request service calls. In contrast to other operations, this context is used in a long running process. You could use it to pass e.g. loggers, but you shouldn't use it for cancellation.

Calling Do several times returns new BulkProcessors. You probably don't want to do this. BulkProcessorService implements just a builder pattern.

func (*BulkProcessorService) FlushInterval

func (s *BulkProcessorService) FlushInterval(interval time.Duration) *BulkProcessorService

FlushInterval specifies when to flush at the end of the given interval. This is disabled by default. If you want the bulk processor to operate completely asynchronously, set both BulkActions and BulkSize to -1 and set the FlushInterval to a meaningful interval.

func (*BulkProcessorService) Name

Name is an optional name to identify this bulk processor.

func (*BulkProcessorService) RetryItemStatusCodes

func (s *BulkProcessorService) RetryItemStatusCodes(retryItemStatusCodes ...int) *BulkProcessorService

RetryItemStatusCodes sets an array of status codes that indicate that a bulk response line item should be retried.

func (*BulkProcessorService) Stats

func (s *BulkProcessorService) Stats(wantStats bool) *BulkProcessorService

Stats tells bulk processor to gather stats while running. Use Stats to return the stats. This is disabled by default.

func (*BulkProcessorService) Workers

Workers is the number of concurrent workers allowed to be executed. Defaults to 1 and must be greater or equal to 1.

type BulkProcessorStats

type BulkProcessorStats struct {
	Flushed   int64 // number of times the flush interval has been invoked
	Committed int64 // # of times workers committed bulk requests
	Indexed   int64 // # of requests indexed
	Created   int64 // # of requests that ES reported as creates (201)
	Updated   int64 // # of requests that ES reported as updates
	Deleted   int64 // # of requests that ES reported as deletes
	Succeeded int64 // # of requests that ES reported as successful
	Failed    int64 // # of requests that ES reported as failed

	Workers []*BulkProcessorWorkerStats // stats for each worker
}

BulkProcessorStats contains various statistics of a bulk processor while it is running. Use the Stats func to return it while running.

type BulkProcessorWorkerStats

type BulkProcessorWorkerStats struct {
	Queued       int64         // # of requests queued in this worker
	LastDuration time.Duration // duration of last commit
}

BulkProcessorWorkerStats represents per-worker statistics.

type BulkResponse

type BulkResponse struct {
	Took   int                            `json:"took,omitempty"`
	Errors bool                           `json:"errors,omitempty"`
	Items  []map[string]*BulkResponseItem `json:"items,omitempty"`
}

BulkResponse is a response to a bulk execution.

Example:

{
  "took":3,
  "errors":false,
  "items":[{
    "index":{
      "_index":"index1",
      "_type":"tweet",
      "_id":"1",
      "_version":3,
      "status":201
    }
  },{
    "index":{
      "_index":"index2",
      "_type":"tweet",
      "_id":"2",
      "_version":3,
      "status":200
    }
  },{
    "delete":{
      "_index":"index1",
      "_type":"tweet",
      "_id":"1",
      "_version":4,
      "status":200,
      "found":true
    }
  },{
    "update":{
      "_index":"index2",
      "_type":"tweet",
      "_id":"2",
      "_version":4,
      "status":200
    }
  }]
}

func (*BulkResponse) ByAction

func (r *BulkResponse) ByAction(action string) []*BulkResponseItem

ByAction returns all bulk request results of a certain action, e.g. "index" or "delete".

func (*BulkResponse) ById

func (r *BulkResponse) ById(id string) []*BulkResponseItem

ById returns all bulk request results of a given document id, regardless of the action ("index", "delete" etc.).

func (*BulkResponse) Created

func (r *BulkResponse) Created() []*BulkResponseItem

Created returns all bulk request results of "create" actions.

func (*BulkResponse) Deleted

func (r *BulkResponse) Deleted() []*BulkResponseItem

Deleted returns all bulk request results of "delete" actions.

func (*BulkResponse) Failed

func (r *BulkResponse) Failed() []*BulkResponseItem

Failed returns those items of a bulk response that have errors, i.e. those that don't have a status code between 200 and 299.

func (*BulkResponse) Indexed

func (r *BulkResponse) Indexed() []*BulkResponseItem

Indexed returns all bulk request results of "index" actions.

func (*BulkResponse) Succeeded

func (r *BulkResponse) Succeeded() []*BulkResponseItem

Succeeded returns those items of a bulk response that have no errors, i.e. those have a status code between 200 and 299.

func (*BulkResponse) Updated

func (r *BulkResponse) Updated() []*BulkResponseItem

Updated returns all bulk request results of "update" actions.

type BulkResponseItem

type BulkResponseItem struct {
	Index         string        `json:"_index,omitempty"`
	Type          string        `json:"_type,omitempty"`
	Id            string        `json:"_id,omitempty"`
	Version       int64         `json:"_version,omitempty"`
	Result        string        `json:"result,omitempty"`
	Shards        *ShardsInfo   `json:"_shards,omitempty"`
	SeqNo         int64         `json:"_seq_no,omitempty"`
	PrimaryTerm   int64         `json:"_primary_term,omitempty"`
	Status        int           `json:"status,omitempty"`
	ForcedRefresh bool          `json:"forced_refresh,omitempty"`
	Error         *ErrorDetails `json:"error,omitempty"`
	GetResult     *GetResult    `json:"get,omitempty"`
}

BulkResponseItem is the result of a single bulk request.

type BulkService

type BulkService struct {
	// contains filtered or unexported fields
}

BulkService allows for batching bulk requests and sending them to Elasticsearch in one roundtrip. Use the Add method with BulkIndexRequest, BulkUpdateRequest, and BulkDeleteRequest to add bulk requests to a batch, then use Do to send them to Elasticsearch.

BulkService will be reset after each Do call. In other words, you can reuse BulkService to send many batches. You do not have to create a new BulkService for each batch.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html for more details.

func NewBulkService

func NewBulkService(client *Client) *BulkService

NewBulkService initializes a new BulkService.

func (*BulkService) Add

func (s *BulkService) Add(requests ...BulkableRequest) *BulkService

Add adds bulkable requests, i.e. BulkIndexRequest, BulkUpdateRequest, and/or BulkDeleteRequest.

func (*BulkService) Do

func (s *BulkService) Do(ctx context.Context) (*BulkResponse, error)

Do sends the batched requests to Elasticsearch. Note that, when successful, you can reuse the BulkService for the next batch as the list of bulk requests is cleared on success.

func (*BulkService) ErrorTrace added in v7.0.7

func (s *BulkService) ErrorTrace(errorTrace bool) *BulkService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*BulkService) EstimatedSizeInBytes

func (s *BulkService) EstimatedSizeInBytes() int64

EstimatedSizeInBytes returns the estimated size of all bulkable requests added via Add.

func (*BulkService) FilterPath added in v7.0.7

func (s *BulkService) FilterPath(filterPath ...string) *BulkService

FilterPath specifies a list of filters used to reduce the response.

func (*BulkService) Header added in v7.0.7

func (s *BulkService) Header(name string, value string) *BulkService

Header adds a header to the request.

func (*BulkService) Headers added in v7.0.7

func (s *BulkService) Headers(headers http.Header) *BulkService

Headers specifies the headers of the request.

func (*BulkService) Human added in v7.0.7

func (s *BulkService) Human(human bool) *BulkService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*BulkService) Index

func (s *BulkService) Index(index string) *BulkService

Index specifies the index to use for all batches. You may also leave this blank and specify the index in the individual bulk requests.

func (*BulkService) NumberOfActions

func (s *BulkService) NumberOfActions() int

NumberOfActions returns the number of bulkable requests that need to be sent to Elasticsearch on the next batch.

func (*BulkService) Pipeline

func (s *BulkService) Pipeline(pipeline string) *BulkService

Pipeline specifies the pipeline id to preprocess incoming documents with.

func (*BulkService) Pretty

func (s *BulkService) Pretty(pretty bool) *BulkService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*BulkService) Refresh

func (s *BulkService) Refresh(refresh string) *BulkService

Refresh controls when changes made by this request are made visible to search. The allowed values are: "true" (refresh the relevant primary and replica shards immediately), "wait_for" (wait for the changes to be made visible by a refresh before replying), or "false" (no refresh related actions). The default value is "false".

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-refresh.html for details.

func (*BulkService) Reset

func (s *BulkService) Reset()

Reset cleans up the request queue

func (*BulkService) Retrier

func (s *BulkService) Retrier(retrier Retrier) *BulkService

Retrier allows to set specific retry logic for this BulkService. If not specified, it will use the client's default retrier.

func (*BulkService) Routing

func (s *BulkService) Routing(routing string) *BulkService

Routing specifies the routing value.

func (*BulkService) Timeout

func (s *BulkService) Timeout(timeout string) *BulkService

Timeout is a global timeout for processing bulk requests. This is a server-side timeout, i.e. it tells Elasticsearch the time after which it should stop processing.

func (*BulkService) Type

func (s *BulkService) Type(typ string) *BulkService

Type specifies the type to use for all batches. You may also leave this blank and specify the type in the individual bulk requests.

func (*BulkService) WaitForActiveShards

func (s *BulkService) WaitForActiveShards(waitForActiveShards string) *BulkService

WaitForActiveShards sets the number of shard copies that must be active before proceeding with the bulk 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 BulkUpdateRequest

type BulkUpdateRequest struct {
	BulkableRequest
	// contains filtered or unexported fields
}

BulkUpdateRequest is a request to update a document in Elasticsearch.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html for details.

func NewBulkUpdateRequest

func NewBulkUpdateRequest() *BulkUpdateRequest

NewBulkUpdateRequest returns a new BulkUpdateRequest.

func (*BulkUpdateRequest) DetectNoop

func (r *BulkUpdateRequest) DetectNoop(detectNoop bool) *BulkUpdateRequest

DetectNoop specifies whether changes that don't affect the document should be ignored (true) or unignored (false). This is enabled by default in Elasticsearch.

func (*BulkUpdateRequest) Doc

func (r *BulkUpdateRequest) Doc(doc interface{}) *BulkUpdateRequest

Doc specifies the updated document.

func (*BulkUpdateRequest) DocAsUpsert

func (r *BulkUpdateRequest) DocAsUpsert(docAsUpsert bool) *BulkUpdateRequest

DocAsUpsert indicates whether the contents of Doc should be used as the Upsert value.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-update.html#_literal_doc_as_upsert_literal for details.

func (*BulkUpdateRequest) Id

Id specifies the identifier of the document to update.

func (*BulkUpdateRequest) IfPrimaryTerm added in v7.0.5

func (r *BulkUpdateRequest) IfPrimaryTerm(ifPrimaryTerm int64) *BulkUpdateRequest

IfPrimaryTerm indicates to only perform the index operation if the last operation that has changed the document has the specified primary term.

func (*BulkUpdateRequest) IfSeqNo added in v7.0.5

func (r *BulkUpdateRequest) IfSeqNo(ifSeqNo int64) *BulkUpdateRequest

IfSeqNo indicates to only perform the index operation if the last operation that has changed the document has the specified sequence number.

func (*BulkUpdateRequest) Index

func (r *BulkUpdateRequest) Index(index string) *BulkUpdateRequest

Index specifies the Elasticsearch index to use for this update request. If unspecified, the index set on the BulkService will be used.

func (*BulkUpdateRequest) Parent

func (r *BulkUpdateRequest) Parent(parent string) *BulkUpdateRequest

Parent specifies the identifier of the parent document (if available).

func (*BulkUpdateRequest) RetryOnConflict

func (r *BulkUpdateRequest) RetryOnConflict(retryOnConflict int) *BulkUpdateRequest

RetryOnConflict specifies how often to retry in case of a version conflict.

func (*BulkUpdateRequest) ReturnSource

func (r *BulkUpdateRequest) ReturnSource(source bool) *BulkUpdateRequest

ReturnSource specifies whether Elasticsearch should return the source after the update. In the request, this responds to the `_source` field. It is false by default.

func (*BulkUpdateRequest) Routing

func (r *BulkUpdateRequest) Routing(routing string) *BulkUpdateRequest

Routing specifies a routing value for the request.

func (*BulkUpdateRequest) ScriptedUpsert

func (r *BulkUpdateRequest) ScriptedUpsert(upsert bool) *BulkUpdateRequest

ScripedUpsert specifies if your script will run regardless of whether the document exists or not.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-update.html#_literal_scripted_upsert_literal

func (*BulkUpdateRequest) Source

func (r *BulkUpdateRequest) Source() ([]string, error)

Source returns the on-wire representation of the update request, split into an action-and-meta-data line and an (optional) source line. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html for details.

func (*BulkUpdateRequest) String

func (r *BulkUpdateRequest) String() string

String returns the on-wire representation of the update request, concatenated as a single string.

func (*BulkUpdateRequest) Type

Type specifies the Elasticsearch type to use for this update request. If unspecified, the type set on the BulkService will be used.

func (*BulkUpdateRequest) Upsert

func (r *BulkUpdateRequest) Upsert(doc interface{}) *BulkUpdateRequest

Upsert specifies the document to use for upserts. It will be used for create if the original document does not exist.

func (*BulkUpdateRequest) UseEasyJSON

func (r *BulkUpdateRequest) UseEasyJSON(enable bool) *BulkUpdateRequest

UseEasyJSON is an experimental setting that enables serialization with github.com/mailru/easyjson, which should in faster serialization time and less allocations, but removed compatibility with encoding/json, usage of unsafe etc. See https://github.com/mailru/easyjson#issues-notes-and-limitations for details. This setting is disabled by default.

func (*BulkUpdateRequest) Version

func (r *BulkUpdateRequest) Version(version int64) *BulkUpdateRequest

Version indicates the version of the document as part of an optimistic concurrency model.

func (*BulkUpdateRequest) VersionType

func (r *BulkUpdateRequest) VersionType(versionType string) *BulkUpdateRequest

VersionType can be "internal" (default), "external", "external_gte", or "external_gt".

type BulkableRequest

type BulkableRequest interface {
	fmt.Stringer
	Source() ([]string, error)
}

BulkableRequest is a generic interface to bulkable requests.

type CancelAllocationCommand

type CancelAllocationCommand struct {
	// contains filtered or unexported fields
}

CancelAllocationCommand cancels relocation, or recovery of a given shard on a node.

func NewCancelAllocationCommand

func NewCancelAllocationCommand(index string, shardId int, node string, allowPrimary bool) *CancelAllocationCommand

NewCancelAllocationCommand creates a new CancelAllocationCommand.

func (*CancelAllocationCommand) Name

func (cmd *CancelAllocationCommand) Name() string

Name of the command in a request to the Cluster Reroute API.

func (*CancelAllocationCommand) Source

func (cmd *CancelAllocationCommand) Source() (interface{}, error)

Source generates the (inner) JSON to be used when serializing the command.

type CandidateGenerator

type CandidateGenerator interface {
	Type() string
	Source() (interface{}, error)
}

type CardinalityAggregation

type CardinalityAggregation struct {
	// contains filtered or unexported fields
}

CardinalityAggregation is a single-value metrics aggregation that calculates an approximate count of distinct values. Values can be extracted either from specific fields in the document or generated by a script. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-metrics-cardinality-aggregation.html

func NewCardinalityAggregation

func NewCardinalityAggregation() *CardinalityAggregation

func (*CardinalityAggregation) Field

func (*CardinalityAggregation) Format

func (*CardinalityAggregation) Meta

func (a *CardinalityAggregation) Meta(metaData map[string]interface{}) *CardinalityAggregation

Meta sets the meta data to be included in the aggregation response.

func (*CardinalityAggregation) Missing

func (a *CardinalityAggregation) Missing(missing interface{}) *CardinalityAggregation

func (*CardinalityAggregation) PrecisionThreshold

func (a *CardinalityAggregation) PrecisionThreshold(threshold int64) *CardinalityAggregation

func (*CardinalityAggregation) Rehash

func (*CardinalityAggregation) Script

func (*CardinalityAggregation) Source

func (a *CardinalityAggregation) Source() (interface{}, error)

func (*CardinalityAggregation) SubAggregation

func (a *CardinalityAggregation) SubAggregation(name string, subAggregation Aggregation) *CardinalityAggregation

type CatAliasesResponse

type CatAliasesResponse []CatAliasesResponseRow

CatAliasesResponse is the outcome of CatAliasesService.Do.

type CatAliasesResponseRow

type CatAliasesResponseRow struct {
	// Alias name.
	Alias string `json:"alias"`
	// Index the alias points to.
	Index string `json:"index"`
	// Filter, e.g. "*" or "-".
	Filter string `json:"filter"`
	// RoutingIndex specifies the index routing (or "-").
	RoutingIndex string `json:"routing.index"`
	// RoutingSearch specifies the search routing (or "-").
	RoutingSearch string `json:"routing.search"`
	// IsWriteIndex indicates whether the index can be written to (or "-").
	IsWriteIndex string `json:"is_write_index"`
}

CatAliasesResponseRow is a single row in a CatAliasesResponse. Notice that not all of these fields might be filled; that depends on the number of columns chose in the request (see CatAliasesService.Columns).

type CatAliasesService

type CatAliasesService struct {
	// contains filtered or unexported fields
}

CatAliasesService shows information about currently configured aliases to indices including filter and routing infos.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/cat-aliases.html for details.

func NewCatAliasesService

func NewCatAliasesService(client *Client) *CatAliasesService

NewCatAliasesService creates a new CatAliasesService.

func (*CatAliasesService) Alias

func (s *CatAliasesService) Alias(alias ...string) *CatAliasesService

Alias specifies one or more aliases to which information should be returned.

func (*CatAliasesService) Columns

func (s *CatAliasesService) Columns(columns ...string) *CatAliasesService

Columns to return in the response. To get a list of all possible columns to return, run the following command in your terminal:

Example:

curl 'http://localhost:9200/_cat/aliases?help'

You can use Columns("*") to return all possible columns. That might take a little longer than the default set of columns.

func (*CatAliasesService) Do

Do executes the operation.

func (*CatAliasesService) ErrorTrace added in v7.0.7

func (s *CatAliasesService) ErrorTrace(errorTrace bool) *CatAliasesService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*CatAliasesService) FilterPath added in v7.0.7

func (s *CatAliasesService) FilterPath(filterPath ...string) *CatAliasesService

FilterPath specifies a list of filters used to reduce the response.

func (*CatAliasesService) Header added in v7.0.7

func (s *CatAliasesService) Header(name string, value string) *CatAliasesService

Header adds a header to the request.

func (*CatAliasesService) Headers added in v7.0.7

func (s *CatAliasesService) Headers(headers http.Header) *CatAliasesService

Headers specifies the headers of the request.

func (*CatAliasesService) Human added in v7.0.7

func (s *CatAliasesService) Human(human bool) *CatAliasesService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*CatAliasesService) Local

func (s *CatAliasesService) Local(local bool) *CatAliasesService

Local indicates to return local information, i.e. do not retrieve the state from master node (default: false).

func (*CatAliasesService) MasterTimeout

func (s *CatAliasesService) MasterTimeout(masterTimeout string) *CatAliasesService

MasterTimeout is the explicit operation timeout for connection to master node.

func (*CatAliasesService) Pretty

func (s *CatAliasesService) Pretty(pretty bool) *CatAliasesService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*CatAliasesService) Sort

func (s *CatAliasesService) Sort(fields ...string) *CatAliasesService

Sort is a list of fields to sort by.

type CatAllocationResponse

type CatAllocationResponse []CatAllocationResponseRow

CatAllocationResponse is the outcome of CatAllocationService.Do.

type CatAllocationResponseRow

type CatAllocationResponseRow struct {
	// Shards represents the number of shards on a node.
	Shards int `json:"shards,string"`
	// DiskIndices represents the disk used by ES indices, e.g. "46.1kb".
	DiskIndices string `json:"disk.indices"`
	// DiskUsed represents the disk used (total, not just ES), e.g. "34.5gb"
	DiskUsed string `json:"disk.used"`
	// DiskAvail represents the disk available, e.g. "53.2gb".
	DiskAvail string `json:"disk.avail"`
	// DiskTotal represents the total capacity of all volumes, e.g. "87.7gb".
	DiskTotal string `json:"disk.total"`
	// DiskPercent represents the percent of disk used, e.g. 39.
	DiskPercent int `json:"disk.percent,string"`
	// Host represents the hostname of the node.
	Host string `json:"host"`
	// IP represents the IP address of the node.
	IP string `json:"ip"`
	// Node represents the node ID.
	Node string `json:"node"`
}

CatAllocationResponseRow is a single row in a CatAllocationResponse. Notice that not all of these fields might be filled; that depends on the number of columns chose in the request (see CatAllocationService.Columns).

type CatAllocationService

type CatAllocationService struct {
	// contains filtered or unexported fields
}

CatAllocationService provides a snapshot of how many shards are allocated to each data node and how much disk space they are using.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/cat-allocation.html for details.

func NewCatAllocationService

func NewCatAllocationService(client *Client) *CatAllocationService

NewCatAllocationService creates a new CatAllocationService.

func (*CatAllocationService) Bytes

Bytes represents the unit in which to display byte values. Valid values are: "b", "k", "m", or "g".

func (*CatAllocationService) Columns

func (s *CatAllocationService) Columns(columns ...string) *CatAllocationService

Columns to return in the response. To get a list of all possible columns to return, run the following command in your terminal:

Example:

curl 'http://localhost:9200/_cat/aliases?help'

You can use Columns("*") to return all possible columns. That might take a little longer than the default set of columns.

func (*CatAllocationService) Do

Do executes the operation.

func (*CatAllocationService) ErrorTrace added in v7.0.7

func (s *CatAllocationService) ErrorTrace(errorTrace bool) *CatAllocationService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*CatAllocationService) FilterPath added in v7.0.7

func (s *CatAllocationService) FilterPath(filterPath ...string) *CatAllocationService

FilterPath specifies a list of filters used to reduce the response.

func (*CatAllocationService) Header added in v7.0.7

func (s *CatAllocationService) Header(name string, value string) *CatAllocationService

Header adds a header to the request.

func (*CatAllocationService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*CatAllocationService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*CatAllocationService) Local

Local indicates to return local information, i.e. do not retrieve the state from master node (default: false).

func (*CatAllocationService) MasterTimeout

func (s *CatAllocationService) MasterTimeout(masterTimeout string) *CatAllocationService

MasterTimeout is the explicit operation timeout for connection to master node.

func (*CatAllocationService) NodeID

func (s *CatAllocationService) NodeID(nodes ...string) *CatAllocationService

NodeID specifies one or more node IDs to for information should be returned.

func (*CatAllocationService) Pretty

func (s *CatAllocationService) Pretty(pretty bool) *CatAllocationService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*CatAllocationService) Sort

func (s *CatAllocationService) Sort(fields ...string) *CatAllocationService

Sort is a list of fields to sort by.

type CatCountResponse

type CatCountResponse []CatCountResponseRow

CatCountResponse is the outcome of CatCountService.Do.

type CatCountResponseRow

type CatCountResponseRow struct {
	Epoch     int64  `json:"epoch,string"` // e.g. 1527077996
	Timestamp string `json:"timestamp"`    // e.g. "12:19:56"
	Count     int    `json:"count,string"` // number of documents
}

CatCountResponseRow specifies the data returned for one index of a CatCountResponse. Notice that not all of these fields might be filled; that depends on the number of columns chose in the request (see CatCountService.Columns).

type CatCountService

type CatCountService struct {
	// contains filtered or unexported fields
}

CatCountService provides quick access to the document count of the entire cluster, or individual indices.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/cat-count.html for details.

func NewCatCountService

func NewCatCountService(client *Client) *CatCountService

NewCatCountService creates a new CatCountService.

func (*CatCountService) Columns

func (s *CatCountService) Columns(columns ...string) *CatCountService

Columns to return in the response. To get a list of all possible columns to return, run the following command in your terminal:

Example:

curl 'http://localhost:9200/_cat/count?help'

You can use Columns("*") to return all possible columns. That might take a little longer than the default set of columns.

func (*CatCountService) Do

Do executes the operation.

func (*CatCountService) ErrorTrace added in v7.0.7

func (s *CatCountService) ErrorTrace(errorTrace bool) *CatCountService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*CatCountService) FilterPath added in v7.0.7

func (s *CatCountService) FilterPath(filterPath ...string) *CatCountService

FilterPath specifies a list of filters used to reduce the response.

func (*CatCountService) Header added in v7.0.7

func (s *CatCountService) Header(name string, value string) *CatCountService

Header adds a header to the request.

func (*CatCountService) Headers added in v7.0.7

func (s *CatCountService) Headers(headers http.Header) *CatCountService

Headers specifies the headers of the request.

func (*CatCountService) Human added in v7.0.7

func (s *CatCountService) Human(human bool) *CatCountService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*CatCountService) Index

func (s *CatCountService) Index(index ...string) *CatCountService

Index specifies zero or more indices for which to return counts (by default counts for all indices are returned).

func (*CatCountService) Local

func (s *CatCountService) Local(local bool) *CatCountService

Local indicates to return local information, i.e. do not retrieve the state from master node (default: false).

func (*CatCountService) MasterTimeout

func (s *CatCountService) MasterTimeout(masterTimeout string) *CatCountService

MasterTimeout is the explicit operation timeout for connection to master node.

func (*CatCountService) Pretty

func (s *CatCountService) Pretty(pretty bool) *CatCountService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*CatCountService) Sort

func (s *CatCountService) Sort(fields ...string) *CatCountService

Sort is a list of fields to sort by.

type CatFielddataResponse added in v7.0.24

type CatFielddataResponse []CatFielddataResponseRow

CatFielddataResponse is the outcome of CatFielddataService.Do.

type CatFielddataResponseRow added in v7.0.24

type CatFielddataResponseRow struct {
	// Id represents the id of the fielddata.
	Id string `json:"id"`
	// Host represents the hostname of the fielddata.
	Host string `json:"host"`
	// IP represents the IP address of the fielddata.
	IP string `json:"ip"`
	// Node represents the Node name of the fielddata.
	Node string `json:"node"`
	// Field represents the name of the fielddata.
	Field string `json:"field"`
	// Size represents the size of the fielddata, e.g. "53.2gb".
	Size string `json:"size"`
}

CatFielddataResponseRow is a single row in a CatFielddataResponse. Notice that not all of these fields might be filled; that depends on the number of columns chose in the request (see CatFielddataService.Columns).

type CatFielddataService added in v7.0.24

type CatFielddataService struct {
	// contains filtered or unexported fields
}

CatFielddataService Returns the amount of heap memory currently used by the field data cache on every data node in the cluster.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.12/cat-fielddata.html for details.

func NewCatFielddataService added in v7.0.24

func NewCatFielddataService(client *Client) *CatFielddataService

NewCatFielddataService creates a new NewCatFielddataService.

func (*CatFielddataService) Bytes added in v7.0.24

Bytes represents the unit in which to display byte values. Valid values are: "b", "k", "m", or "g".

func (*CatFielddataService) Columns added in v7.0.24

func (s *CatFielddataService) Columns(columns ...string) *CatFielddataService

Columns to return in the response. To get a list of all possible columns to return, run the following command in your terminal:

Example:

curl 'http://localhost:9200/_cat/fielddata?help'

You can use Columns("*") to return all possible columns. That might take a little longer than the default set of columns.

func (*CatFielddataService) Do added in v7.0.24

Do executes the operation.

func (*CatFielddataService) ErrorTrace added in v7.0.24

func (s *CatFielddataService) ErrorTrace(errorTrace bool) *CatFielddataService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*CatFielddataService) Field added in v7.0.24

func (s *CatFielddataService) Field(fields ...string) *CatFielddataService

Fielddata specifies one or more node IDs to for information should be returned.

func (*CatFielddataService) FilterPath added in v7.0.24

func (s *CatFielddataService) FilterPath(filterPath ...string) *CatFielddataService

FilterPath specifies a list of filters used to reduce the response.

func (*CatFielddataService) Header added in v7.0.24

func (s *CatFielddataService) Header(name string, value string) *CatFielddataService

Header adds a header to the request.

func (*CatFielddataService) Headers added in v7.0.24

func (s *CatFielddataService) Headers(headers http.Header) *CatFielddataService

Headers specifies the headers of the request.

func (*CatFielddataService) Human added in v7.0.24

func (s *CatFielddataService) Human(human bool) *CatFielddataService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*CatFielddataService) Pretty added in v7.0.24

func (s *CatFielddataService) Pretty(pretty bool) *CatFielddataService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*CatFielddataService) Sort added in v7.0.24

func (s *CatFielddataService) Sort(fields ...string) *CatFielddataService

Sort is a list of fields to sort by.

type CatHealthResponse

type CatHealthResponse []CatHealthResponseRow

CatHealthResponse is the outcome of CatHealthService.Do.

type CatHealthResponseRow

type CatHealthResponseRow struct {
	Epoch               int64  `json:"epoch,string"`          // e.g. 1527077996
	Timestamp           string `json:"timestamp"`             // e.g. "12:19:56"
	Cluster             string `json:"cluster"`               // cluster name, e.g. "elasticsearch"
	Status              string `json:"status"`                // health status, e.g. "green", "yellow", or "red"
	NodeTotal           int    `json:"node.total,string"`     // total number of nodes
	NodeData            int    `json:"node.data,string"`      // number of nodes that can store data
	Shards              int    `json:"shards,string"`         // total number of shards
	Pri                 int    `json:"pri,string"`            // number of primary shards
	Relo                int    `json:"relo,string"`           // number of relocating nodes
	Init                int    `json:"init,string"`           // number of initializing nodes
	Unassign            int    `json:"unassign,string"`       // number of unassigned shards
	PendingTasks        int    `json:"pending_tasks,string"`  // number of pending tasks
	MaxTaskWaitTime     string `json:"max_task_wait_time"`    // wait time of longest task pending, e.g. "-" or time in millis
	ActiveShardsPercent string `json:"active_shards_percent"` // active number of shards in percent, e.g. "100%"
}

CatHealthResponseRow is a single row in a CatHealthResponse. Notice that not all of these fields might be filled; that depends on the number of columns chose in the request (see CatHealthService.Columns).

type CatHealthService

type CatHealthService struct {
	// contains filtered or unexported fields
}

CatHealthService returns a terse representation of the same information as /_cluster/health.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/cat-health.html for details.

func NewCatHealthService

func NewCatHealthService(client *Client) *CatHealthService

NewCatHealthService creates a new CatHealthService.

func (*CatHealthService) Columns

func (s *CatHealthService) Columns(columns ...string) *CatHealthService

Columns to return in the response. To get a list of all possible columns to return, run the following command in your terminal:

Example:

curl 'http://localhost:9200/_cat/indices?help'

You can use Columns("*") to return all possible columns. That might take a little longer than the default set of columns.

func (*CatHealthService) DisableTimestamping

func (s *CatHealthService) DisableTimestamping(disable bool) *CatHealthService

DisableTimestamping disables timestamping (default: true).

func (*CatHealthService) Do

Do executes the operation.

func (*CatHealthService) ErrorTrace added in v7.0.7

func (s *CatHealthService) ErrorTrace(errorTrace bool) *CatHealthService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*CatHealthService) FilterPath added in v7.0.7

func (s *CatHealthService) FilterPath(filterPath ...string) *CatHealthService

FilterPath specifies a list of filters used to reduce the response.

func (*CatHealthService) Header added in v7.0.7

func (s *CatHealthService) Header(name string, value string) *CatHealthService

Header adds a header to the request.

func (*CatHealthService) Headers added in v7.0.7

func (s *CatHealthService) Headers(headers http.Header) *CatHealthService

Headers specifies the headers of the request.

func (*CatHealthService) Human added in v7.0.7

func (s *CatHealthService) Human(human bool) *CatHealthService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*CatHealthService) Local

func (s *CatHealthService) Local(local bool) *CatHealthService

Local indicates to return local information, i.e. do not retrieve the state from master node (default: false).

func (*CatHealthService) MasterTimeout

func (s *CatHealthService) MasterTimeout(masterTimeout string) *CatHealthService

MasterTimeout is the explicit operation timeout for connection to master node.

func (*CatHealthService) Pretty

func (s *CatHealthService) Pretty(pretty bool) *CatHealthService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*CatHealthService) Sort

func (s *CatHealthService) Sort(fields ...string) *CatHealthService

Sort is a list of fields to sort by.

type CatIndicesResponse

type CatIndicesResponse []CatIndicesResponseRow

CatIndicesResponse is the outcome of CatIndicesService.Do.

type CatIndicesResponseRow

type CatIndicesResponseRow struct {
	Health                       string `json:"health"`                              // "green", "yellow", or "red"
	Status                       string `json:"status"`                              // "open" or "closed"
	Index                        string `json:"index"`                               // index name
	UUID                         string `json:"uuid"`                                // index uuid
	Pri                          int    `json:"pri,string"`                          // number of primary shards
	Rep                          int    `json:"rep,string"`                          // number of replica shards
	DocsCount                    int    `json:"docs.count,string"`                   // number of available documents
	DocsDeleted                  int    `json:"docs.deleted,string"`                 // number of deleted documents
	CreationDate                 int64  `json:"creation.date,string"`                // index creation date (millisecond value), e.g. 1527077221644
	CreationDateString           string `json:"creation.date.string"`                // index creation date (as string), e.g. "2018-05-23T12:07:01.644Z"
	StoreSize                    string `json:"store.size"`                          // store size of primaries & replicas, e.g. "4.6kb"
	PriStoreSize                 string `json:"pri.store.size"`                      // store size of primaries, e.g. "230b"
	CompletionSize               string `json:"completion.size"`                     // size of completion on primaries & replicas
	PriCompletionSize            string `json:"pri.completion.size"`                 // size of completion on primaries
	FielddataMemorySize          string `json:"fielddata.memory_size"`               // used fielddata cache on primaries & replicas
	PriFielddataMemorySize       string `json:"pri.fielddata.memory_size"`           // used fielddata cache on primaries
	FielddataEvictions           int    `json:"fielddata.evictions,string"`          // fielddata evictions on primaries & replicas
	PriFielddataEvictions        int    `json:"pri.fielddata.evictions,string"`      // fielddata evictions on primaries
	QueryCacheMemorySize         string `json:"query_cache.memory_size"`             // used query cache on primaries & replicas
	PriQueryCacheMemorySize      string `json:"pri.query_cache.memory_size"`         // used query cache on primaries
	QueryCacheEvictions          int    `json:"query_cache.evictions,string"`        // query cache evictions on primaries & replicas
	PriQueryCacheEvictions       int    `json:"pri.query_cache.evictions,string"`    // query cache evictions on primaries
	RequestCacheMemorySize       string `json:"request_cache.memory_size"`           // used request cache on primaries & replicas
	PriRequestCacheMemorySize    string `json:"pri.request_cache.memory_size"`       // used request cache on primaries
	RequestCacheEvictions        int    `json:"request_cache.evictions,string"`      // request cache evictions on primaries & replicas
	PriRequestCacheEvictions     int    `json:"pri.request_cache.evictions,string"`  // request cache evictions on primaries
	RequestCacheHitCount         int    `json:"request_cache.hit_count,string"`      // request cache hit count on primaries & replicas
	PriRequestCacheHitCount      int    `json:"pri.request_cache.hit_count,string"`  // request cache hit count on primaries
	RequestCacheMissCount        int    `json:"request_cache.miss_count,string"`     // request cache miss count on primaries & replicas
	PriRequestCacheMissCount     int    `json:"pri.request_cache.miss_count,string"` // request cache miss count on primaries
	FlushTotal                   int    `json:"flush.total,string"`                  // number of flushes on primaries & replicas
	PriFlushTotal                int    `json:"pri.flush.total,string"`              // number of flushes on primaries
	FlushTotalTime               string `json:"flush.total_time"`                    // time spent in flush on primaries & replicas
	PriFlushTotalTime            string `json:"pri.flush.total_time"`                // time spent in flush on primaries
	GetCurrent                   int    `json:"get.current,string"`                  // number of current get ops on primaries & replicas
	PriGetCurrent                int    `json:"pri.get.current,string"`              // number of current get ops on primaries
	GetTime                      string `json:"get.time"`                            // time spent in get on primaries & replicas
	PriGetTime                   string `json:"pri.get.time"`                        // time spent in get on primaries
	GetTotal                     int    `json:"get.total,string"`                    // number of get ops on primaries & replicas
	PriGetTotal                  int    `json:"pri.get.total,string"`                // number of get ops on primaries
	GetExistsTime                string `json:"get.exists_time"`                     // time spent in successful gets on primaries & replicas
	PriGetExistsTime             string `json:"pri.get.exists_time"`                 // time spent in successful gets on primaries
	GetExistsTotal               int    `json:"get.exists_total,string"`             // number of successful gets on primaries & replicas
	PriGetExistsTotal            int    `json:"pri.get.exists_total,string"`         // number of successful gets on primaries
	GetMissingTime               string `json:"get.missing_time"`                    // time spent in failed gets on primaries & replicas
	PriGetMissingTime            string `json:"pri.get.missing_time"`                // time spent in failed gets on primaries
	GetMissingTotal              int    `json:"get.missing_total,string"`            // number of failed gets on primaries & replicas
	PriGetMissingTotal           int    `json:"pri.get.missing_total,string"`        // number of failed gets on primaries
	IndexingDeleteCurrent        int    `json:"indexing.delete_current,string"`      // number of current deletions on primaries & replicas
	PriIndexingDeleteCurrent     int    `json:"pri.indexing.delete_current,string"`  // number of current deletions on primaries
	IndexingDeleteTime           string `json:"indexing.delete_time"`                // time spent in deletions on primaries & replicas
	PriIndexingDeleteTime        string `json:"pri.indexing.delete_time"`            // time spent in deletions on primaries
	IndexingDeleteTotal          int    `json:"indexing.delete_total,string"`        // number of delete ops on primaries & replicas
	PriIndexingDeleteTotal       int    `json:"pri.indexing.delete_total,string"`    // number of delete ops on primaries
	IndexingIndexCurrent         int    `json:"indexing.index_current,string"`       // number of current indexing on primaries & replicas
	PriIndexingIndexCurrent      int    `json:"pri.indexing.index_current,string"`   // number of current indexing on primaries
	IndexingIndexTime            string `json:"indexing.index_time"`                 // time spent in indexing on primaries & replicas
	PriIndexingIndexTime         string `json:"pri.indexing.index_time"`             // time spent in indexing on primaries
	IndexingIndexTotal           int    `json:"indexing.index_total,string"`         // number of index ops on primaries & replicas
	PriIndexingIndexTotal        int    `json:"pri.indexing.index_total,string"`     // number of index ops on primaries
	IndexingIndexFailed          int    `json:"indexing.index_failed,string"`        // number of failed indexing ops on primaries & replicas
	PriIndexingIndexFailed       int    `json:"pri.indexing.index_failed,string"`    // number of failed indexing ops on primaries
	MergesCurrent                int    `json:"merges.current,string"`               // number of current merges on primaries & replicas
	PriMergesCurrent             int    `json:"pri.merges.current,string"`           // number of current merges on primaries
	MergesCurrentDocs            int    `json:"merges.current_docs,string"`          // number of current merging docs on primaries & replicas
	PriMergesCurrentDocs         int    `json:"pri.merges.current_docs,string"`      // number of current merging docs on primaries
	MergesCurrentSize            string `json:"merges.current_size"`                 // size of current merges on primaries & replicas
	PriMergesCurrentSize         string `json:"pri.merges.current_size"`             // size of current merges on primaries
	MergesTotal                  int    `json:"merges.total,string"`                 // number of completed merge ops on primaries & replicas
	PriMergesTotal               int    `json:"pri.merges.total,string"`             // number of completed merge ops on primaries
	MergesTotalDocs              int    `json:"merges.total_docs,string"`            // docs merged on primaries & replicas
	PriMergesTotalDocs           int    `json:"pri.merges.total_docs,string"`        // docs merged on primaries
	MergesTotalSize              string `json:"merges.total_size"`                   // size merged on primaries & replicas
	PriMergesTotalSize           string `json:"pri.merges.total_size"`               // size merged on primaries
	MergesTotalTime              string `json:"merges.total_time"`                   // time spent in merges on primaries & replicas
	PriMergesTotalTime           string `json:"pri.merges.total_time"`               // time spent in merges on primaries
	RefreshTotal                 int    `json:"refresh.total,string"`                // total refreshes on primaries & replicas
	PriRefreshTotal              int    `json:"pri.refresh.total,string"`            // total refreshes on primaries
	RefreshExternalTotal         int    `json:"refresh.external_total,string"`       // total external refreshes on primaries & replicas
	PriRefreshExternalTotal      int    `json:"pri.refresh.external_total,string"`   // total external refreshes on primaries
	RefreshTime                  string `json:"refresh.time"`                        // time spent in refreshes on primaries & replicas
	PriRefreshTime               string `json:"pri.refresh.time"`                    // time spent in refreshes on primaries
	RefreshExternalTime          string `json:"refresh.external_time"`               // external time spent in refreshes on primaries & replicas
	PriRefreshExternalTime       string `json:"pri.refresh.external_time"`           // external time spent in refreshes on primaries
	RefreshListeners             int    `json:"refresh.listeners,string"`            // number of pending refresh listeners on primaries & replicas
	PriRefreshListeners          int    `json:"pri.refresh.listeners,string"`        // number of pending refresh listeners on primaries
	SearchFetchCurrent           int    `json:"search.fetch_current,string"`         // current fetch phase ops on primaries & replicas
	PriSearchFetchCurrent        int    `json:"pri.search.fetch_current,string"`     // current fetch phase ops on primaries
	SearchFetchTime              string `json:"search.fetch_time"`                   // time spent in fetch phase on primaries & replicas
	PriSearchFetchTime           string `json:"pri.search.fetch_time"`               // time spent in fetch phase on primaries
	SearchFetchTotal             int    `json:"search.fetch_total,string"`           // total fetch ops on primaries & replicas
	PriSearchFetchTotal          int    `json:"pri.search.fetch_total,string"`       // total fetch ops on primaries
	SearchOpenContexts           int    `json:"search.open_contexts,string"`         // open search contexts on primaries & replicas
	PriSearchOpenContexts        int    `json:"pri.search.open_contexts,string"`     // open search contexts on primaries
	SearchQueryCurrent           int    `json:"search.query_current,string"`         // current query phase ops on primaries & replicas
	PriSearchQueryCurrent        int    `json:"pri.search.query_current,string"`     // current query phase ops on primaries
	SearchQueryTime              string `json:"search.query_time"`                   // time spent in query phase on primaries & replicas, e.g. "0s"
	PriSearchQueryTime           string `json:"pri.search.query_time"`               // time spent in query phase on primaries, e.g. "0s"
	SearchQueryTotal             int    `json:"search.query_total,string"`           // total query phase ops on primaries & replicas
	PriSearchQueryTotal          int    `json:"pri.search.query_total,string"`       // total query phase ops on primaries
	SearchScrollCurrent          int    `json:"search.scroll_current,string"`        // open scroll contexts on primaries & replicas
	PriSearchScrollCurrent       int    `json:"pri.search.scroll_current,string"`    // open scroll contexts on primaries
	SearchScrollTime             string `json:"search.scroll_time"`                  // time scroll contexts held open on primaries & replicas, e.g. "0s"
	PriSearchScrollTime          string `json:"pri.search.scroll_time"`              // time scroll contexts held open on primaries, e.g. "0s"
	SearchScrollTotal            int    `json:"search.scroll_total,string"`          // completed scroll contexts on primaries & replicas
	PriSearchScrollTotal         int    `json:"pri.search.scroll_total,string"`      // completed scroll contexts on primaries
	SearchThrottled              bool   `json:"search.throttled,string"`             // indicates if the index is search throttled
	SegmentsCount                int    `json:"segments.count,string"`               // number of segments on primaries & replicas
	PriSegmentsCount             int    `json:"pri.segments.count,string"`           // number of segments on primaries
	SegmentsMemory               string `json:"segments.memory"`                     // memory used by segments on primaries & replicas, e.g. "1.3kb"
	PriSegmentsMemory            string `json:"pri.segments.memory"`                 // memory used by segments on primaries, e.g. "1.3kb"
	SegmentsIndexWriterMemory    string `json:"segments.index_writer_memory"`        // memory used by index writer on primaries & replicas, e.g. "0b"
	PriSegmentsIndexWriterMemory string `json:"pri.segments.index_writer_memory"`    // memory used by index writer on primaries, e.g. "0b"
	SegmentsVersionMapMemory     string `json:"segments.version_map_memory"`         // memory used by version map on primaries & replicas, e.g. "0b"
	PriSegmentsVersionMapMemory  string `json:"pri.segments.version_map_memory"`     // memory used by version map on primaries, e.g. "0b"
	SegmentsFixedBitsetMemory    string `json:"segments.fixed_bitset_memory"`        // memory used by fixed bit sets for nested object field types and type filters for types referred in _parent fields on primaries & replicas, e.g. "0b"
	PriSegmentsFixedBitsetMemory string `json:"pri.segments.fixed_bitset_memory"`    // memory used by fixed bit sets for nested object field types and type filters for types referred in _parent fields on primaries, e.g. "0b"
	WarmerCurrent                int    `json:"warmer.current,string"`               // current warmer ops on primaries & replicas
	PriWarmerCurrent             int    `json:"pri.warmer.current,string"`           // current warmer ops on primaries
	WarmerTotal                  int    `json:"warmer.total,string"`                 // total warmer ops on primaries & replicas
	PriWarmerTotal               int    `json:"pri.warmer.total,string"`             // total warmer ops on primaries
	WarmerTotalTime              string `json:"warmer.total_time"`                   // time spent in warmers on primaries & replicas, e.g. "47s"
	PriWarmerTotalTime           string `json:"pri.warmer.total_time"`               // time spent in warmers on primaries, e.g. "47s"
	SuggestCurrent               int    `json:"suggest.current,string"`              // number of current suggest ops on primaries & replicas
	PriSuggestCurrent            int    `json:"pri.suggest.current,string"`          // number of current suggest ops on primaries
	SuggestTime                  string `json:"suggest.time"`                        // time spend in suggest on primaries & replicas, "31s"
	PriSuggestTime               string `json:"pri.suggest.time"`                    // time spend in suggest on primaries, e.g. "31s"
	SuggestTotal                 int    `json:"suggest.total,string"`                // number of suggest ops on primaries & replicas
	PriSuggestTotal              int    `json:"pri.suggest.total,string"`            // number of suggest ops on primaries
	MemoryTotal                  string `json:"memory.total"`                        // total user memory on primaries & replicas, e.g. "1.5kb"
	PriMemoryTotal               string `json:"pri.memory.total"`                    // total user memory on primaries, e.g. "1.5kb"
}

CatIndicesResponseRow specifies the data returned for one index of a CatIndicesResponse. Notice that not all of these fields might be filled; that depends on the number of columns chose in the request (see CatIndicesService.Columns).

type CatIndicesService

type CatIndicesService struct {
	// contains filtered or unexported fields
}

CatIndicesService returns the list of indices plus some additional information about them.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/cat-indices.html for details.

func NewCatIndicesService

func NewCatIndicesService(client *Client) *CatIndicesService

NewCatIndicesService creates a new CatIndicesService.

func (*CatIndicesService) Bytes

func (s *CatIndicesService) Bytes(bytes string) *CatIndicesService

Bytes represents the unit in which to display byte values. Valid values are: "b", "k", "m", or "g".

func (*CatIndicesService) Columns

func (s *CatIndicesService) Columns(columns ...string) *CatIndicesService

Columns to return in the response. To get a list of all possible columns to return, run the following command in your terminal:

Example:

curl 'http://localhost:9200/_cat/indices?help'

You can use Columns("*") to return all possible columns. That might take a little longer than the default set of columns.

func (*CatIndicesService) Do

Do executes the operation.

func (*CatIndicesService) ErrorTrace added in v7.0.7

func (s *CatIndicesService) ErrorTrace(errorTrace bool) *CatIndicesService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*CatIndicesService) FilterPath added in v7.0.7

func (s *CatIndicesService) FilterPath(filterPath ...string) *CatIndicesService

FilterPath specifies a list of filters used to reduce the response.

func (*CatIndicesService) Header added in v7.0.7

func (s *CatIndicesService) Header(name string, value string) *CatIndicesService

Header adds a header to the request.

func (*CatIndicesService) Headers added in v7.0.7

func (s *CatIndicesService) Headers(headers http.Header) *CatIndicesService

Headers specifies the headers of the request.

func (*CatIndicesService) Health

func (s *CatIndicesService) Health(healthState string) *CatIndicesService

Health filters indices by their health status. Valid values are: "green", "yellow", or "red".

func (*CatIndicesService) Human added in v7.0.7

func (s *CatIndicesService) Human(human bool) *CatIndicesService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*CatIndicesService) Index

func (s *CatIndicesService) Index(index string) *CatIndicesService

Index is the name of the index to list (by default all indices are returned).

func (*CatIndicesService) Local

func (s *CatIndicesService) Local(local bool) *CatIndicesService

Local indicates to return local information, i.e. do not retrieve the state from master node (default: false).

func (*CatIndicesService) MasterTimeout

func (s *CatIndicesService) MasterTimeout(masterTimeout string) *CatIndicesService

MasterTimeout is the explicit operation timeout for connection to master node.

func (*CatIndicesService) Pretty

func (s *CatIndicesService) Pretty(pretty bool) *CatIndicesService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*CatIndicesService) PrimaryOnly

func (s *CatIndicesService) PrimaryOnly(primaryOnly bool) *CatIndicesService

PrimaryOnly when set to true returns stats only for primary shards (default: false).

func (*CatIndicesService) Sort

func (s *CatIndicesService) Sort(fields ...string) *CatIndicesService

Sort is a list of fields to sort by.

type CatMasterResponse added in v7.0.27

type CatMasterResponse []CatMasterResponseRow

CatMasterResponse is the outcome of CatMasterService.Do.

type CatMasterResponseRow added in v7.0.27

type CatMasterResponseRow struct {
	ID   string `json:"id"`
	Host string `json:"host"`
	IP   string `json:"ip"`
	Node string `json:"node"`
}

CatMasterResponseRow is a single row in a CatMasterResponse. Notice that not all of these fields might be filled; that depends on the number of columns chose in the request (see CatMasterService.Columns).

type CatMasterService added in v7.0.27

type CatMasterService struct {
	// contains filtered or unexported fields
}

CatMasterService shows information about the master node, including the ID, bound IP address, and name.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.12/cat-master.html for details.

func NewCatMasterService added in v7.0.27

func NewCatMasterService(client *Client) *CatMasterService

NewCatMasterService creates a new CatMasterService

func (*CatMasterService) Columns added in v7.0.27

func (s *CatMasterService) Columns(columns ...string) *CatMasterService

Columns to return in the response. To get a list of all possible columns to return, run the following command in your terminal:

Example:

curl 'http://localhost:9200/_cat/master?help'

You can use Columns("*") to return all possible columns. That might take a little longer than the default set of columns.

func (*CatMasterService) Do added in v7.0.27

Do executes the operation.

func (*CatMasterService) ErrorTrace added in v7.0.27

func (s *CatMasterService) ErrorTrace(errorTrace bool) *CatMasterService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*CatMasterService) FilterPath added in v7.0.27

func (s *CatMasterService) FilterPath(filterPath ...string) *CatMasterService

FilterPath specifies a list of filters used to reduce the response.

func (*CatMasterService) Header added in v7.0.27

func (s *CatMasterService) Header(name string, value string) *CatMasterService

Header adds a header to the request.

func (*CatMasterService) Headers added in v7.0.27

func (s *CatMasterService) Headers(headers http.Header) *CatMasterService

Headers specifies the headers of the request.

func (*CatMasterService) Human added in v7.0.27

func (s *CatMasterService) Human(human bool) *CatMasterService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*CatMasterService) Local added in v7.0.27

func (s *CatMasterService) Local(local bool) *CatMasterService

Local indicates to return local information, i.e. do not retrieve the state from master node (default: false).

func (*CatMasterService) MasterTimeout added in v7.0.27

func (s *CatMasterService) MasterTimeout(masterTimeout string) *CatMasterService

MasterTimeout is the explicit operation timeout for connection to master node.

func (*CatMasterService) Pretty added in v7.0.27

func (s *CatMasterService) Pretty(pretty bool) *CatMasterService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*CatMasterService) Sort added in v7.0.27

func (s *CatMasterService) Sort(fields ...string) *CatMasterService

Sort is a list of fields to sort by.

type CatShardsResponse added in v7.0.13

type CatShardsResponse []CatShardsResponseRow

CatShardsResponse is the outcome of CatShardsService.Do.

type CatShardsResponseRow added in v7.0.13

type CatShardsResponseRow struct {
	Index                     string `json:"index"`        // index name
	UUID                      string `json:"uuid"`         // index uuid
	Shard                     int    `json:"shard,string"` // shard number, e.g. 1
	Prirep                    string `json:"prirep"`       // "r" for replica, "p" for primary
	State                     string `json:"state"`        // STARTED, INITIALIZING, RELOCATING, or UNASSIGNED
	Docs                      int64  `json:"docs,string"`  // number of documents, e.g. 142847
	Store                     string `json:"store"`        // size, e.g. "40mb"
	IP                        string `json:"ip"`           // IP address
	ID                        string `json:"id"`
	Node                      string `json:"node"` // Node name
	SyncID                    string `json:"sync_id"`
	UnassignedReason          string `json:"unassigned.reason"`
	UnassignedAt              string `json:"unassigned.at"`
	UnassignedFor             string `json:"unassigned.for"`
	UnassignedDetails         string `json:"unassigned.details"`
	RecoverysourceType        string `json:"recoverysource.type"`
	CompletionSize            string `json:"completion.size"`                // size of completion on primaries & replicas
	FielddataMemorySize       string `json:"fielddata.memory_size"`          // used fielddata cache on primaries & replicas
	FielddataEvictions        int    `json:"fielddata.evictions,string"`     // fielddata evictions on primaries & replicas
	QueryCacheMemorySize      string `json:"query_cache.memory_size"`        // used query cache on primaries & replicas
	QueryCacheEvictions       int    `json:"query_cache.evictions,string"`   // query cache evictions on primaries & replicas
	FlushTotal                int    `json:"flush.total,string"`             // number of flushes on primaries & replicas
	FlushTotalTime            string `json:"flush.total_time"`               // time spent in flush on primaries & replicas
	GetCurrent                int    `json:"get.current,string"`             // number of current get ops on primaries & replicas
	GetTime                   string `json:"get.time"`                       // time spent in get on primaries & replicas
	GetTotal                  int    `json:"get.total,string"`               // number of get ops on primaries & replicas
	GetExistsTime             string `json:"get.exists_time"`                // time spent in successful gets on primaries & replicas
	GetExistsTotal            int    `json:"get.exists_total,string"`        // number of successful gets on primaries & replicas
	GetMissingTime            string `json:"get.missing_time"`               // time spent in failed gets on primaries & replicas
	GetMissingTotal           int    `json:"get.missing_total,string"`       // number of failed gets on primaries & replicas
	IndexingDeleteCurrent     int    `json:"indexing.delete_current,string"` // number of current deletions on primaries & replicas
	IndexingDeleteTime        string `json:"indexing.delete_time"`           // time spent in deletions on primaries & replicas
	IndexingDeleteTotal       int    `json:"indexing.delete_total,string"`   // number of delete ops on primaries & replicas
	IndexingIndexCurrent      int    `json:"indexing.index_current,string"`  // number of current indexing on primaries & replicas
	IndexingIndexTime         string `json:"indexing.index_time"`            // time spent in indexing on primaries & replicas
	IndexingIndexTotal        int    `json:"indexing.index_total,string"`    // number of index ops on primaries & replicas
	IndexingIndexFailed       int    `json:"indexing.index_failed,string"`   // number of failed indexing ops on primaries & replicas
	MergesCurrent             int    `json:"merges.current,string"`          // number of current merges on primaries & replicas
	MergesCurrentDocs         int    `json:"merges.current_docs,string"`     // number of current merging docs on primaries & replicas
	MergesCurrentSize         string `json:"merges.current_size"`            // size of current merges on primaries & replicas
	MergesTotal               int    `json:"merges.total,string"`            // number of completed merge ops on primaries & replicas
	MergesTotalDocs           int    `json:"merges.total_docs,string"`       // docs merged on primaries & replicas
	MergesTotalSize           string `json:"merges.total_size"`              // size merged on primaries & replicas
	MergesTotalTime           string `json:"merges.total_time"`              // time spent in merges on primaries & replicas
	RefreshTotal              int    `json:"refresh.total,string"`           // total refreshes on primaries & replicas
	RefreshExternalTotal      int    `json:"refresh.external_total,string"`  // total external refreshes on primaries & replicas
	RefreshTime               string `json:"refresh.time"`                   // time spent in refreshes on primaries & replicas
	RefreshExternalTime       string `json:"refresh.external_time"`          // external time spent in refreshes on primaries & replicas
	RefreshListeners          int    `json:"refresh.listeners,string"`       // number of pending refresh listeners on primaries & replicas
	SearchFetchCurrent        int    `json:"search.fetch_current,string"`    // current fetch phase ops on primaries & replicas
	SearchFetchTime           string `json:"search.fetch_time"`              // time spent in fetch phase on primaries & replicas
	SearchFetchTotal          int    `json:"search.fetch_total,string"`      // total fetch ops on primaries & replicas
	SearchOpenContexts        int    `json:"search.open_contexts,string"`    // open search contexts on primaries & replicas
	SearchQueryCurrent        int    `json:"search.query_current,string"`    // current query phase ops on primaries & replicas
	SearchQueryTime           string `json:"search.query_time"`              // time spent in query phase on primaries & replicas, e.g. "0s"
	SearchQueryTotal          int    `json:"search.query_total,string"`      // total query phase ops on primaries & replicas
	SearchScrollCurrent       int    `json:"search.scroll_current,string"`   // open scroll contexts on primaries & replicas
	SearchScrollTime          string `json:"search.scroll_time"`             // time scroll contexts held open on primaries & replicas, e.g. "0s"
	SearchScrollTotal         int    `json:"search.scroll_total,string"`     // completed scroll contexts on primaries & replicas
	SearchThrottled           bool   `json:"search.throttled,string"`        // indicates if the index is search throttled
	SegmentsCount             int    `json:"segments.count,string"`          // number of segments on primaries & replicas
	SegmentsMemory            string `json:"segments.memory"`                // memory used by segments on primaries & replicas, e.g. "1.3kb"
	SegmentsIndexWriterMemory string `json:"segments.index_writer_memory"`   // memory used by index writer on primaries & replicas, e.g. "0b"
	SegmentsVersionMapMemory  string `json:"segments.version_map_memory"`    // memory used by version map on primaries & replicas, e.g. "0b"
	SegmentsFixedBitsetMemory string `json:"segments.fixed_bitset_memory"`   // memory used by fixed bit sets for nested object field types and type filters for types referred in _parent fields on primaries & replicas, e.g. "0b"
	SeqNoMax                  int    `json:"seq_no.max,string"`
	SeqNoLocalCheckpoint      int    `json:"seq_no.local_checkpoint,string"`
	SeqNoGlobalCheckpoint     int    `json:"seq_no.global_checkpoint,string"`
	WarmerCurrent             int    `json:"warmer.current,string"` // current warmer ops on primaries & replicas
	WarmerTotal               int    `json:"warmer.total,string"`   // total warmer ops on primaries & replicas
	WarmerTotalTime           string `json:"warmer.total_time"`     // time spent in warmers on primaries & replicas, e.g. "47s"
	PathData                  string `json:"path.data"`
	PathState                 string `json:"path.state"`
}

CatShardsResponseRow specifies the data returned for one index of a CatShardsResponse. Notice that not all of these fields might be filled; that depends on the number of columns chose in the request (see CatShardsService.Columns).

type CatShardsService added in v7.0.13

type CatShardsService struct {
	// contains filtered or unexported fields
}

CatShardsService returns the list of shards plus some additional information about them.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.6/cat-shards.html for details.

func NewCatShardsService added in v7.0.13

func NewCatShardsService(client *Client) *CatShardsService

NewCatShardsService creates a new CatShardsService.

func (*CatShardsService) Bytes added in v7.0.13

func (s *CatShardsService) Bytes(bytes string) *CatShardsService

Bytes represents the unit in which to display byte values. Valid values are: "b", "k", "kb", "m", "mb", "g", "gb", "t", "tb", "p" or "pb".

func (*CatShardsService) Columns added in v7.0.13

func (s *CatShardsService) Columns(columns ...string) *CatShardsService

Columns to return in the response.

To get a list of all possible columns to return, run the following command in your terminal:

Example:

curl 'http://localhost:9200/_cat/shards?help'

You can use Columns("*") to return all possible columns. That might take a little longer than the default set of columns.

func (*CatShardsService) Do added in v7.0.13

Do executes the operation.

func (*CatShardsService) ErrorTrace added in v7.0.13

func (s *CatShardsService) ErrorTrace(errorTrace bool) *CatShardsService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*CatShardsService) FilterPath added in v7.0.13

func (s *CatShardsService) FilterPath(filterPath ...string) *CatShardsService

FilterPath specifies a list of filters used to reduce the response.

func (*CatShardsService) Header added in v7.0.13

func (s *CatShardsService) Header(name string, value string) *CatShardsService

Header adds a header to the request.

func (*CatShardsService) Headers added in v7.0.13

func (s *CatShardsService) Headers(headers http.Header) *CatShardsService

Headers specifies the headers of the request.

func (*CatShardsService) Human added in v7.0.13

func (s *CatShardsService) Human(human bool) *CatShardsService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*CatShardsService) Index added in v7.0.13

func (s *CatShardsService) Index(index ...string) *CatShardsService

Index is the name of the index to list (by default all indices are returned).

func (*CatShardsService) Local added in v7.0.13

func (s *CatShardsService) Local(local bool) *CatShardsService

Local indicates to return local information, i.e. do not retrieve the state from master node (default: false).

func (*CatShardsService) MasterTimeout added in v7.0.13

func (s *CatShardsService) MasterTimeout(masterTimeout string) *CatShardsService

MasterTimeout is the explicit operation timeout for connection to master node.

func (*CatShardsService) Pretty added in v7.0.13

func (s *CatShardsService) Pretty(pretty bool) *CatShardsService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*CatShardsService) Sort added in v7.0.13

func (s *CatShardsService) Sort(fields ...string) *CatShardsService

Sort is a list of fields to sort by.

func (*CatShardsService) Time added in v7.0.13

func (s *CatShardsService) Time(time string) *CatShardsService

Time specifies the way that time values are formatted with.

type CatSnapshotsResponse added in v7.0.27

type CatSnapshotsResponse []CatSnapshotsResponseRow

CatSnapshotsResponse is the outcome of CatSnapshotsService.Do.

type CatSnapshotsResponseRow added in v7.0.27

type CatSnapshotsResponseRow struct {
	ID               string `json:"id"`                // ID of the snapshot, such as "snap1".
	Repository       string `json:"repository"`        // Name of the repository, such as "repo1".
	Status           string `json:"status"`            // One of "FAILED", "INCOMPATIBLE", "IN_PROGRESS", "PARTIAL" or "SUCCESS".
	StartEpoch       string `json:"start_epoch"`       // Unix epoch time at which the snapshot process started.
	StartTime        string `json:"start_time"`        // HH:MM:SS time at which the snapshot process started.
	EndEpoch         string `json:"end_epoch"`         // Unix epoch time at which the snapshot process ended.
	EndTime          string `json:"end_time"`          // HH:MM:SS time at which the snapshot process ended.
	Duration         string `json:"duration"`          // Time it took the snapshot process to complete in time units.
	Indices          string `json:"indices"`           // Number of indices in the snapshot.
	SuccessfulShards string `json:"successful_shards"` // Number of successful shards in the snapshot.
	FailedShards     string `json:"failed_shards"`     // Number of failed shards in the snapshot.
	TotalShards      string `json:"total_shards"`      // Total number of shards in the snapshot.
	Reason           string `json:"reason"`            // Reason for any snapshot failures.
}

CatSnapshotssResponseRow specifies the data returned for one index of a CatSnapshotsResponse. Notice that not all of these fields might be filled; that depends on the number of columns chose in the request (see CatSnapshotsService.Columns).

type CatSnapshotsService added in v7.0.27

type CatSnapshotsService struct {
	// contains filtered or unexported fields
}

CatSnapshotsService returns the list of snapshots.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/cat-snapshots.html for details.

func NewCatSnapshotsService added in v7.0.27

func NewCatSnapshotsService(client *Client) *CatSnapshotsService

NewCatSnapshotsService creates a new NewCatSnapshotsService.

func (*CatSnapshotsService) Columns added in v7.0.27

func (s *CatSnapshotsService) Columns(columns ...string) *CatSnapshotsService

Columns to return in the response. To get a list of all possible columns to return, run the following command in your terminal:

Example:

curl 'http://localhost:9200/_cat/snapshots/<repository>?help'

You can use Columns("*") to return all possible columns. That might take a little longer than the default set of columns.

func (*CatSnapshotsService) Do added in v7.0.27

Do executes the operation.

func (*CatSnapshotsService) ErrorTrace added in v7.0.27

func (s *CatSnapshotsService) ErrorTrace(errorTrace bool) *CatSnapshotsService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*CatSnapshotsService) FilterPath added in v7.0.27

func (s *CatSnapshotsService) FilterPath(filterPath ...string) *CatSnapshotsService

FilterPath specifies a list of filters used to reduce the response.

func (*CatSnapshotsService) Header added in v7.0.27

func (s *CatSnapshotsService) Header(name string, value string) *CatSnapshotsService

Header adds a header to the request.

func (*CatSnapshotsService) Headers added in v7.0.27

func (s *CatSnapshotsService) Headers(headers http.Header) *CatSnapshotsService

Headers specifies the headers of the request.

func (*CatSnapshotsService) Human added in v7.0.27

func (s *CatSnapshotsService) Human(human bool) *CatSnapshotsService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*CatSnapshotsService) MasterTimeout added in v7.0.27

func (s *CatSnapshotsService) MasterTimeout(masterTimeout string) *CatSnapshotsService

MasterTimeout is the explicit operation timeout for connection to master node.

func (*CatSnapshotsService) Pretty added in v7.0.27

func (s *CatSnapshotsService) Pretty(pretty bool) *CatSnapshotsService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*CatSnapshotsService) Repository added in v7.0.27

func (s *CatSnapshotsService) Repository(repository string) *CatSnapshotsService

Repository specifies the napshot repository used to limit the request.

func (*CatSnapshotsService) Sort added in v7.0.27

func (s *CatSnapshotsService) Sort(fields ...string) *CatSnapshotsService

Sort is a list of fields to sort by.

type CharFilteredText added in v7.0.7

type CharFilteredText struct {
	Name         string   `json:"name"`
	FilteredText []string `json:"filtered_text"`
}

type ChiSquareSignificanceHeuristic

type ChiSquareSignificanceHeuristic struct {
	// contains filtered or unexported fields
}

ChiSquareSignificanceHeuristic implements Chi square as described in "Information Retrieval", Manning et al., Chapter 13.5.2.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-significantterms-aggregation.html#_chi_square for details.

func NewChiSquareSignificanceHeuristic

func NewChiSquareSignificanceHeuristic() *ChiSquareSignificanceHeuristic

NewChiSquareSignificanceHeuristic initializes a new ChiSquareSignificanceHeuristic.

func (*ChiSquareSignificanceHeuristic) BackgroundIsSuperset

func (sh *ChiSquareSignificanceHeuristic) BackgroundIsSuperset(backgroundIsSuperset bool) *ChiSquareSignificanceHeuristic

BackgroundIsSuperset indicates whether you defined a custom background filter that represents a difference set of documents that you want to compare to.

func (*ChiSquareSignificanceHeuristic) IncludeNegatives

func (sh *ChiSquareSignificanceHeuristic) IncludeNegatives(includeNegatives bool) *ChiSquareSignificanceHeuristic

IncludeNegatives indicates whether to filter out the terms that appear much less in the subset than in the background without the subset.

func (*ChiSquareSignificanceHeuristic) Name

Name returns the name of the heuristic in the REST interface.

func (*ChiSquareSignificanceHeuristic) Source

func (sh *ChiSquareSignificanceHeuristic) Source() (interface{}, error)

Source returns the parameters that need to be added to the REST parameters.

type ChildrenAggregation

type ChildrenAggregation struct {
	// contains filtered or unexported fields
}

ChildrenAggregation is a special single bucket aggregation that enables aggregating from buckets on parent document types to buckets on child documents. It is available from 1.4.0.Beta1 upwards. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-children-aggregation.html

func NewChildrenAggregation

func NewChildrenAggregation() *ChildrenAggregation

func (*ChildrenAggregation) Meta

func (a *ChildrenAggregation) Meta(metaData map[string]interface{}) *ChildrenAggregation

Meta sets the meta data to be included in the aggregation response.

func (*ChildrenAggregation) Source

func (a *ChildrenAggregation) Source() (interface{}, error)

func (*ChildrenAggregation) SubAggregation

func (a *ChildrenAggregation) SubAggregation(name string, subAggregation Aggregation) *ChildrenAggregation

func (*ChildrenAggregation) Type

type ClearScrollResponse

type ClearScrollResponse struct {
	Succeeded bool `json:"succeeded,omitempty"`
	NumFreed  int  `json:"num_freed,omitempty"`
}

ClearScrollResponse is the response of ClearScrollService.Do.

type ClearScrollService

type ClearScrollService struct {
	// contains filtered or unexported fields
}

ClearScrollService clears one or more scroll contexts by their ids.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-scroll.html#_clear_scroll_api for details.

func NewClearScrollService

func NewClearScrollService(client *Client) *ClearScrollService

NewClearScrollService creates a new ClearScrollService.

func (*ClearScrollService) Do

Do executes the operation.

func (*ClearScrollService) ErrorTrace added in v7.0.7

func (s *ClearScrollService) ErrorTrace(errorTrace bool) *ClearScrollService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*ClearScrollService) FilterPath added in v7.0.7

func (s *ClearScrollService) FilterPath(filterPath ...string) *ClearScrollService

FilterPath specifies a list of filters used to reduce the response.

func (*ClearScrollService) Header added in v7.0.7

func (s *ClearScrollService) Header(name string, value string) *ClearScrollService

Header adds a header to the request.

func (*ClearScrollService) Headers added in v7.0.7

func (s *ClearScrollService) Headers(headers http.Header) *ClearScrollService

Headers specifies the headers of the request.

func (*ClearScrollService) Human added in v7.0.7

func (s *ClearScrollService) Human(human bool) *ClearScrollService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*ClearScrollService) Pretty

func (s *ClearScrollService) Pretty(pretty bool) *ClearScrollService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*ClearScrollService) ScrollId

func (s *ClearScrollService) ScrollId(scrollIds ...string) *ClearScrollService

ScrollId is a list of scroll IDs to clear. Use _all to clear all search contexts.

func (*ClearScrollService) Validate

func (s *ClearScrollService) Validate() error

Validate checks if the operation is valid.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an Elasticsearch client. Create one by calling NewClient.

func Dial

func Dial(options ...ClientOptionFunc) (*Client, error)

Dial will call DialContext with a background context.

func DialContext

func DialContext(ctx context.Context, options ...ClientOptionFunc) (*Client, error)

DialContext will connect to Elasticsearch, just like NewClient does.

The context is honoured in terms of e.g. cancellation.

func DialWithConfig

func DialWithConfig(ctx context.Context, cfg *config.Config) (*Client, error)

DialWithConfig will use the configuration settings parsed from config package to connect to Elasticsearch.

The context is honoured in terms of e.g. cancellation.

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/7.0/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).

Example (Cluster)
// Obtain a client for an Elasticsearch cluster of two nodes,
// running on 10.0.1.1 and 10.0.1.2.
client, err := elastic.NewClient(elastic.SetURL("http://10.0.1.1:9200", "http://10.0.1.2:9200"))
if err != nil {
	// Handle error
	panic(err)
}
_ = client
Output:

Example (Default)
// Obtain a client to the Elasticsearch instance on http://127.0.0.1:9200.
client, err := elastic.NewClient()
if err != nil {
	// Handle error
	fmt.Printf("connection failed: %v\n", err)
} else {
	fmt.Println("connected")
}
_ = client
Output:

connected
Example (ManyOptions)
// Obtain a client for an Elasticsearch cluster of two nodes,
// running on 10.0.1.1 and 10.0.1.2. Do not run the sniffer.
// Set the healthcheck interval to 10s. When requests fail,
// retry 5 times. Print error messages to os.Stderr and informational
// messages to os.Stdout.
client, err := elastic.NewClient(
	elastic.SetURL("http://10.0.1.1:9200", "http://10.0.1.2:9200"),
	elastic.SetSniff(false),
	elastic.SetHealthcheckInterval(10*time.Second),
	elastic.SetMaxRetries(5),
	elastic.SetErrorLog(log.New(os.Stderr, "ELASTIC ", log.LstdFlags)),
	elastic.SetInfoLog(log.New(os.Stdout, "", log.LstdFlags)))
if err != nil {
	// Handle error
	panic(err)
}
_ = client
Output:

func NewClientFromConfig

func NewClientFromConfig(cfg *config.Config) (*Client, error)

NewClientFromConfig initializes a client from a configuration.

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

func (c *Client) Aliases() *AliasesService

Aliases returns aliases by index name(s).

func (*Client) Bulk

func (c *Client) Bulk() *BulkService

Bulk is the entry point to mass insert/update/delete documents.

func (*Client) BulkProcessor

func (c *Client) BulkProcessor() *BulkProcessorService

BulkProcessor allows setting up a concurrent processor of bulk requests.

func (*Client) CatAliases

func (c *Client) CatAliases() *CatAliasesService

CatAliases returns information about aliases.

func (*Client) CatAllocation

func (c *Client) CatAllocation() *CatAllocationService

CatAllocation returns information about the allocation across nodes.

func (*Client) CatCount

func (c *Client) CatCount() *CatCountService

CatCount returns document counts for indices.

func (*Client) CatFielddata added in v7.0.24

func (c *Client) CatFielddata() *CatFielddataService

CatFielddata returns information about the amount of heap memory currently used by the field data cache.

func (*Client) CatHealth

func (c *Client) CatHealth() *CatHealthService

CatHealth returns information about cluster health.

func (*Client) CatIndices

func (c *Client) CatIndices() *CatIndicesService

CatIndices returns information about indices.

func (*Client) CatMaster added in v7.0.27

func (c *Client) CatMaster() *CatMasterService

CatMaster returns information about the master node

func (*Client) CatShards added in v7.0.13

func (c *Client) CatShards() *CatShardsService

CatShards returns information about shards.

func (*Client) CatSnapshots added in v7.0.27

func (c *Client) CatSnapshots() *CatSnapshotsService

CatSnapshots returns information about snapshots.

func (*Client) ClearCache added in v7.0.12

func (c *Client) ClearCache(indices ...string) *IndicesClearCacheService

ClearCache clears caches for one or more indices.

func (*Client) ClearScroll

func (c *Client) ClearScroll(scrollIds ...string) *ClearScrollService

ClearScroll can be used to clear search contexts manually.

func (*Client) CloseIndex

func (c *Client) CloseIndex(name string) *IndicesCloseService

CloseIndex closes an index.

func (*Client) ClosePointInTime added in v7.0.24

func (c *Client) ClosePointInTime(id string) *ClosePointInTimeService

ClosePointInTime closes an existing Point in Time.

func (*Client) ClusterHealth

func (c *Client) ClusterHealth() *ClusterHealthService

ClusterHealth retrieves the health of the cluster.

func (*Client) ClusterReroute

func (c *Client) ClusterReroute() *ClusterRerouteService

ClusterReroute allows for manual changes to the allocation of individual shards in the cluster.

func (*Client) ClusterState

func (c *Client) ClusterState() *ClusterStateService

ClusterState retrieves the state of the cluster.

func (*Client) ClusterStats

func (c *Client) ClusterStats() *ClusterStatsService

ClusterStats retrieves cluster statistics.

func (*Client) Count

func (c *Client) Count(indices ...string) *CountService

Count documents.

func (*Client) CreateIndex

func (c *Client) CreateIndex(name string) *IndicesCreateService

CreateIndex returns a service to create a new index.

func (*Client) Delete

func (c *Client) Delete() *DeleteService

Delete a document.

func (*Client) DeleteByQuery

func (c *Client) DeleteByQuery(indices ...string) *DeleteByQueryService

DeleteByQuery deletes documents as found by a query.

func (*Client) DeleteIndex

func (c *Client) DeleteIndex(indices ...string) *IndicesDeleteService

DeleteIndex returns a service to delete an index.

func (*Client) DeleteScript

func (c *Client) DeleteScript() *DeleteScriptService

DeleteScript allows removing a stored script from Elasticsearch.

func (*Client) ElasticsearchVersion

func (c *Client) ElasticsearchVersion(url string) (string, error)

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

func (c *Client) Explain(index, typ, id string) *ExplainService

Explain computes a score explanation for a query and a specific document.

func (*Client) FieldCaps

func (c *Client) FieldCaps(indices ...string) *FieldCapsService

FieldCaps returns statistical information about fields in indices.

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

func (c *Client) Forcemerge(indices ...string) *IndicesForcemergeService

Forcemerge optimizes one or more indices. It replaces the deprecated Optimize API.

func (*Client) FreezeIndex deprecated

func (c *Client) FreezeIndex(name string) *IndicesFreezeService

FreezeIndex freezes an index.

Deprecated: Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization.

func (*Client) Get

func (c *Client) Get() *GetService

Get a document.

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

func (c *Client) GetScript() *GetScriptService

GetScript reads a stored script in Elasticsearch. Use PutScript for storing a script.

func (*Client) HasPlugin

func (c *Client) HasPlugin(name string) (bool, error)

HasPlugin indicates whether the cluster has the named plugin.

func (*Client) Index

func (c *Client) Index() *IndexService

Index a document.

func (*Client) IndexAnalyze

func (c *Client) IndexAnalyze() *IndicesAnalyzeService

IndexAnalyze performs the analysis process on a text and returns the token breakdown of the text.

func (*Client) IndexDeleteComponentTemplate added in v7.0.25

func (c *Client) IndexDeleteComponentTemplate(name string) *IndicesDeleteComponentTemplateService

IndexDeleteComponentTemplate deletes a component template (available since 7.8).

This service implements the component templates as described on https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-delete-component-template.html.

func (*Client) IndexDeleteIndexTemplate added in v7.0.22

func (c *Client) IndexDeleteIndexTemplate(name string) *IndicesDeleteIndexTemplateService

IndexDeleteIndexTemplate deletes an index template (new version after 7.8).

This service implements the new version of index templates as described on https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-delete-template.html.

See e.g. IndexPutTemplate for the v1/legacy version.

func (*Client) IndexDeleteTemplate deprecated

func (c *Client) IndexDeleteTemplate(name string) *IndicesDeleteTemplateService

IndexDeleteTemplate deletes an index template (v1/legacy version before 7.8).

This service implements the legacy version of index templates as described in https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-templates-v1.html.

See e.g. IndexPutIndexTemplate and IndexPutComponentTemplate for the new version(s).

Deprecated: Legacy index templates are deprecated in favor of composable templates.

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) IndexGetComponentTemplate added in v7.0.25

func (c *Client) IndexGetComponentTemplate(name string) *IndicesGetComponentTemplateService

IndexGetComponentTemplate returns a component template (available since 7.8).

This service implements the component templates as described on https://www.elastic.co/guide/en/elasticsearch/reference/7.10/getting-component-templates.html.

func (*Client) IndexGetIndexTemplate added in v7.0.22

func (c *Client) IndexGetIndexTemplate(name string) *IndicesGetIndexTemplateService

IndexGetIndexTemplate returns an index template (new version after 7.8).

This service implements the new version of index templates as described on https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-get-template.html.

See e.g. IndexPutTemplate for the v1/legacy version.

func (*Client) IndexGetSettings

func (c *Client) IndexGetSettings(indices ...string) *IndicesGetSettingsService

IndexGetSettings retrieves settings of all, one or more indices.

func (*Client) IndexGetTemplate deprecated

func (c *Client) IndexGetTemplate(names ...string) *IndicesGetTemplateService

IndexGetTemplate gets an index template (v1/legacy version before 7.8).

This service implements the legacy version of index templates as described in https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-templates-v1.html.

See e.g. IndexPutIndexTemplate and IndexPutComponentTemplate for the new version(s).

Deprecated: Legacy index templates are deprecated in favor of composable templates.

func (*Client) IndexNames

func (c *Client) IndexNames() ([]string, error)

IndexNames returns the names of all indices in the cluster.

func (*Client) IndexPutComponentTemplate added in v7.0.25

func (c *Client) IndexPutComponentTemplate(name string) *IndicesPutComponentTemplateService

IndexPutComponentTemplate creates or updates a component template (available since 7.8).

This service implements the component templates as described on https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-component-template.html.

func (*Client) IndexPutIndexTemplate added in v7.0.22

func (c *Client) IndexPutIndexTemplate(name string) *IndicesPutIndexTemplateService

IndexPutIndexTemplate creates or updates an index template (new version after 7.8).

This service implements the new version of index templates as described on https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-put-template.html.

See e.g. IndexPutTemplate for the v1/legacy version.

func (*Client) IndexPutSettings

func (c *Client) IndexPutSettings(indices ...string) *IndicesPutSettingsService

IndexPutSettings sets settings for all, one or more indices.

func (*Client) IndexPutTemplate deprecated

func (c *Client) IndexPutTemplate(name string) *IndicesPutTemplateService

IndexPutTemplate creates or updates an index template (v1/legacy version before 7.8).

This service implements the legacy version of index templates as described in https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-templates-v1.html.

See e.g. IndexPutIndexTemplate and IndexPutComponentTemplate for the new version(s).

Deprecated: Legacy index templates are deprecated in favor of composable templates.

func (*Client) IndexSegments

func (c *Client) IndexSegments(indices ...string) *IndicesSegmentsService

IndexSegments retrieves low level segment information for all, one or more indices.

func (*Client) IndexStats

func (c *Client) IndexStats(indices ...string) *IndicesStatsService

IndexStats provides statistics on different operations happining in one or more indices.

func (*Client) IndexTemplateExists deprecated

func (c *Client) IndexTemplateExists(name string) *IndicesExistsTemplateService

IndexTemplateExists gets check if an index template exists (v1/legacy version before 7.8).

This service implements the legacy version of index templates as described in https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-templates-v1.html.

See e.g. IndexPutIndexTemplate and IndexPutComponentTemplate for the new version(s).

Deprecated: Legacy index templates are deprecated in favor of composable templates.

func (*Client) IngestDeletePipeline

func (c *Client) IngestDeletePipeline(id string) *IngestDeletePipelineService

IngestDeletePipeline deletes a pipeline by ID.

func (*Client) IngestGetPipeline

func (c *Client) IngestGetPipeline(ids ...string) *IngestGetPipelineService

IngestGetPipeline returns pipelines based on ID.

func (*Client) IngestPutPipeline

func (c *Client) IngestPutPipeline(id string) *IngestPutPipelineService

IngestPutPipeline adds pipelines and updates existing pipelines in the cluster.

func (*Client) IngestSimulatePipeline

func (c *Client) IngestSimulatePipeline() *IngestSimulatePipelineService

IngestSimulatePipeline executes a specific pipeline against the set of documents provided in the body of the request.

func (*Client) IsRunning

func (c *Client) IsRunning() bool

IsRunning returns true if the background processes of the client are running, false otherwise.

func (*Client) Mget

func (c *Client) Mget() *MgetService

Mget retrieves multiple documents in one roundtrip.

func (*Client) MultiGet

func (c *Client) MultiGet() *MgetService

MultiGet retrieves multiple documents in one roundtrip.

func (*Client) MultiSearch

func (c *Client) MultiSearch() *MultiSearchService

MultiSearch is the entry point for multi searches.

func (*Client) MultiTermVectors

func (c *Client) MultiTermVectors() *MultiTermvectorService

MultiTermVectors returns information and statistics on terms in the fields of multiple documents.

func (*Client) NodesInfo

func (c *Client) NodesInfo() *NodesInfoService

NodesInfo retrieves one or more or all of the cluster nodes information.

func (*Client) NodesStats

func (c *Client) NodesStats() *NodesStatsService

NodesStats retrieves one or more or all of the cluster nodes statistics.

func (*Client) OpenIndex

func (c *Client) OpenIndex(name string) *IndicesOpenService

OpenIndex opens an index.

func (*Client) OpenPointInTime added in v7.0.24

func (c *Client) OpenPointInTime(indices ...string) *OpenPointInTimeService

OpenPointInTime opens a new Point in Time.

func (*Client) PerformRequest

func (c *Client) PerformRequest(ctx context.Context, opt PerformRequestOptions) (*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).

If Stream is set, the returned BodyReader field must be closed, even if PerformRequest returns an error.

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

func (c *Client) Plugins() ([]string, error)

Plugins returns the list of all registered plugins.

func (*Client) PutMapping

func (c *Client) PutMapping() *IndicesPutMappingService

PutMapping registers a mapping.

func (*Client) PutScript

func (c *Client) PutScript() *PutScriptService

PutScript allows saving a stored script in Elasticsearch.

func (*Client) Refresh

func (c *Client) Refresh(indices ...string) *RefreshService

Refresh asks Elasticsearch to refresh one or more indices.

func (*Client) Reindex

func (c *Client) Reindex() *ReindexService

Reindex copies data from a source index into a destination index.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-reindex.html for details on the Reindex API.

func (*Client) RolloverIndex

func (c *Client) RolloverIndex(alias string) *IndicesRolloverService

RolloverIndex rolls an alias over to a new index when the existing index is considered to be too large or too old.

func (*Client) Scroll

func (c *Client) Scroll(indices ...string) *ScrollService

Scroll through documents. Use this to efficiently scroll through results while returning the results to a client.

func (*Client) Search

func (c *Client) Search(indices ...string) *SearchService

Search is the entry point for searches.

func (*Client) SearchShards

func (c *Client) SearchShards(indices ...string) *SearchShardsService

SearchShards returns statistical information about nodes and shards.

func (*Client) ShrinkIndex

func (c *Client) ShrinkIndex(source, target string) *IndicesShrinkService

ShrinkIndex returns a service to shrink one index into another.

func (*Client) SnapshotCreate

func (c *Client) SnapshotCreate(repository string, snapshot string) *SnapshotCreateService

SnapshotCreate creates a snapshot.

func (*Client) SnapshotCreateRepository

func (c *Client) SnapshotCreateRepository(repository string) *SnapshotCreateRepositoryService

SnapshotCreateRepository creates or updates a snapshot repository.

func (*Client) SnapshotDelete

func (c *Client) SnapshotDelete(repository string, snapshot string) *SnapshotDeleteService

SnapshotDelete deletes a snapshot in a snapshot repository.

func (*Client) SnapshotDeleteRepository

func (c *Client) SnapshotDeleteRepository(repositories ...string) *SnapshotDeleteRepositoryService

SnapshotDeleteRepository deletes a snapshot repository.

func (*Client) SnapshotGet

func (c *Client) SnapshotGet(repository string) *SnapshotGetService

SnapshotGet lists snapshot for a repository.

func (*Client) SnapshotGetRepository

func (c *Client) SnapshotGetRepository(repositories ...string) *SnapshotGetRepositoryService

SnapshotGetRepository gets a snapshot repository.

func (*Client) SnapshotRestore added in v7.0.2

func (c *Client) SnapshotRestore(repository string, snapshot string) *SnapshotRestoreService

SnapshotRestore restores the specified indices from a given snapshot

func (*Client) SnapshotStatus added in v7.0.10

func (c *Client) SnapshotStatus() *SnapshotStatusService

SnapshotStatus returns information about the status of a snapshot.

func (*Client) SnapshotVerifyRepository

func (c *Client) SnapshotVerifyRepository(repository string) *SnapshotVerifyRepositoryService

SnapshotVerifyRepository verifies a snapshot repository.

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

func (c *Client) String() string

String returns a string representation of the client status.

func (*Client) SyncedFlush

func (c *Client) SyncedFlush(indices ...string) *IndicesSyncedFlushService

SyncedFlush performs a synced flush.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/indices-synced-flush.html for more details on synched flushes and how they differ from a normal Flush.

func (*Client) TasksCancel

func (c *Client) TasksCancel() *TasksCancelService

TasksCancel cancels tasks running on the specified nodes.

func (*Client) TasksGetTask

func (c *Client) TasksGetTask() *TasksGetTaskService

TasksGetTask retrieves a task running on the cluster.

func (*Client) TasksList

func (c *Client) TasksList() *TasksListService

TasksList retrieves the list of tasks running on the specified nodes.

func (*Client) TermVectors

func (c *Client) TermVectors(index string) *TermvectorsService

TermVectors returns information and statistics on terms in the fields of a particular document.

func (*Client) UnfreezeIndex deprecated

func (c *Client) UnfreezeIndex(name string) *IndicesUnfreezeService

UnfreezeIndex unfreezes an index.

Deprecated: Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization.

func (*Client) Update

func (c *Client) Update() *UpdateService

Update a document.

func (*Client) UpdateByQuery

func (c *Client) UpdateByQuery(indices ...string) *UpdateByQueryService

UpdateByQuery performs an update on a set of documents.

func (*Client) Validate

func (c *Client) Validate(indices ...string) *ValidateService

Validate allows a user to validate a potentially expensive query without executing it.

func (*Client) WaitForGreenStatus

func (c *Client) WaitForGreenStatus(timeout string) error

WaitForGreenStatus waits for the cluster to have the "green" status. See WaitForStatus for more details.

func (*Client) WaitForStatus

func (c *Client) WaitForStatus(status string, timeout string) error

WaitForStatus waits for the cluster to have the given status. This is a shortcut method for the ClusterHealth service.

WaitForStatus waits for the specified timeout, e.g. "10s". If the cluster will have the given state within the timeout, nil is returned. If the request timed out, ErrTimeout is returned.

func (*Client) WaitForYellowStatus

func (c *Client) WaitForYellowStatus(timeout string) error

WaitForYellowStatus waits for the cluster to have the "yellow" status. See WaitForStatus for more details.

func (*Client) XPackAsyncSearchDelete added in v7.0.22

func (c *Client) XPackAsyncSearchDelete() *XPackAsyncSearchDelete

XPackAsyncSearchDelete deletes an asynchronous search.

func (*Client) XPackAsyncSearchGet added in v7.0.22

func (c *Client) XPackAsyncSearchGet() *XPackAsyncSearchGet

XPackAsyncSearchGet retrieves the outcome of an asynchronous search.

func (*Client) XPackAsyncSearchSubmit added in v7.0.22

func (c *Client) XPackAsyncSearchSubmit() *XPackAsyncSearchSubmit

XPackAsyncSearchSubmit starts an asynchronous search.

func (*Client) XPackIlmDeleteLifecycle added in v7.0.2

func (c *Client) XPackIlmDeleteLifecycle() *XPackIlmDeleteLifecycleService

XPackIlmDeleteLifecycle deletes an ilm policy.

func (*Client) XPackIlmGetLifecycle added in v7.0.2

func (c *Client) XPackIlmGetLifecycle() *XPackIlmGetLifecycleService

XPackIlmGettLifecycle gets an ilm policy.

func (*Client) XPackIlmPutLifecycle added in v7.0.2

func (c *Client) XPackIlmPutLifecycle() *XPackIlmPutLifecycleService

XPackIlmPutLifecycle adds or modifies an ilm policy.

func (*Client) XPackInfo

func (c *Client) XPackInfo() *XPackInfoService

func (*Client) XPackRollupDelete added in v7.0.29

func (c *Client) XPackRollupDelete(jobId string) *XPackRollupDeleteService

XPackRollupDelete deletes a rollup job.

func (*Client) XPackRollupGet added in v7.0.29

func (c *Client) XPackRollupGet(jobId string) *XPackRollupGetService

XPackRollupGet gets a rollup job.

func (*Client) XPackRollupPut added in v7.0.29

func (c *Client) XPackRollupPut(jobId string) *XPackRollupPutService

XPackRollupPut creates or updates a rollup job.

func (*Client) XPackRollupStart added in v7.0.29

func (c *Client) XPackRollupStart(jobId string) *XPackRollupStartService

XPackRollupStart starts a rollup job.

func (*Client) XPackRollupStop added in v7.0.29

func (c *Client) XPackRollupStop(jobId string) *XPackRollupStopService

XPackRollupStop stops a rollup job.

func (*Client) XPackSecurityChangePassword added in v7.0.3

func (c *Client) XPackSecurityChangePassword(username string) *XPackSecurityChangePasswordService

XPackSecurityChangePassword changes the password of users in the native realm.

func (*Client) XPackSecurityDeleteRole

func (c *Client) XPackSecurityDeleteRole(roleName string) *XPackSecurityDeleteRoleService

XPackSecurityDeleteRole deletes a role.

func (*Client) XPackSecurityDeleteRoleMapping

func (c *Client) XPackSecurityDeleteRoleMapping(roleMappingName string) *XPackSecurityDeleteRoleMappingService

XPackSecurityDeleteRoleMapping deletes a role mapping.

func (*Client) XPackSecurityDeleteUser added in v7.0.9

func (c *Client) XPackSecurityDeleteUser(username string) *XPackSecurityDeleteUserService

XPackSecurityDeleteUser deletes a user.

func (*Client) XPackSecurityDisableUser added in v7.0.9

func (c *Client) XPackSecurityDisableUser(username string) *XPackSecurityDisableUserService

XPackSecurityDisableUser disables a user.

func (*Client) XPackSecurityEnableUser added in v7.0.9

func (c *Client) XPackSecurityEnableUser(username string) *XPackSecurityEnableUserService

XPackSecurityEnableUser enables a user.

func (*Client) XPackSecurityGetRole

func (c *Client) XPackSecurityGetRole(roleName string) *XPackSecurityGetRoleService

XPackSecurityGetRole gets a role.

func (*Client) XPackSecurityGetRoleMapping

func (c *Client) XPackSecurityGetRoleMapping(roleMappingName string) *XPackSecurityGetRoleMappingService

XPackSecurityGetRoleMapping gets a role mapping.

func (*Client) XPackSecurityGetUser added in v7.0.9

func (c *Client) XPackSecurityGetUser(usernames ...string) *XPackSecurityGetUserService

XPackSecurityGetUser gets details about one or more users.

func (*Client) XPackSecurityPutRole

func (c *Client) XPackSecurityPutRole(roleName string) *XPackSecurityPutRoleService

XPackSecurityPutRole adds a role.

func (*Client) XPackSecurityPutRoleMapping

func (c *Client) XPackSecurityPutRoleMapping(roleMappingName string) *XPackSecurityPutRoleMappingService

XPackSecurityPutRoleMapping adds a role mapping.

func (*Client) XPackSecurityPutUser added in v7.0.9

func (c *Client) XPackSecurityPutUser(username string) *XPackSecurityPutUserService

XPackSecurityPutUser adds or updates a user.

func (*Client) XPackWatchAck

func (c *Client) XPackWatchAck(watchId string) *XPackWatcherAckWatchService

XPackWatchAck acknowledging a watch.

func (*Client) XPackWatchActivate

func (c *Client) XPackWatchActivate(watchId string) *XPackWatcherActivateWatchService

XPackWatchActivate activates a watch.

func (*Client) XPackWatchDeactivate

func (c *Client) XPackWatchDeactivate(watchId string) *XPackWatcherDeactivateWatchService

XPackWatchDeactivate deactivates a watch.

func (*Client) XPackWatchDelete

func (c *Client) XPackWatchDelete(watchId string) *XPackWatcherDeleteWatchService

XPackWatchDelete deletes a watch.

func (*Client) XPackWatchExecute

func (c *Client) XPackWatchExecute() *XPackWatcherExecuteWatchService

XPackWatchExecute executes a watch.

func (*Client) XPackWatchGet

func (c *Client) XPackWatchGet(watchId string) *XPackWatcherGetWatchService

XPackWatchGet gets a watch.

func (*Client) XPackWatchPut

func (c *Client) XPackWatchPut(watchId string) *XPackWatcherPutWatchService

XPackWatchPut adds a watch.

func (*Client) XPackWatchStart

func (c *Client) XPackWatchStart() *XPackWatcherStartService

XPackWatchStart starts a watch.

func (*Client) XPackWatchStats

func (c *Client) XPackWatchStats() *XPackWatcherStatsService

XPackWatchStats returns the current Watcher metrics.

func (*Client) XPackWatchStop

func (c *Client) XPackWatchStop() *XPackWatcherStopService

XPackWatchStop stops a watch.

type ClientOptionFunc

type ClientOptionFunc func(*Client) error

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 SetHeaders added in v7.0.7

func SetHeaders(headers http.Header) ClientOptionFunc

SetHeaders adds a list of default HTTP headers that will be added to each requests executed by PerformRequest.

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 Doer) 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 SetRetryStatusCodes added in v7.0.22

func SetRetryStatusCodes(statusCodes ...int) ClientOptionFunc

SetRetryStatusCodes specifies the HTTP status codes where the client will retry automatically. Notice that retries call the specified retrier, so calling SetRetryStatusCodes without setting a Retrier won't do anything for retries.

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 ClosePointInTimeResponse added in v7.0.24

type ClosePointInTimeResponse struct {
	Succeeded bool `json:"succeeded,omitempty"`
	NumFreed  int  `json:"num_freed,omitempty"`
}

ClosePointInTimeResponse is the result of closing a point in time.

type ClosePointInTimeService added in v7.0.24

type ClosePointInTimeService struct {
	// contains filtered or unexported fields
}

ClosePointInTimeService removes a point in time.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.x/point-in-time-api.html for details.

func NewClosePointInTimeService added in v7.0.24

func NewClosePointInTimeService(client *Client) *ClosePointInTimeService

NewClosePointInTimeService creates a new ClosePointInTimeService.

func (*ClosePointInTimeService) BodyJson added in v7.0.24

func (s *ClosePointInTimeService) BodyJson(body interface{}) *ClosePointInTimeService

BodyJson is the document as a serializable JSON interface.

func (*ClosePointInTimeService) BodyString added in v7.0.24

BodyString is the document encoded as a string.

func (*ClosePointInTimeService) Do added in v7.0.24

Do executes the operation.

func (*ClosePointInTimeService) ErrorTrace added in v7.0.24

func (s *ClosePointInTimeService) ErrorTrace(errorTrace bool) *ClosePointInTimeService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*ClosePointInTimeService) FilterPath added in v7.0.24

func (s *ClosePointInTimeService) FilterPath(filterPath ...string) *ClosePointInTimeService

FilterPath specifies a list of filters used to reduce the response.

func (*ClosePointInTimeService) Header added in v7.0.24

Header adds a header to the request.

func (*ClosePointInTimeService) Headers added in v7.0.24

Headers specifies the headers of the request.

func (*ClosePointInTimeService) Human added in v7.0.24

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*ClosePointInTimeService) ID added in v7.0.24

ID to close.

func (*ClosePointInTimeService) Pretty added in v7.0.24

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*ClosePointInTimeService) Validate added in v7.0.24

func (s *ClosePointInTimeService) Validate() error

Validate checks if the operation is valid.

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"`
	TaskMaxWaitTimeInQueue         string  `json:"task_max_waiting_in_queue"`        // "0s"
	TaskMaxWaitTimeInQueueInMillis int     `json:"task_max_waiting_in_queue_millis"` // 0
	ActiveShardsPercent            string  `json:"active_shards_percent"`            // "100.0%"
	ActiveShardsPercentAsNumber    float64 `json:"active_shards_percent_as_number"`  // 100.0

	// 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/7.0/cluster-health.html for details.

Example
client, err := elastic.NewClient()
if err != nil {
	panic(err)
}

// Get cluster health
res, err := client.ClusterHealth().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

Do executes the operation.

func (*ClusterHealthService) ErrorTrace added in v7.0.7

func (s *ClusterHealthService) ErrorTrace(errorTrace bool) *ClusterHealthService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*ClusterHealthService) FilterPath added in v7.0.7

func (s *ClusterHealthService) FilterPath(filterPath ...string) *ClusterHealthService

FilterPath specifies a list of filters used to reduce the response.

func (*ClusterHealthService) Header added in v7.0.7

func (s *ClusterHealthService) Header(name string, value string) *ClusterHealthService

Header adds a header to the request.

func (*ClusterHealthService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*ClusterHealthService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*ClusterHealthService) Index

func (s *ClusterHealthService) Index(indices ...string) *ClusterHealthService

Index limits the information returned to specific indices.

func (*ClusterHealthService) Level

Level specifies the level of detail for returned information.

func (*ClusterHealthService) Local

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 tells Elasticsearch whether to return a formatted JSON response.

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.

Example
client, err := elastic.NewClient()
if err != nil {
	panic(err)
}

// Wait for status green
res, err := client.ClusterHealth().WaitForStatus("green").Timeout("15s").Do(context.Background())
if err != nil {
	panic(err)
}
if res.TimedOut {
	fmt.Printf("time out waiting for cluster status %q\n", "green")
} else {
	fmt.Printf("cluster status is %q\n", res.Status)
}
Output:

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"`
	// Shards by id, e.g. "0" or "1"
	Shards map[string]*ClusterShardHealth `json:"shards"`
}

ClusterIndexHealth will be returned as part of ClusterHealthResponse.

type ClusterMetadataItemUsage added in v7.0.32

type ClusterMetadataItemUsage struct {
	Indices             []string `json:"indices,omitempty"`
	DataStreams         []string `json:"data_streams,omitempty"`
	ComposableTemplates []string `json:"composable_templates,omitempty"`
}

ClusterMetadataItemUsage encapsulates the usage of a particular "thing" by something else. In Elasticsearch, this is in the org.elasticsearch.cluster.metadata package.

type ClusterRerouteResponse

type ClusterRerouteResponse struct {
	State        *ClusterStateResponse `json:"state"`
	Explanations []RerouteExplanation  `json:"explanations,omitempty"`
}

ClusterRerouteResponse is the response of ClusterRerouteService.Do.

type ClusterRerouteService

type ClusterRerouteService struct {
	// contains filtered or unexported fields
}

ClusterRerouteService allows for manual changes to the allocation of individual shards in the cluster. For example, a shard can be moved from one node to another explicitly, an allocation can be cancelled, and an unassigned shard can be explicitly allocated to a specific node.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/cluster-reroute.html for details.

func NewClusterRerouteService

func NewClusterRerouteService(client *Client) *ClusterRerouteService

NewClusterRerouteService creates a new ClusterRerouteService.

func (*ClusterRerouteService) Add

Add adds one or more commands to be executed.

func (*ClusterRerouteService) Body

func (s *ClusterRerouteService) Body(body interface{}) *ClusterRerouteService

Body specifies the body to be sent. If you specify Body, the commands passed via Add are ignored. In other words: Body takes precedence over Add.

func (*ClusterRerouteService) Do

Do executes the operation.

func (*ClusterRerouteService) DryRun

DryRun indicates whether to simulate the operation only and return the resulting state.

func (*ClusterRerouteService) ErrorTrace added in v7.0.7

func (s *ClusterRerouteService) ErrorTrace(errorTrace bool) *ClusterRerouteService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*ClusterRerouteService) Explain

func (s *ClusterRerouteService) Explain(explain bool) *ClusterRerouteService

Explain, when set to true, returns an explanation of why the commands can or cannot be executed.

func (*ClusterRerouteService) FilterPath added in v7.0.7

func (s *ClusterRerouteService) FilterPath(filterPath ...string) *ClusterRerouteService

FilterPath specifies a list of filters used to reduce the response.

func (*ClusterRerouteService) Header added in v7.0.7

func (s *ClusterRerouteService) Header(name string, value string) *ClusterRerouteService

Header adds a header to the request.

func (*ClusterRerouteService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*ClusterRerouteService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*ClusterRerouteService) MasterTimeout

func (s *ClusterRerouteService) MasterTimeout(masterTimeout string) *ClusterRerouteService

MasterTimeout specifies an explicit timeout for connection to master.

func (*ClusterRerouteService) Metric

func (s *ClusterRerouteService) Metric(metrics ...string) *ClusterRerouteService

Metric limits the information returned to the specified metric. It can be one of: "_all", "blocks", "metadata", "nodes", "routing_table", "master_node", "version". Defaults to all but metadata.

func (*ClusterRerouteService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*ClusterRerouteService) RetryFailed

func (s *ClusterRerouteService) RetryFailed(retryFailed bool) *ClusterRerouteService

RetryFailed indicates whether to retry allocation of shards that are blocked due to too many subsequent allocation failures.

func (*ClusterRerouteService) Timeout

func (s *ClusterRerouteService) Timeout(timeout string) *ClusterRerouteService

Timeout specifies an explicit operationtimeout.

func (*ClusterRerouteService) Validate

func (s *ClusterRerouteService) Validate() error

Validate checks if the operation is valid.

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 ClusterStateResponse

type ClusterStateResponse struct {
	ClusterName       string                    `json:"cluster_name"`
	ClusterUUID       string                    `json:"cluster_uuid"`
	Version           int64                     `json:"version"`
	StateUUID         string                    `json:"state_uuid"`
	MasterNode        string                    `json:"master_node"`
	Blocks            map[string]*clusterBlocks `json:"blocks"`
	Nodes             map[string]*discoveryNode `json:"nodes"`
	Metadata          *clusterStateMetadata     `json:"metadata"`
	RoutingTable      *clusterStateRoutingTable `json:"routing_table"`
	RoutingNodes      *clusterStateRoutingNode  `json:"routing_nodes"`
	Snapshots         map[string]interface{}    `json:"snapshots"`
	SnapshotDeletions map[string]interface{}    `json:"snapshot_deletions"`
	Customs           map[string]interface{}    `json:"customs"`
}

ClusterStateResponse is the response of ClusterStateService.Do.

type ClusterStateService

type ClusterStateService struct {
	// contains filtered or unexported fields
}

ClusterStateService allows to get a comprehensive state information of the whole cluster.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/cluster-state.html for details.

Example
client, err := elastic.NewClient()
if err != nil {
	panic(err)
}

// Get cluster state
res, err := client.ClusterState().Metric("version").Do(context.Background())
if err != nil {
	panic(err)
}
fmt.Printf("Cluster %q has version %d", res.ClusterName, res.Version)
Output:

func NewClusterStateService

func NewClusterStateService(client *Client) *ClusterStateService

NewClusterStateService creates a new ClusterStateService.

func (*ClusterStateService) AllowNoIndices

func (s *ClusterStateService) AllowNoIndices(allowNoIndices bool) *ClusterStateService

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 (*ClusterStateService) Do

Do executes the operation.

func (*ClusterStateService) ErrorTrace added in v7.0.7

func (s *ClusterStateService) ErrorTrace(errorTrace bool) *ClusterStateService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*ClusterStateService) ExpandWildcards

func (s *ClusterStateService) ExpandWildcards(expandWildcards string) *ClusterStateService

ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both..

func (*ClusterStateService) FilterPath added in v7.0.7

func (s *ClusterStateService) FilterPath(filterPath ...string) *ClusterStateService

FilterPath specifies a list of filters used to reduce the response.

func (*ClusterStateService) FlatSettings

func (s *ClusterStateService) FlatSettings(flatSettings bool) *ClusterStateService

FlatSettings, when set, returns settings in flat format (default: false).

func (*ClusterStateService) Header added in v7.0.7

func (s *ClusterStateService) Header(name string, value string) *ClusterStateService

Header adds a header to the request.

func (*ClusterStateService) Headers added in v7.0.7

func (s *ClusterStateService) Headers(headers http.Header) *ClusterStateService

Headers specifies the headers of the request.

func (*ClusterStateService) Human added in v7.0.7

func (s *ClusterStateService) Human(human bool) *ClusterStateService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*ClusterStateService) IgnoreUnavailable

func (s *ClusterStateService) IgnoreUnavailable(ignoreUnavailable bool) *ClusterStateService

IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).

func (*ClusterStateService) Index

func (s *ClusterStateService) Index(indices ...string) *ClusterStateService

Index is a list of index names. Use _all or an empty string to perform the operation on all indices.

func (*ClusterStateService) Local

func (s *ClusterStateService) Local(local bool) *ClusterStateService

Local indicates whether to return local information. When set, it does not retrieve the state from master node (default: false).

func (*ClusterStateService) MasterTimeout

func (s *ClusterStateService) MasterTimeout(masterTimeout string) *ClusterStateService

MasterTimeout specifies timeout for connection to master.

func (*ClusterStateService) Metric

func (s *ClusterStateService) Metric(metrics ...string) *ClusterStateService

Metric limits the information returned to the specified metric. It can be one of: version, master_node, nodes, routing_table, metadata, blocks, or customs.

func (*ClusterStateService) Pretty

func (s *ClusterStateService) Pretty(pretty bool) *ClusterStateService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*ClusterStateService) Validate

func (s *ClusterStateService) Validate() error

Validate checks if the operation is valid.

type ClusterStatsAnalysisStats added in v7.0.32

type ClusterStatsAnalysisStats struct {
	CharFilterTypes    []IndexFeatureStats `json:"char_filter_types,omitempty"`
	TokenizerTypes     []IndexFeatureStats `json:"tokenizer_types,omitempty"`
	FilterTypes        []IndexFeatureStats `json:"filter_types,omitempty"`
	AnalyzerTypes      []IndexFeatureStats `json:"analyzer_types,omitempty"`
	BuiltInCharFilters []IndexFeatureStats `json:"built_in_char_filters,omitempty"`
	BuiltInTokenizers  []IndexFeatureStats `json:"built_in_tokenizers,omitempty"`
	BuiltInFilters     []IndexFeatureStats `json:"built_in_filters,omitempty"`
	BuiltInAnalyzers   []IndexFeatureStats `json:"built_in_analyzers,omitempty"`
}

type ClusterStatsIndices

type ClusterStatsIndices struct {
	Count      int                            `json:"count"` // number of indices
	Shards     *ClusterStatsIndicesShards     `json:"shards"`
	Docs       *ClusterStatsIndicesDocs       `json:"docs"`
	Store      *ClusterStatsIndicesStore      `json:"store"`
	FieldData  *ClusterStatsIndicesFieldData  `json:"fielddata"`
	QueryCache *ClusterStatsIndicesQueryCache `json:"query_cache"`
	Completion *ClusterStatsIndicesCompletion `json:"completion"`
	Segments   *IndexStatsSegments            `json:"segments"`
	Analysis   *ClusterStatsAnalysisStats     `json:"analysis"`
	Mappings   *ClusterStatsMappingStats      `json:"mappings"`
	Versions   []*ClusterStatsVersionStats    `json:"versions"`
}

type ClusterStatsIndicesCompletion

type ClusterStatsIndicesCompletion struct {
	Size        string `json:"size"` // e.g. "61.3kb"
	SizeInBytes int64  `json:"size_in_bytes"`
	Fields      map[string]struct {
		Size        string `json:"size"` // e.g. "61.3kb"
		SizeInBytes int64  `json:"size_in_bytes"`
	} `json:"fields,omitempty"`
}

type ClusterStatsIndicesDocs

type ClusterStatsIndicesDocs struct {
	Count   int `json:"count"`
	Deleted int `json:"deleted"`
}

type ClusterStatsIndicesFieldData

type ClusterStatsIndicesFieldData struct {
	MemorySize        string `json:"memory_size"` // e.g. "61.3kb"
	MemorySizeInBytes int64  `json:"memory_size_in_bytes"`
	Evictions         int64  `json:"evictions"`
	Fields            map[string]struct {
		MemorySize        string `json:"memory_size"` // e.g. "61.3kb"
		MemorySizeInBytes int64  `json:"memory_size_in_bytes"`
	} `json:"fields,omitempty"`
}

type ClusterStatsIndicesQueryCache

type ClusterStatsIndicesQueryCache struct {
	MemorySize        string `json:"memory_size"` // e.g. "61.3kb"
	MemorySizeInBytes int64  `json:"memory_size_in_bytes"`
	TotalCount        int64  `json:"total_count"`
	HitCount          int64  `json:"hit_count"`
	MissCount         int64  `json:"miss_count"`
	CacheSize         int64  `json:"cache_size"`
	CacheCount        int64  `json:"cache_count"`
	Evictions         int64  `json:"evictions"`
}

type ClusterStatsIndicesSegmentsFile

type ClusterStatsIndicesSegmentsFile struct {
	Size        string `json:"size"` // e.g. "61.3kb"
	SizeInBytes int64  `json:"size_in_bytes"`
	Description string `json:"description,omitempty"`
}

type ClusterStatsIndicesShards

type ClusterStatsIndicesShards struct {
	Total       int                             `json:"total"`
	Primaries   int                             `json:"primaries"`
	Replication float64                         `json:"replication"`
	Index       *ClusterStatsIndicesShardsIndex `json:"index"`
}

type ClusterStatsIndicesShardsIndex

type ClusterStatsIndicesShardsIndex struct {
	Shards      *ClusterStatsIndicesShardsIndexIntMinMax     `json:"shards"`
	Primaries   *ClusterStatsIndicesShardsIndexIntMinMax     `json:"primaries"`
	Replication *ClusterStatsIndicesShardsIndexFloat64MinMax `json:"replication"`
}

type ClusterStatsIndicesShardsIndexFloat64MinMax

type ClusterStatsIndicesShardsIndexFloat64MinMax struct {
	Min float64 `json:"min"`
	Max float64 `json:"max"`
	Avg float64 `json:"avg"`
}

type ClusterStatsIndicesShardsIndexIntMinMax

type ClusterStatsIndicesShardsIndexIntMinMax struct {
	Min int     `json:"min"`
	Max int     `json:"max"`
	Avg float64 `json:"avg"`
}

type ClusterStatsIndicesStore

type ClusterStatsIndicesStore struct {
	Size                    string `json:"size"` // e.g. "5.3gb"
	SizeInBytes             int64  `json:"size_in_bytes"`
	TotalDataSetSize        string `json:"total_data_set_size,omitempty"`
	TotalDataSetSizeInBytes int64  `json:"total_data_set_size_in_bytes,omitempty"`
	Reserved                string `json:"reserved,omitempty"`
	ReservedInBytes         int64  `json:"reserved_in_bytes,omitempty"`
}

type ClusterStatsMappingStats added in v7.0.32

type ClusterStatsMappingStats struct {
	FieldTypes        []IndexFeatureStats `json:"field_types"`
	RuntimeFieldTypes []RuntimeFieldStats `json:"runtime_field_types"`
}

type ClusterStatsNodes

type ClusterStatsNodes struct {
	Count    *ClusterStatsNodesCount        `json:"count"`
	Versions []string                       `json:"versions"`
	OS       *ClusterStatsNodesOsStats      `json:"os"`
	Process  *ClusterStatsNodesProcessStats `json:"process"`
	JVM      *ClusterStatsNodesJvmStats     `json:"jvm"`
	FS       *ClusterStatsNodesFsStats      `json:"fs"`
	Plugins  []*ClusterStatsNodesPlugin     `json:"plugins"`

	NetworkTypes   *ClusterStatsNodesNetworkTypes   `json:"network_types"`
	DiscoveryTypes *ClusterStatsNodesDiscoveryTypes `json:"discovery_types"`
	PackagingTypes *ClusterStatsNodesPackagingTypes `json:"packaging_types"`

	Ingest *ClusterStatsNodesIngest `json:"ingest"`
}

type ClusterStatsNodesCount

type ClusterStatsNodesCount struct {
	Total               int `json:"total"`
	Data                int `json:"data"`
	DataCold            int `json:"data_cold"`
	DataContent         int `json:"data_content"`
	DataFrozen          int `json:"data_frozen"`
	DataHot             int `json:"data_hot"`
	DataWarm            int `json:"data_warm"`
	CoordinatingOnly    int `json:"coordinating_only"`
	Master              int `json:"master"`
	Ingest              int `json:"ingest"`
	ML                  int `json:"ml"`
	RemoteClusterClient int `json:"remote_cluster_client"`
	Transform           int `json:"transform"`
	VotingOnly          int `json:"voting_only"`
}

type ClusterStatsNodesDiscoveryTypes added in v7.0.7

type ClusterStatsNodesDiscoveryTypes interface{}

type ClusterStatsNodesFsStats

type ClusterStatsNodesFsStats struct {
	Path                 string `json:"path"`
	Mount                string `json:"mount"`
	Dev                  string `json:"dev"`
	Total                string `json:"total"` // e.g. "930.7gb"`
	TotalInBytes         int64  `json:"total_in_bytes"`
	Free                 string `json:"free"` // e.g. "930.7gb"`
	FreeInBytes          int64  `json:"free_in_bytes"`
	Available            string `json:"available"` // e.g. "930.7gb"`
	AvailableInBytes     int64  `json:"available_in_bytes"`
	DiskReads            int64  `json:"disk_reads"`
	DiskWrites           int64  `json:"disk_writes"`
	DiskIOOp             int64  `json:"disk_io_op"`
	DiskReadSize         string `json:"disk_read_size"` // e.g. "0b"`
	DiskReadSizeInBytes  int64  `json:"disk_read_size_in_bytes"`
	DiskWriteSize        string `json:"disk_write_size"` // e.g. "0b"`
	DiskWriteSizeInBytes int64  `json:"disk_write_size_in_bytes"`
	DiskIOSize           string `json:"disk_io_size"` // e.g. "0b"`
	DiskIOSizeInBytes    int64  `json:"disk_io_size_in_bytes"`
	DiskQueue            string `json:"disk_queue"`
	DiskServiceTime      string `json:"disk_service_time"`
}

type ClusterStatsNodesIngest added in v7.0.32

type ClusterStatsNodesIngest struct {
	NumberOfPipelines int                    `json:"number_of_pipelines"`
	ProcessorStats    map[string]interface{} `json:"processor_stats"`
}

type ClusterStatsNodesJvmStats

type ClusterStatsNodesJvmStats struct {
	MaxUptime         string                              `json:"max_uptime"` // e.g. "5h"
	MaxUptimeInMillis int64                               `json:"max_uptime_in_millis"`
	Versions          []*ClusterStatsNodesJvmStatsVersion `json:"versions"`
	Mem               *ClusterStatsNodesJvmStatsMem       `json:"mem"`
	Threads           int64                               `json:"threads"`
}

type ClusterStatsNodesJvmStatsMem

type ClusterStatsNodesJvmStatsMem struct {
	HeapUsed        string `json:"heap_used"`
	HeapUsedInBytes int64  `json:"heap_used_in_bytes"`
	HeapMax         string `json:"heap_max"`
	HeapMaxInBytes  int64  `json:"heap_max_in_bytes"`
}

type ClusterStatsNodesJvmStatsVersion

type ClusterStatsNodesJvmStatsVersion struct {
	Version         string `json:"version"`    // e.g. "1.8.0_45"
	VMName          string `json:"vm_name"`    // e.g. "Java HotSpot(TM) 64-Bit Server VM"
	VMVersion       string `json:"vm_version"` // e.g. "25.45-b02"
	VMVendor        string `json:"vm_vendor"`  // e.g. "Oracle Corporation"
	BundledJDK      bool   `json:"bundled_jdk"`
	UsingBundledJDK bool   `json:"using_bundled_jdk"`
	Count           int    `json:"count"`
}

type ClusterStatsNodesNetworkTypes added in v7.0.7

type ClusterStatsNodesNetworkTypes struct {
	TransportTypes map[string]interface{} `json:"transport_types"` // e.g. "netty4": 1
	HTTPTypes      map[string]interface{} `json:"http_types"`      // e.g. "netty4": 1
}

type ClusterStatsNodesOsStats

type ClusterStatsNodesOsStats struct {
	AvailableProcessors int `json:"available_processors"`
	AllocatedProcessors int `json:"allocated_processors"`
	Names               []struct {
		Name  string `json:"name"`
		Value int    `json:"count"`
	} `json:"names"`
	PrettyNames []struct {
		PrettyName string `json:"pretty_name"`
		Value      int    `json:"count"`
	} `json:"pretty_names"`
	Mem           *ClusterStatsNodesOsStatsMem `json:"mem"`
	Architectures []struct {
		Arch  string `json:"arch"`
		Count int    `json:"count"`
	} `json:"architectures"`
}

type ClusterStatsNodesOsStatsCPU

type ClusterStatsNodesOsStatsCPU struct {
	Vendor           string `json:"vendor"`
	Model            string `json:"model"`
	MHz              int    `json:"mhz"`
	TotalCores       int    `json:"total_cores"`
	TotalSockets     int    `json:"total_sockets"`
	CoresPerSocket   int    `json:"cores_per_socket"`
	CacheSize        string `json:"cache_size"` // e.g. "256b"
	CacheSizeInBytes int64  `json:"cache_size_in_bytes"`
	Count            int    `json:"count"`
}

type ClusterStatsNodesOsStatsMem

type ClusterStatsNodesOsStatsMem struct {
	Total        string `json:"total"` // e.g. "16gb"
	TotalInBytes int64  `json:"total_in_bytes"`
	Free         string `json:"free"` // e.g. "12gb"
	FreeInBytes  int64  `json:"free_in_bytes"`
	Used         string `json:"used"` // e.g. "4gb"
	UsedInBytes  int64  `json:"used_in_bytes"`
	FreePercent  int    `json:"free_percent"`
	UsedPercent  int    `json:"used_percent"`
}

type ClusterStatsNodesPackagingType added in v7.0.7

type ClusterStatsNodesPackagingType struct {
	Flavor string `json:"flavor"` // e.g. "oss"
	Type   string `json:"type"`   // e.g. "docker"
	Count  int    `json:"count"`  // e.g. 1
}

type ClusterStatsNodesPackagingTypes added in v7.0.7

type ClusterStatsNodesPackagingTypes []*ClusterStatsNodesPackagingType

type ClusterStatsNodesPlugin

type ClusterStatsNodesPlugin struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	Description string `json:"description"`
	URL         string `json:"url"`
	JVM         bool   `json:"jvm"`
	Site        bool   `json:"site"`
}

type ClusterStatsNodesProcessStats

type ClusterStatsNodesProcessStats struct {
	CPU                 *ClusterStatsNodesProcessStatsCPU                 `json:"cpu"`
	OpenFileDescriptors *ClusterStatsNodesProcessStatsOpenFileDescriptors `json:"open_file_descriptors"`
}

type ClusterStatsNodesProcessStatsCPU

type ClusterStatsNodesProcessStatsCPU struct {
	Percent float64 `json:"percent"`
}

type ClusterStatsNodesProcessStatsOpenFileDescriptors

type ClusterStatsNodesProcessStatsOpenFileDescriptors struct {
	Min int64 `json:"min"`
	Max int64 `json:"max"`
	Avg int64 `json:"avg"`
}

type ClusterStatsNodesResponse added in v7.0.26

type ClusterStatsNodesResponse struct {
	Total      int                    `json:"total"`
	Successful int                    `json:"successful"`
	Failed     int                    `json:"failed"`
	Failures   []*FailedNodeException `json:"failures,omitempty"`
}

type ClusterStatsResponse

type ClusterStatsResponse struct {
	NodesStats  *ClusterStatsNodesResponse `json:"_nodes,omitempty"`
	Timestamp   int64                      `json:"timestamp"`
	ClusterName string                     `json:"cluster_name"`
	ClusterUUID string                     `json:"cluster_uuid"`
	Status      string                     `json:"status,omitempty"` // e.g. green
	Indices     *ClusterStatsIndices       `json:"indices"`
	Nodes       *ClusterStatsNodes         `json:"nodes"`
}

ClusterStatsResponse is the response of ClusterStatsService.Do.

type ClusterStatsService

type ClusterStatsService struct {
	// contains filtered or unexported fields
}

ClusterStatsService is documented at https://www.elastic.co/guide/en/elasticsearch/reference/7.0/cluster-stats.html.

func NewClusterStatsService

func NewClusterStatsService(client *Client) *ClusterStatsService

NewClusterStatsService creates a new ClusterStatsService.

func (*ClusterStatsService) Do

Do executes the operation.

func (*ClusterStatsService) ErrorTrace added in v7.0.7

func (s *ClusterStatsService) ErrorTrace(errorTrace bool) *ClusterStatsService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*ClusterStatsService) FilterPath added in v7.0.7

func (s *ClusterStatsService) FilterPath(filterPath ...string) *ClusterStatsService

FilterPath specifies a list of filters used to reduce the response.

func (*ClusterStatsService) FlatSettings

func (s *ClusterStatsService) FlatSettings(flatSettings bool) *ClusterStatsService

FlatSettings is documented as: Return settings in flat format (default: false).

func (*ClusterStatsService) Header added in v7.0.7

func (s *ClusterStatsService) Header(name string, value string) *ClusterStatsService

Header adds a header to the request.

func (*ClusterStatsService) Headers added in v7.0.7

func (s *ClusterStatsService) Headers(headers http.Header) *ClusterStatsService

Headers specifies the headers of the request.

func (*ClusterStatsService) Human

func (s *ClusterStatsService) Human(human bool) *ClusterStatsService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*ClusterStatsService) NodeId

func (s *ClusterStatsService) NodeId(nodeId []string) *ClusterStatsService

NodeId is documented as: A comma-separated 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 (*ClusterStatsService) Pretty

func (s *ClusterStatsService) Pretty(pretty bool) *ClusterStatsService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*ClusterStatsService) Validate

func (s *ClusterStatsService) Validate() error

Validate checks if the operation is valid.

type ClusterStatsVersionStats added in v7.0.32

type ClusterStatsVersionStats struct {
	Version           string `json:"version"`
	IndexCount        int    `json:"index_count"`
	PrimaryShardCount int    `json:"primary_shard_count"`
	TotalPrimarySize  string `json:"total_primary_size,omitempty"`
	TotalPrimaryBytes int64  `json:"total_primary_bytes,omitempty"`
}

type CollapseBuilder

type CollapseBuilder struct {
	// contains filtered or unexported fields
}

CollapseBuilder enables field collapsing on a search request. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-collapse.html for details.

func NewCollapseBuilder

func NewCollapseBuilder(field string) *CollapseBuilder

NewCollapseBuilder creates a new CollapseBuilder.

func (*CollapseBuilder) Field

func (b *CollapseBuilder) Field(field string) *CollapseBuilder

Field to collapse.

func (*CollapseBuilder) InnerHit

func (b *CollapseBuilder) InnerHit(innerHits ...*InnerHit) *CollapseBuilder

InnerHit option to expand the collapsed results.

func (*CollapseBuilder) MaxConcurrentGroupRequests

func (b *CollapseBuilder) MaxConcurrentGroupRequests(max int) *CollapseBuilder

MaxConcurrentGroupRequests is the maximum number of group requests that are allowed to be ran concurrently in the inner_hits phase.

func (*CollapseBuilder) Source

func (b *CollapseBuilder) Source() (interface{}, error)

Source generates the JSON serializable fragment for the CollapseBuilder.

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 CombinedFieldsQuery added in v7.0.27

type CombinedFieldsQuery struct {
	// contains filtered or unexported fields
}

CombinedFieldsQuery supports searching multiple text fields as if their contents had been indexed into one combined field.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.13/query-dsl-combined-fields-query.html

func NewCombinedFieldsQuery added in v7.0.27

func NewCombinedFieldsQuery(text interface{}, fields ...string) *CombinedFieldsQuery

NewCombinedFieldsQuery creates and initializes a new CombinedFieldsQuery.

func (*CombinedFieldsQuery) AutoGenerateSynonymsPhraseQuery added in v7.0.27

func (q *CombinedFieldsQuery) AutoGenerateSynonymsPhraseQuery(enable bool) *CombinedFieldsQuery

AutoGenerateSynonymsPhraseQuery indicates whether phrase queries should be automatically generated for multi terms synonyms. Defaults to true.

func (*CombinedFieldsQuery) Field added in v7.0.27

Field adds a field to run the multi match against.

func (*CombinedFieldsQuery) FieldWithBoost added in v7.0.27

func (q *CombinedFieldsQuery) FieldWithBoost(field string, boost float64) *CombinedFieldsQuery

FieldWithBoost adds a field to run the multi match against with a specific boost.

func (*CombinedFieldsQuery) MinimumShouldMatch added in v7.0.27

func (q *CombinedFieldsQuery) MinimumShouldMatch(minimumShouldMatch string) *CombinedFieldsQuery

MinimumShouldMatch represents the minimum number of optional should clauses to match.

func (*CombinedFieldsQuery) Operator added in v7.0.27

func (q *CombinedFieldsQuery) Operator(operator string) *CombinedFieldsQuery

Operator sets the operator to use when using boolean query. It can be either AND or OR (default).

func (*CombinedFieldsQuery) Source added in v7.0.27

func (q *CombinedFieldsQuery) Source() (interface{}, error)

Source returns JSON for the query.

func (*CombinedFieldsQuery) ZeroTermsQuery added in v7.0.27

func (q *CombinedFieldsQuery) ZeroTermsQuery(zeroTermsQuery string) *CombinedFieldsQuery

ZeroTermsQuery can be "all" or "none".

type CommonTermsQuery deprecated

type CommonTermsQuery struct {
	Query
	// contains filtered or unexported fields
}

CommonTermsQuery is a modern alternative to stopwords which improves the precision and recall of search results (by taking stopwords into account), without sacrificing performance. For more details, see: https://www.elastic.co/guide/en/elasticsearch/reference/7.4/query-dsl-common-terms-query.html

Deprecated: Use Match query instead (7.3.0+), which skips blocks of documents efficiently, without any configuration, provided that the total number of hits is not tracked.

func NewCommonTermsQuery deprecated

func NewCommonTermsQuery(name string, text interface{}) *CommonTermsQuery

NewCommonTermsQuery creates and initializes a new common terms query.

Deprecated: Common Terms Query was deprecated in >= 7.3.0. See https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-common-terms-query.html.

func (*CommonTermsQuery) Analyzer

func (q *CommonTermsQuery) Analyzer(analyzer string) *CommonTermsQuery

func (*CommonTermsQuery) Boost

func (q *CommonTermsQuery) Boost(boost float64) *CommonTermsQuery

func (*CommonTermsQuery) CutoffFrequency

func (q *CommonTermsQuery) CutoffFrequency(f float64) *CommonTermsQuery

func (*CommonTermsQuery) HighFreq

func (q *CommonTermsQuery) HighFreq(f float64) *CommonTermsQuery

func (*CommonTermsQuery) HighFreqMinimumShouldMatch

func (q *CommonTermsQuery) HighFreqMinimumShouldMatch(minShouldMatch string) *CommonTermsQuery

func (*CommonTermsQuery) HighFreqOperator

func (q *CommonTermsQuery) HighFreqOperator(op string) *CommonTermsQuery

func (*CommonTermsQuery) LowFreq

func (q *CommonTermsQuery) LowFreq(f float64) *CommonTermsQuery

func (*CommonTermsQuery) LowFreqMinimumShouldMatch

func (q *CommonTermsQuery) LowFreqMinimumShouldMatch(minShouldMatch string) *CommonTermsQuery

func (*CommonTermsQuery) LowFreqOperator

func (q *CommonTermsQuery) LowFreqOperator(op string) *CommonTermsQuery

func (*CommonTermsQuery) QueryName

func (q *CommonTermsQuery) QueryName(queryName string) *CommonTermsQuery

func (*CommonTermsQuery) Source

func (q *CommonTermsQuery) Source() (interface{}, error)

Creates the query source for the common query.

type CompletionSuggester

type CompletionSuggester struct {
	Suggester
	// contains filtered or unexported fields
}

CompletionSuggester is a fast suggester for e.g. type-ahead completion.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-suggesters-completion.html for more details.

func NewCompletionSuggester

func NewCompletionSuggester(name string) *CompletionSuggester

Creates a new completion suggester.

func (*CompletionSuggester) Analyzer

func (q *CompletionSuggester) Analyzer(analyzer string) *CompletionSuggester

func (*CompletionSuggester) ContextQueries

func (q *CompletionSuggester) ContextQueries(queries ...SuggesterContextQuery) *CompletionSuggester

func (*CompletionSuggester) ContextQuery

func (*CompletionSuggester) Field

func (*CompletionSuggester) Fuzziness

func (q *CompletionSuggester) Fuzziness(fuzziness interface{}) *CompletionSuggester

func (*CompletionSuggester) FuzzyOptions

func (*CompletionSuggester) Name

func (q *CompletionSuggester) Name() string

func (*CompletionSuggester) Prefix

func (q *CompletionSuggester) Prefix(prefix string) *CompletionSuggester

func (*CompletionSuggester) PrefixWithEditDistance

func (q *CompletionSuggester) PrefixWithEditDistance(prefix string, editDistance interface{}) *CompletionSuggester

func (*CompletionSuggester) PrefixWithOptions

func (q *CompletionSuggester) PrefixWithOptions(prefix string, options *FuzzyCompletionSuggesterOptions) *CompletionSuggester

func (*CompletionSuggester) Regex

func (*CompletionSuggester) RegexOptions

func (*CompletionSuggester) RegexWithOptions

func (q *CompletionSuggester) RegexWithOptions(regex string, options *RegexCompletionSuggesterOptions) *CompletionSuggester

func (*CompletionSuggester) ShardSize

func (q *CompletionSuggester) ShardSize(shardSize int) *CompletionSuggester

func (*CompletionSuggester) Size

func (*CompletionSuggester) SkipDuplicates

func (q *CompletionSuggester) SkipDuplicates(skipDuplicates bool) *CompletionSuggester

func (*CompletionSuggester) Source

func (q *CompletionSuggester) Source(includeName bool) (interface{}, error)

Source creates the JSON data for the completion suggester.

func (*CompletionSuggester) Text

type CompositeAggregation

type CompositeAggregation struct {
	// contains filtered or unexported fields
}

CompositeAggregation is a multi-bucket values source based aggregation that can be used to calculate unique composite values from source documents.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-composite-aggregation.html for details.

func NewCompositeAggregation

func NewCompositeAggregation() *CompositeAggregation

NewCompositeAggregation creates a new CompositeAggregation.

func (*CompositeAggregation) AggregateAfter

func (a *CompositeAggregation) AggregateAfter(after map[string]interface{}) *CompositeAggregation

AggregateAfter sets the values that indicate which composite bucket this request should "aggregate after".

func (*CompositeAggregation) Meta

func (a *CompositeAggregation) Meta(metaData map[string]interface{}) *CompositeAggregation

Meta sets the meta data to be included in the aggregation response.

func (*CompositeAggregation) Size

Size represents the number of composite buckets to return. Defaults to 10 as of Elasticsearch 6.1.

func (*CompositeAggregation) Source

func (a *CompositeAggregation) Source() (interface{}, error)

Source returns the serializable JSON for this aggregation.

func (*CompositeAggregation) Sources

Sources specifies the list of CompositeAggregationValuesSource instances to use in the aggregation.

func (*CompositeAggregation) SubAggregation

func (a *CompositeAggregation) SubAggregation(name string, subAggregation Aggregation) *CompositeAggregation

SubAggregations of this aggregation.

type CompositeAggregationDateHistogramValuesSource

type CompositeAggregationDateHistogramValuesSource struct {
	// contains filtered or unexported fields
}

CompositeAggregationDateHistogramValuesSource is a source for the CompositeAggregation that handles date histograms it works very similar to a date histogram aggregation with slightly different syntax

See https://www.elastic.co/guide/en/elasticsearch/reference/7.4/search-aggregations-bucket-composite-aggregation.html#_date_histogram for details.

func NewCompositeAggregationDateHistogramValuesSource

func NewCompositeAggregationDateHistogramValuesSource(name string) *CompositeAggregationDateHistogramValuesSource

NewCompositeAggregationDateHistogramValuesSource creates and initializes a new CompositeAggregationDateHistogramValuesSource.

func (*CompositeAggregationDateHistogramValuesSource) Asc

Asc ensures the order of the values produced is ascending.

func (*CompositeAggregationDateHistogramValuesSource) CalendarInterval added in v7.0.7

func (a *CompositeAggregationDateHistogramValuesSource) CalendarInterval(calendarInterval interface{}) *CompositeAggregationDateHistogramValuesSource

CalendarInterval to use for the date histogram, e.g. "1d" or a numeric value like "60".

func (*CompositeAggregationDateHistogramValuesSource) Desc

Desc ensures the order of the values produced is descending.

func (*CompositeAggregationDateHistogramValuesSource) Field

Field to use for this source.

func (*CompositeAggregationDateHistogramValuesSource) FixedInterval added in v7.0.7

FixedInterval to use for the date histogram, e.g. "1d" or a numeric value like "60".

func (*CompositeAggregationDateHistogramValuesSource) Format

Format to use for the date histogram, e.g. "strict_date_optional_time"

func (*CompositeAggregationDateHistogramValuesSource) Interval deprecated

Interval to use for the date histogram, e.g. "1d" or a numeric value like "60".

Deprecated: Use FixedInterval or CalendarInterval instead.

func (*CompositeAggregationDateHistogramValuesSource) Missing deprecated

Missing specifies the value to use when the source finds a missing value in a document.

Deprecated: Use MissingBucket instead.

func (*CompositeAggregationDateHistogramValuesSource) MissingBucket

MissingBucket, if true, will create an explicit null bucket which represents documents with missing values.

func (*CompositeAggregationDateHistogramValuesSource) Order

Order specifies the order in the values produced by this source. It can be either "asc" or "desc".

func (*CompositeAggregationDateHistogramValuesSource) Script

Script to use for this source.

func (*CompositeAggregationDateHistogramValuesSource) Source

func (a *CompositeAggregationDateHistogramValuesSource) Source() (interface{}, error)

Source returns the serializable JSON for this values source.

func (*CompositeAggregationDateHistogramValuesSource) TimeZone

TimeZone to use for the dates.

func (*CompositeAggregationDateHistogramValuesSource) ValueType

ValueType specifies the type of values produced by this source, e.g. "string" or "date".

type CompositeAggregationHistogramValuesSource

type CompositeAggregationHistogramValuesSource struct {
	// contains filtered or unexported fields
}

CompositeAggregationHistogramValuesSource is a source for the CompositeAggregation that handles histograms it works very similar to a terms histogram with slightly different syntax

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-composite-aggregation.html#_histogram for details.

func NewCompositeAggregationHistogramValuesSource

func NewCompositeAggregationHistogramValuesSource(name string, interval float64) *CompositeAggregationHistogramValuesSource

NewCompositeAggregationHistogramValuesSource creates and initializes a new CompositeAggregationHistogramValuesSource.

func (*CompositeAggregationHistogramValuesSource) Asc

Asc ensures the order of the values produced is ascending.

func (*CompositeAggregationHistogramValuesSource) Desc

Desc ensures the order of the values produced is descending.

func (*CompositeAggregationHistogramValuesSource) Field

Field to use for this source.

func (*CompositeAggregationHistogramValuesSource) Interval

Interval specifies the interval to use.

func (*CompositeAggregationHistogramValuesSource) Missing deprecated

Missing specifies the value to use when the source finds a missing value in a document.

Deprecated: Use MissingBucket instead.

func (*CompositeAggregationHistogramValuesSource) MissingBucket

MissingBucket, if true, will create an explicit null bucket which represents documents with missing values.

func (*CompositeAggregationHistogramValuesSource) Order

Order specifies the order in the values produced by this source. It can be either "asc" or "desc".

func (*CompositeAggregationHistogramValuesSource) Script

Script to use for this source.

func (*CompositeAggregationHistogramValuesSource) Source

func (a *CompositeAggregationHistogramValuesSource) Source() (interface{}, error)

Source returns the serializable JSON for this values source.

func (*CompositeAggregationHistogramValuesSource) ValueType

ValueType specifies the type of values produced by this source, e.g. "string" or "date".

type CompositeAggregationTermsValuesSource

type CompositeAggregationTermsValuesSource struct {
	// contains filtered or unexported fields
}

CompositeAggregationTermsValuesSource is a source for the CompositeAggregation that handles terms it works very similar to a terms aggregation with slightly different syntax

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-composite-aggregation.html#_terms for details.

func NewCompositeAggregationTermsValuesSource

func NewCompositeAggregationTermsValuesSource(name string) *CompositeAggregationTermsValuesSource

NewCompositeAggregationTermsValuesSource creates and initializes a new CompositeAggregationTermsValuesSource.

func (*CompositeAggregationTermsValuesSource) Asc

Asc ensures the order of the values produced is ascending.

func (*CompositeAggregationTermsValuesSource) Desc

Desc ensures the order of the values produced is descending.

func (*CompositeAggregationTermsValuesSource) Field

Field to use for this source.

func (*CompositeAggregationTermsValuesSource) Missing deprecated

Missing specifies the value to use when the source finds a missing value in a document.

Deprecated: Use MissingBucket instead.

func (*CompositeAggregationTermsValuesSource) MissingBucket

MissingBucket, if true, will create an explicit null bucket which represents documents with missing values.

func (*CompositeAggregationTermsValuesSource) Order

Order specifies the order in the values produced by this source. It can be either "asc" or "desc".

func (*CompositeAggregationTermsValuesSource) Script

Script to use for this source.

func (*CompositeAggregationTermsValuesSource) Source

func (a *CompositeAggregationTermsValuesSource) Source() (interface{}, error)

Source returns the serializable JSON for this values source.

func (*CompositeAggregationTermsValuesSource) ValueType

ValueType specifies the type of values produced by this source, e.g. "string" or "date".

type CompositeAggregationValuesSource

type CompositeAggregationValuesSource interface {
	Source() (interface{}, error)
}

CompositeAggregationValuesSource specifies the interface that all implementations for CompositeAggregation's Sources method need to implement.

The different implementations are described in https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-composite-aggregation.html#_values_source_2.

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.

func (*ConstantBackoff) Next

func (b *ConstantBackoff) Next(retry int) (time.Duration, bool)

Next implements BackoffFunc for ConstantBackoff.

type ConstantScoreQuery

type ConstantScoreQuery struct {
	// contains filtered or unexported fields
}

ConstantScoreQuery is a query that wraps a filter and simply returns a constant score equal to the query boost for every document in the filter.

For more details, see: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-constant-score-query.html

func NewConstantScoreQuery

func NewConstantScoreQuery(filter Query) *ConstantScoreQuery

ConstantScoreQuery creates and initializes a new constant score query.

func (*ConstantScoreQuery) Boost

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 (*ConstantScoreQuery) Source

func (q *ConstantScoreQuery) Source() (interface{}, error)

Source returns the query source.

type ContextSuggester

type ContextSuggester struct {
	Suggester
	// contains filtered or unexported fields
}

ContextSuggester is a fast suggester for e.g. type-ahead completion that supports filtering and boosting based on contexts. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/suggester-context.html for more details.

func NewContextSuggester

func NewContextSuggester(name string) *ContextSuggester

Creates a new context suggester.

func (*ContextSuggester) ContextQueries

func (q *ContextSuggester) ContextQueries(queries ...SuggesterContextQuery) *ContextSuggester

func (*ContextSuggester) ContextQuery

func (*ContextSuggester) Field

func (q *ContextSuggester) Field(field string) *ContextSuggester

func (*ContextSuggester) Name

func (q *ContextSuggester) Name() string

func (*ContextSuggester) Prefix

func (q *ContextSuggester) Prefix(prefix string) *ContextSuggester

func (*ContextSuggester) Size

func (q *ContextSuggester) Size(size int) *ContextSuggester

func (*ContextSuggester) Source

func (q *ContextSuggester) Source(includeName bool) (interface{}, error)

Creates the source for the context suggester.

type CountResponse

type CountResponse struct {
	Count           int64       `json:"count"`
	TerminatedEarly bool        `json:"terminated_early,omitempty"`
	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) ErrorTrace added in v7.0.7

func (s *CountService) ErrorTrace(errorTrace bool) *CountService

ErrorTrace specifies whether to include the stack trace of returned errors.

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) FilterPath added in v7.0.7

func (s *CountService) FilterPath(filterPath ...string) *CountService

FilterPath specifies a list of filters used to reduce the response.

func (*CountService) Header added in v7.0.7

func (s *CountService) Header(name string, value string) *CountService

Header adds a header to the request.

func (*CountService) Headers added in v7.0.7

func (s *CountService) Headers(headers http.Header) *CountService

Headers specifies the headers of the request.

func (*CountService) Human added in v7.0.7

func (s *CountService) Human(human bool) *CountService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*CountService) IgnoreThrottled added in v7.0.20

func (s *CountService) IgnoreThrottled(ignoreThrottled bool) *CountService

IgnoreThrottled indicates whether specified concrete, expanded or aliased indices should be ignored when throttled.

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 tells Elasticsearch whether to return a formatted JSON response.

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

func (s *CountService) TerminateAfter(terminateAfter int) *CountService

TerminateAfter indicates the maximum count for each shard, upon reaching which the query execution will terminate early.

func (*CountService) Type deprecated

func (s *CountService) Type(typ ...string) *CountService

Type sets the types to use to restrict the results.

Deprecated: Types are in the process of being removed. Instead of using a type, prefer to filter on a field on the document.

func (*CountService) Validate

func (s *CountService) Validate() error

Validate checks if the operation is valid.

type CumulativeSumAggregation

type CumulativeSumAggregation struct {
	// contains filtered or unexported fields
}

CumulativeSumAggregation is a parent pipeline aggregation which calculates the cumulative sum of a specified metric in a parent histogram (or date_histogram) aggregation. The specified metric must be numeric and the enclosing histogram must have min_doc_count set to 0 (default for histogram aggregations).

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-cumulative-sum-aggregation.html

func NewCumulativeSumAggregation

func NewCumulativeSumAggregation() *CumulativeSumAggregation

NewCumulativeSumAggregation creates and initializes a new CumulativeSumAggregation.

func (*CumulativeSumAggregation) BucketsPath

func (a *CumulativeSumAggregation) BucketsPath(bucketsPaths ...string) *CumulativeSumAggregation

BucketsPath sets the paths to the buckets to use for this pipeline aggregator.

func (*CumulativeSumAggregation) Format

Format to use on the output of this aggregation.

func (*CumulativeSumAggregation) Meta

func (a *CumulativeSumAggregation) Meta(metaData map[string]interface{}) *CumulativeSumAggregation

Meta sets the meta data to be included in the aggregation response.

func (*CumulativeSumAggregation) Source

func (a *CumulativeSumAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

type DateHistogramAggregation

type DateHistogramAggregation struct {
	// contains filtered or unexported fields
}

DateHistogramAggregation is a multi-bucket aggregation similar to the histogram except it can only be applied on date values. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-datehistogram-aggregation.html

func NewDateHistogramAggregation

func NewDateHistogramAggregation() *DateHistogramAggregation

NewDateHistogramAggregation creates a new DateHistogramAggregation.

func (*DateHistogramAggregation) CalendarInterval added in v7.0.7

func (a *DateHistogramAggregation) CalendarInterval(calendarInterval string) *DateHistogramAggregation

CalendarInterval by which the aggregation gets processed.

Allowed values are: "year" ("1y", "y"), "quarter" ("1q", "q"), "month" ("1M", "M"), "week" ("1w", "w"), "day" ("d", "1d")

These units are calendar-aware, meaning they respect leap additions, variable days per month etc. This is mutually exclusive with FixedInterval.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.4/search-aggregations-bucket-datehistogram-aggregation.html

func (*DateHistogramAggregation) ExtendedBounds

func (a *DateHistogramAggregation) ExtendedBounds(min, max interface{}) *DateHistogramAggregation

ExtendedBounds accepts int, int64, string, or time.Time values. In case the lower value in the histogram would be greater than min or the upper value would be less than max, empty buckets will be generated.

func (*DateHistogramAggregation) ExtendedBoundsMax

func (a *DateHistogramAggregation) ExtendedBoundsMax(max interface{}) *DateHistogramAggregation

ExtendedBoundsMax accepts int, int64, string, or time.Time values.

func (*DateHistogramAggregation) ExtendedBoundsMin

func (a *DateHistogramAggregation) ExtendedBoundsMin(min interface{}) *DateHistogramAggregation

ExtendedBoundsMin accepts int, int64, string, or time.Time values.

func (*DateHistogramAggregation) Field

Field on which the aggregation is processed.

func (*DateHistogramAggregation) FixedInterval added in v7.0.7

func (a *DateHistogramAggregation) FixedInterval(fixedInterval string) *DateHistogramAggregation

FixedInterval by which the aggregation gets processed.

Allowed values are: "year", "1y", "quarter", "1q", "month", "1M", "week", "1w", "day", "1d", "hour", "1h", "minute", "1m", "second", or "1s". It also supports time settings like "1.5h".

These units are not calendar-aware and are simply multiples of fixed, SI units. This is mutually exclusive with CalendarInterval.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.4/search-aggregations-bucket-datehistogram-aggregation.html

func (*DateHistogramAggregation) Format

Format sets the format to use for dates.

func (*DateHistogramAggregation) Interval deprecated

Interval by which the aggregation gets processed. This field will be replaced by the two FixedInterval and CalendarInterval fields (see below).

See https://www.elastic.co/guide/en/elasticsearch/reference/7.4/search-aggregations-bucket-datehistogram-aggregation.html

Deprecated: This field will be removed in the future.

func (*DateHistogramAggregation) Keyed

Keyed specifies whether to return the results with a keyed response (or not).

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-datehistogram-aggregation.html#_keyed_response_3.

func (*DateHistogramAggregation) Meta

func (a *DateHistogramAggregation) Meta(metaData map[string]interface{}) *DateHistogramAggregation

Meta sets the meta data to be included in the aggregation response.

func (*DateHistogramAggregation) MinDocCount

func (a *DateHistogramAggregation) MinDocCount(minDocCount int64) *DateHistogramAggregation

MinDocCount sets the minimum document count per bucket. Buckets with less documents than this min value will not be returned.

func (*DateHistogramAggregation) Missing

func (a *DateHistogramAggregation) Missing(missing interface{}) *DateHistogramAggregation

Missing configures the value to use when documents miss a value.

func (*DateHistogramAggregation) Offset

Offset sets the offset of time intervals in the histogram, e.g. "+6h".

func (*DateHistogramAggregation) Order

Order specifies the sort order. Valid values for order are: "_key", "_count", a sub-aggregation name, or a sub-aggregation name with a metric.

func (*DateHistogramAggregation) OrderByAggregation

func (a *DateHistogramAggregation) OrderByAggregation(aggName string, asc bool) *DateHistogramAggregation

OrderByAggregation creates a bucket ordering strategy which sorts buckets based on a single-valued calc get.

func (*DateHistogramAggregation) OrderByAggregationAndMetric

func (a *DateHistogramAggregation) OrderByAggregationAndMetric(aggName, metric string, asc bool) *DateHistogramAggregation

OrderByAggregationAndMetric creates a bucket ordering strategy which sorts buckets based on a multi-valued calc get.

func (*DateHistogramAggregation) OrderByCount

func (*DateHistogramAggregation) OrderByCountAsc

func (a *DateHistogramAggregation) OrderByCountAsc() *DateHistogramAggregation

func (*DateHistogramAggregation) OrderByCountDesc

func (a *DateHistogramAggregation) OrderByCountDesc() *DateHistogramAggregation

func (*DateHistogramAggregation) OrderByKey

func (*DateHistogramAggregation) OrderByKeyAsc

func (*DateHistogramAggregation) OrderByKeyDesc

func (*DateHistogramAggregation) Script

func (*DateHistogramAggregation) Source

func (a *DateHistogramAggregation) Source() (interface{}, error)

func (*DateHistogramAggregation) SubAggregation

func (a *DateHistogramAggregation) SubAggregation(name string, subAggregation Aggregation) *DateHistogramAggregation

func (*DateHistogramAggregation) TimeZone

TimeZone sets the timezone in which to translate dates before computing buckets.

type DateRangeAggregation

type DateRangeAggregation struct {
	// contains filtered or unexported fields
}

DateRangeAggregation is a range aggregation that is dedicated for date values. The main difference between this aggregation and the normal range aggregation is that the from and to values can be expressed in Date Math expressions, and it is also possible to specify a date format by which the from and to response fields will be returned. Note that this aggregration includes the from value and excludes the to value for each range. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-daterange-aggregation.html

func NewDateRangeAggregation

func NewDateRangeAggregation() *DateRangeAggregation

func (*DateRangeAggregation) AddRange

func (a *DateRangeAggregation) AddRange(from, to interface{}) *DateRangeAggregation

func (*DateRangeAggregation) AddRangeWithKey

func (a *DateRangeAggregation) AddRangeWithKey(key string, from, to interface{}) *DateRangeAggregation

func (*DateRangeAggregation) AddUnboundedFrom

func (a *DateRangeAggregation) AddUnboundedFrom(to interface{}) *DateRangeAggregation

func (*DateRangeAggregation) AddUnboundedFromWithKey

func (a *DateRangeAggregation) AddUnboundedFromWithKey(key string, to interface{}) *DateRangeAggregation

func (*DateRangeAggregation) AddUnboundedTo

func (a *DateRangeAggregation) AddUnboundedTo(from interface{}) *DateRangeAggregation

func (*DateRangeAggregation) AddUnboundedToWithKey

func (a *DateRangeAggregation) AddUnboundedToWithKey(key string, from interface{}) *DateRangeAggregation

func (*DateRangeAggregation) Between

func (a *DateRangeAggregation) Between(from, to interface{}) *DateRangeAggregation

func (*DateRangeAggregation) BetweenWithKey

func (a *DateRangeAggregation) BetweenWithKey(key string, from, to interface{}) *DateRangeAggregation

func (*DateRangeAggregation) Field

func (*DateRangeAggregation) Format

func (*DateRangeAggregation) Gt

func (a *DateRangeAggregation) Gt(from interface{}) *DateRangeAggregation

func (*DateRangeAggregation) GtWithKey

func (a *DateRangeAggregation) GtWithKey(key string, from interface{}) *DateRangeAggregation

func (*DateRangeAggregation) Keyed

func (*DateRangeAggregation) Lt

func (a *DateRangeAggregation) Lt(to interface{}) *DateRangeAggregation

func (*DateRangeAggregation) LtWithKey

func (a *DateRangeAggregation) LtWithKey(key string, to interface{}) *DateRangeAggregation

func (*DateRangeAggregation) Meta

func (a *DateRangeAggregation) Meta(metaData map[string]interface{}) *DateRangeAggregation

Meta sets the meta data to be included in the aggregation response.

func (*DateRangeAggregation) Script

func (a *DateRangeAggregation) Script(script *Script) *DateRangeAggregation

func (*DateRangeAggregation) Source

func (a *DateRangeAggregation) Source() (interface{}, error)

func (*DateRangeAggregation) SubAggregation

func (a *DateRangeAggregation) SubAggregation(name string, subAggregation Aggregation) *DateRangeAggregation

func (*DateRangeAggregation) TimeZone

func (a *DateRangeAggregation) TimeZone(timeZone string) *DateRangeAggregation

func (*DateRangeAggregation) Unmapped

func (a *DateRangeAggregation) Unmapped(unmapped bool) *DateRangeAggregation

type DateRangeAggregationEntry

type DateRangeAggregationEntry struct {
	Key  string
	From interface{}
	To   interface{}
}

type Decoder

type Decoder interface {
	Decode(data []byte, v interface{}) error
}

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 DeleteByQueryService

type DeleteByQueryService struct {
	// contains filtered or unexported fields
}

DeleteByQueryService deletes documents that match a query. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-delete-by-query.html.

func NewDeleteByQueryService

func NewDeleteByQueryService(client *Client) *DeleteByQueryService

NewDeleteByQueryService creates a new DeleteByQueryService. You typically use the client's DeleteByQuery to get a reference to the service.

func (*DeleteByQueryService) AbortOnVersionConflict

func (s *DeleteByQueryService) AbortOnVersionConflict() *DeleteByQueryService

AbortOnVersionConflict aborts the request on version conflicts. It is an alias to setting Conflicts("abort").

func (*DeleteByQueryService) AllowNoIndices

func (s *DeleteByQueryService) AllowNoIndices(allow bool) *DeleteByQueryService

AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices (including the _all string or when no indices have been specified).

func (*DeleteByQueryService) AnalyzeWildcard

func (s *DeleteByQueryService) AnalyzeWildcard(analyzeWildcard bool) *DeleteByQueryService

AnalyzeWildcard specifies whether wildcard and prefix queries should be analyzed (default: false).

func (*DeleteByQueryService) Analyzer

func (s *DeleteByQueryService) Analyzer(analyzer string) *DeleteByQueryService

Analyzer to use for the query string.

func (*DeleteByQueryService) Body

Body specifies the body of the request. It overrides data being specified via SearchService.

func (*DeleteByQueryService) Conflicts

func (s *DeleteByQueryService) Conflicts(conflicts string) *DeleteByQueryService

Conflicts indicates what to do when the process detects version conflicts. Possible values are "proceed" and "abort".

func (*DeleteByQueryService) DF

func (s *DeleteByQueryService) DF(defaultField string) *DeleteByQueryService

DF is the field to use as default where no field prefix is given in the query string.

func (*DeleteByQueryService) DefaultField

func (s *DeleteByQueryService) DefaultField(defaultField string) *DeleteByQueryService

DefaultField is the field to use as default where no field prefix is given in the query string. It is an alias to the DF func.

func (*DeleteByQueryService) DefaultOperator

func (s *DeleteByQueryService) DefaultOperator(defaultOperator string) *DeleteByQueryService

DefaultOperator for query string query (AND or OR).

func (*DeleteByQueryService) Do

Do executes the delete-by-query operation.

func (*DeleteByQueryService) DoAsync

DoAsync executes the delete-by-query operation asynchronously by starting a new task. Callers need to use the Task Management API to watch the outcome of the reindexing operation.

func (*DeleteByQueryService) DocvalueFields

func (s *DeleteByQueryService) DocvalueFields(docvalueFields ...string) *DeleteByQueryService

DocvalueFields specifies the list of fields to return as the docvalue representation of a field for each hit.

func (*DeleteByQueryService) ErrorTrace added in v7.0.7

func (s *DeleteByQueryService) ErrorTrace(errorTrace bool) *DeleteByQueryService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*DeleteByQueryService) ExpandWildcards

func (s *DeleteByQueryService) ExpandWildcards(expand string) *DeleteByQueryService

ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both. It can be "open" or "closed".

func (*DeleteByQueryService) Explain

func (s *DeleteByQueryService) Explain(explain bool) *DeleteByQueryService

Explain specifies whether to return detailed information about score computation as part of a hit.

func (*DeleteByQueryService) FilterPath added in v7.0.7

func (s *DeleteByQueryService) FilterPath(filterPath ...string) *DeleteByQueryService

FilterPath specifies a list of filters used to reduce the response.

func (*DeleteByQueryService) From

From is the starting offset (default: 0).

func (*DeleteByQueryService) Header added in v7.0.7

func (s *DeleteByQueryService) Header(name string, value string) *DeleteByQueryService

Header adds a header to the request.

func (*DeleteByQueryService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*DeleteByQueryService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*DeleteByQueryService) IgnoreUnavailable

func (s *DeleteByQueryService) IgnoreUnavailable(ignore bool) *DeleteByQueryService

IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).

func (*DeleteByQueryService) Index

func (s *DeleteByQueryService) Index(index ...string) *DeleteByQueryService

Index sets the indices on which to perform the delete operation.

func (*DeleteByQueryService) Lenient

func (s *DeleteByQueryService) Lenient(lenient bool) *DeleteByQueryService

Lenient specifies whether format-based query failures (such as providing text to a numeric field) should be ignored.

func (*DeleteByQueryService) LowercaseExpandedTerms

func (s *DeleteByQueryService) LowercaseExpandedTerms(lowercaseExpandedTerms bool) *DeleteByQueryService

LowercaseExpandedTerms specifies whether query terms should be lowercased.

func (*DeleteByQueryService) MaxDocs added in v7.0.30

func (s *DeleteByQueryService) MaxDocs(maxDocs int) *DeleteByQueryService

MaxDocs specifies the maximum number of documents to process. Defaults to all documents.

func (*DeleteByQueryService) Preference

func (s *DeleteByQueryService) Preference(preference string) *DeleteByQueryService

Preference specifies the node or shard the operation should be performed on (default: random).

func (*DeleteByQueryService) Pretty

func (s *DeleteByQueryService) Pretty(pretty bool) *DeleteByQueryService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*DeleteByQueryService) ProceedOnVersionConflict

func (s *DeleteByQueryService) ProceedOnVersionConflict() *DeleteByQueryService

ProceedOnVersionConflict proceeds the request on version conflicts. It is an alias to setting Conflicts("proceed").

func (*DeleteByQueryService) Q

Q specifies the query in Lucene query string syntax. You can also use Query to programmatically specify the query.

func (*DeleteByQueryService) Query

Query sets the query programmatically.

func (*DeleteByQueryService) QueryString

func (s *DeleteByQueryService) QueryString(query string) *DeleteByQueryService

QueryString is an alias to Q. Notice that you can also use Query to programmatically set the query.

func (*DeleteByQueryService) Refresh

func (s *DeleteByQueryService) Refresh(refresh string) *DeleteByQueryService

Refresh indicates whether the effected indexes should be refreshed.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-refresh.html for details.

func (*DeleteByQueryService) RequestCache

func (s *DeleteByQueryService) RequestCache(requestCache bool) *DeleteByQueryService

RequestCache specifies if request cache should be used for this request or not, defaults to index level setting.

func (*DeleteByQueryService) RequestsPerSecond

func (s *DeleteByQueryService) RequestsPerSecond(requestsPerSecond int) *DeleteByQueryService

RequestsPerSecond sets the throttle on this request in sub-requests per second. -1 means set no throttle as does "unlimited" which is the only non-float this accepts.

func (*DeleteByQueryService) Routing

func (s *DeleteByQueryService) Routing(routing ...string) *DeleteByQueryService

Routing is a list of specific routing values.

func (*DeleteByQueryService) Scroll

Scroll specifies how long a consistent view of the index should be maintained for scrolled search.

func (*DeleteByQueryService) ScrollSize

func (s *DeleteByQueryService) ScrollSize(scrollSize int) *DeleteByQueryService

ScrollSize is the size on the scroll request powering the update_by_query.

func (*DeleteByQueryService) SearchTimeout

func (s *DeleteByQueryService) SearchTimeout(searchTimeout string) *DeleteByQueryService

SearchTimeout defines an explicit timeout for each search request. Defaults to no timeout.

func (*DeleteByQueryService) SearchType

func (s *DeleteByQueryService) SearchType(searchType string) *DeleteByQueryService

SearchType is the search operation type. Possible values are "query_then_fetch" and "dfs_query_then_fetch".

func (*DeleteByQueryService) Size

Size represents the number of hits to return (default: 10).

func (*DeleteByQueryService) Slices

func (s *DeleteByQueryService) Slices(slices interface{}) *DeleteByQueryService

Slices represents the number of slices (default: 1). It used to be a number, but can be set to "auto" as of 6.7.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-delete-by-query.html#docs-delete-by-query-automatic-slice for details.

func (*DeleteByQueryService) Sort

Sort is a list of <field>:<direction> pairs.

func (*DeleteByQueryService) SortByField

func (s *DeleteByQueryService) SortByField(field string, ascending bool) *DeleteByQueryService

SortByField adds a sort order.

func (*DeleteByQueryService) Stats

func (s *DeleteByQueryService) Stats(stats ...string) *DeleteByQueryService

Stats specifies specific tag(s) of the request for logging and statistical purposes.

func (*DeleteByQueryService) StoredFields

func (s *DeleteByQueryService) StoredFields(storedFields ...string) *DeleteByQueryService

StoredFields specifies the list of stored fields to return as part of a hit.

func (*DeleteByQueryService) SuggestField

func (s *DeleteByQueryService) SuggestField(suggestField string) *DeleteByQueryService

SuggestField specifies which field to use for suggestions.

func (*DeleteByQueryService) SuggestMode

func (s *DeleteByQueryService) SuggestMode(suggestMode string) *DeleteByQueryService

SuggestMode specifies the suggest mode. Possible values are "missing", "popular", and "always".

func (*DeleteByQueryService) SuggestSize

func (s *DeleteByQueryService) SuggestSize(suggestSize int) *DeleteByQueryService

SuggestSize specifies how many suggestions to return in response.

func (*DeleteByQueryService) SuggestText

func (s *DeleteByQueryService) SuggestText(suggestText string) *DeleteByQueryService

SuggestText specifies the source text for which the suggestions should be returned.

func (*DeleteByQueryService) TerminateAfter

func (s *DeleteByQueryService) TerminateAfter(terminateAfter int) *DeleteByQueryService

TerminateAfter indicates the maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.

func (*DeleteByQueryService) Timeout

func (s *DeleteByQueryService) Timeout(timeout string) *DeleteByQueryService

Timeout is the time each individual bulk request should wait for shards that are unavailable.

func (*DeleteByQueryService) TimeoutInMillis

func (s *DeleteByQueryService) TimeoutInMillis(timeoutInMillis int) *DeleteByQueryService

TimeoutInMillis sets the timeout in milliseconds.

func (*DeleteByQueryService) TrackScores

func (s *DeleteByQueryService) TrackScores(trackScores bool) *DeleteByQueryService

TrackScores indicates whether to calculate and return scores even if they are not used for sorting.

func (*DeleteByQueryService) Type deprecated

Type limits the delete operation to the given types.

Deprecated: Types are in the process of being removed. Instead of using a type, prefer to filter on a field of the document.

func (*DeleteByQueryService) Validate

func (s *DeleteByQueryService) Validate() error

Validate checks if the operation is valid.

func (*DeleteByQueryService) Version

func (s *DeleteByQueryService) Version(version bool) *DeleteByQueryService

Version specifies whether to return document version as part of a hit.

func (*DeleteByQueryService) WaitForActiveShards

func (s *DeleteByQueryService) WaitForActiveShards(waitForActiveShards string) *DeleteByQueryService

WaitForActiveShards sets the number of shard copies that must be active before proceeding with the update by query 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).

func (*DeleteByQueryService) WaitForCompletion

func (s *DeleteByQueryService) WaitForCompletion(waitForCompletion bool) *DeleteByQueryService

WaitForCompletion indicates if the request should block until the reindex is complete.

func (*DeleteByQueryService) XSource

func (s *DeleteByQueryService) XSource(xSource ...string) *DeleteByQueryService

XSource is true or false to return the _source field or not, or a list of fields to return.

func (*DeleteByQueryService) XSourceExclude

func (s *DeleteByQueryService) XSourceExclude(xSourceExclude ...string) *DeleteByQueryService

XSourceExclude represents a list of fields to exclude from the returned _source field.

func (*DeleteByQueryService) XSourceInclude

func (s *DeleteByQueryService) XSourceInclude(xSourceInclude ...string) *DeleteByQueryService

XSourceInclude represents a list of fields to extract and return from the _source field.

type DeleteResponse

type DeleteResponse struct {
	Index         string      `json:"_index,omitempty"`
	Type          string      `json:"_type,omitempty"`
	Id            string      `json:"_id,omitempty"`
	Version       int64       `json:"_version,omitempty"`
	Result        string      `json:"result,omitempty"`
	Shards        *ShardsInfo `json:"_shards,omitempty"`
	SeqNo         int64       `json:"_seq_no,omitempty"`
	PrimaryTerm   int64       `json:"_primary_term,omitempty"`
	Status        int         `json:"status,omitempty"`
	ForcedRefresh bool        `json:"forced_refresh,omitempty"`
}

DeleteResponse is the outcome of running DeleteService.Do.

type DeleteScriptResponse

type DeleteScriptResponse struct {
	AcknowledgedResponse
}

DeleteScriptResponse is the result of deleting a stored script in Elasticsearch.

type DeleteScriptService

type DeleteScriptService struct {
	// contains filtered or unexported fields
}

DeleteScriptService removes a stored script in Elasticsearch.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/modules-scripting.html for details.

func NewDeleteScriptService

func NewDeleteScriptService(client *Client) *DeleteScriptService

NewDeleteScriptService creates a new DeleteScriptService.

func (*DeleteScriptService) Do

Do executes the operation.

func (*DeleteScriptService) ErrorTrace added in v7.0.7

func (s *DeleteScriptService) ErrorTrace(errorTrace bool) *DeleteScriptService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*DeleteScriptService) FilterPath added in v7.0.7

func (s *DeleteScriptService) FilterPath(filterPath ...string) *DeleteScriptService

FilterPath specifies a list of filters used to reduce the response.

func (*DeleteScriptService) Header added in v7.0.7

func (s *DeleteScriptService) Header(name string, value string) *DeleteScriptService

Header adds a header to the request.

func (*DeleteScriptService) Headers added in v7.0.7

func (s *DeleteScriptService) Headers(headers http.Header) *DeleteScriptService

Headers specifies the headers of the request.

func (*DeleteScriptService) Human added in v7.0.7

func (s *DeleteScriptService) Human(human bool) *DeleteScriptService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*DeleteScriptService) Id

Id is the script ID.

func (*DeleteScriptService) MasterTimeout

func (s *DeleteScriptService) MasterTimeout(masterTimeout string) *DeleteScriptService

MasterTimeout is the timeout for connecting to master.

func (*DeleteScriptService) Pretty

func (s *DeleteScriptService) Pretty(pretty bool) *DeleteScriptService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*DeleteScriptService) Timeout

func (s *DeleteScriptService) Timeout(timeout string) *DeleteScriptService

Timeout is an explicit operation timeout.

func (*DeleteScriptService) Validate

func (s *DeleteScriptService) Validate() error

Validate checks if the operation is valid.

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/7.0/docs-delete.html for details.

func NewDeleteService

func NewDeleteService(client *Client) *DeleteService

NewDeleteService creates a new DeleteService.

func (*DeleteService) Do

Do executes the operation. If the document is not found (404), Elasticsearch will still return a response. This response is serialized and returned as well. In other words, for HTTP status code 404, both an error and a response might be returned.

func (*DeleteService) ErrorTrace added in v7.0.7

func (s *DeleteService) ErrorTrace(errorTrace bool) *DeleteService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*DeleteService) FilterPath added in v7.0.7

func (s *DeleteService) FilterPath(filterPath ...string) *DeleteService

FilterPath specifies a list of filters used to reduce the response.

func (*DeleteService) Header added in v7.0.7

func (s *DeleteService) Header(name string, value string) *DeleteService

Header adds a header to the request.

func (*DeleteService) Headers added in v7.0.7

func (s *DeleteService) Headers(headers http.Header) *DeleteService

Headers specifies the headers of the request.

func (*DeleteService) Human added in v7.0.7

func (s *DeleteService) Human(human bool) *DeleteService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*DeleteService) Id

func (s *DeleteService) Id(id string) *DeleteService

Id is the document ID.

func (*DeleteService) IfPrimaryTerm added in v7.0.5

func (s *DeleteService) IfPrimaryTerm(primaryTerm int64) *DeleteService

IfPrimaryTerm indicates to only perform the delete operation if the last operation that has changed the document has the specified primary term.

func (*DeleteService) IfSeqNo added in v7.0.5

func (s *DeleteService) IfSeqNo(seqNo int64) *DeleteService

IfSeqNo indicates to only perform the delete operation if the last operation that has changed the document has the specified sequence number.

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 tells Elasticsearch whether to return a formatted JSON response.

func (*DeleteService) Refresh

func (s *DeleteService) Refresh(refresh string) *DeleteService

Refresh the index after performing the operation.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-refresh.html for details.

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 deprecated

func (s *DeleteService) Type(typ string) *DeleteService

Type is the type of the document.

Deprecated: Types are in the process of being removed.

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 DerivativeAggregation

type DerivativeAggregation struct {
	// contains filtered or unexported fields
}

DerivativeAggregation is a parent pipeline aggregation which calculates the derivative of a specified metric in a parent histogram (or date_histogram) aggregation. The specified metric must be numeric and the enclosing histogram must have min_doc_count set to 0 (default for histogram aggregations).

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-derivative-aggregation.html

func NewDerivativeAggregation

func NewDerivativeAggregation() *DerivativeAggregation

NewDerivativeAggregation creates and initializes a new DerivativeAggregation.

func (*DerivativeAggregation) BucketsPath

func (a *DerivativeAggregation) BucketsPath(bucketsPaths ...string) *DerivativeAggregation

BucketsPath sets the paths to the buckets to use for this pipeline aggregator.

func (*DerivativeAggregation) Format

Format to use on the output of this aggregation.

func (*DerivativeAggregation) GapInsertZeros

func (a *DerivativeAggregation) GapInsertZeros() *DerivativeAggregation

GapInsertZeros inserts zeros for gaps in the series.

func (*DerivativeAggregation) GapPolicy

func (a *DerivativeAggregation) GapPolicy(gapPolicy string) *DerivativeAggregation

GapPolicy defines what should be done when a gap in the series is discovered. Valid values include "insert_zeros" or "skip". Default is "insert_zeros".

func (*DerivativeAggregation) GapSkip

GapSkip skips gaps in the series.

func (*DerivativeAggregation) Meta

func (a *DerivativeAggregation) Meta(metaData map[string]interface{}) *DerivativeAggregation

Meta sets the meta data to be included in the aggregation response.

func (*DerivativeAggregation) Source

func (a *DerivativeAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

func (*DerivativeAggregation) Unit

Unit sets the unit provided, e.g. "1d" or "1y". It is only useful when calculating the derivative using a date_histogram.

type DirectCandidateGenerator

type DirectCandidateGenerator struct {
	// contains filtered or unexported fields
}

DirectCandidateGenerator implements a direct candidate generator. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-suggesters-phrase.html#_smoothing_models for details about smoothing models.

func NewDirectCandidateGenerator

func NewDirectCandidateGenerator(field string) *DirectCandidateGenerator

func (*DirectCandidateGenerator) Accuracy

func (*DirectCandidateGenerator) Field

func (*DirectCandidateGenerator) MaxEdits

func (g *DirectCandidateGenerator) MaxEdits(maxEdits int) *DirectCandidateGenerator

func (*DirectCandidateGenerator) MaxInspections

func (g *DirectCandidateGenerator) MaxInspections(maxInspections int) *DirectCandidateGenerator

func (*DirectCandidateGenerator) MaxTermFreq

func (g *DirectCandidateGenerator) MaxTermFreq(maxTermFreq float64) *DirectCandidateGenerator

func (*DirectCandidateGenerator) MinDocFreq

func (g *DirectCandidateGenerator) MinDocFreq(minDocFreq float64) *DirectCandidateGenerator

func (*DirectCandidateGenerator) MinWordLength

func (g *DirectCandidateGenerator) MinWordLength(minWordLength int) *DirectCandidateGenerator

func (*DirectCandidateGenerator) PostFilter

func (g *DirectCandidateGenerator) PostFilter(postFilter string) *DirectCandidateGenerator

func (*DirectCandidateGenerator) PreFilter

func (g *DirectCandidateGenerator) PreFilter(preFilter string) *DirectCandidateGenerator

func (*DirectCandidateGenerator) PrefixLength

func (g *DirectCandidateGenerator) PrefixLength(prefixLength int) *DirectCandidateGenerator

func (*DirectCandidateGenerator) Size

func (*DirectCandidateGenerator) Sort

func (*DirectCandidateGenerator) Source

func (g *DirectCandidateGenerator) Source() (interface{}, error)

func (*DirectCandidateGenerator) StringDistance

func (g *DirectCandidateGenerator) StringDistance(stringDistance string) *DirectCandidateGenerator

func (*DirectCandidateGenerator) SuggestMode

func (g *DirectCandidateGenerator) SuggestMode(suggestMode string) *DirectCandidateGenerator

func (*DirectCandidateGenerator) Type

func (g *DirectCandidateGenerator) Type() string

type DisMaxQuery

type DisMaxQuery struct {
	// contains filtered or unexported fields
}

DisMaxQuery is 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.

For more details, see: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-dis-max-query.html

func NewDisMaxQuery

func NewDisMaxQuery() *DisMaxQuery

NewDisMaxQuery creates and initializes a new dis max query.

func (*DisMaxQuery) Boost

func (q *DisMaxQuery) Boost(boost float64) *DisMaxQuery

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 (*DisMaxQuery) Query

func (q *DisMaxQuery) Query(queries ...Query) *DisMaxQuery

Query adds one or more queries to the dis max query.

func (*DisMaxQuery) QueryName

func (q *DisMaxQuery) QueryName(queryName string) *DisMaxQuery

QueryName sets the query name for the filter that can be used when searching for matched filters per hit.

func (*DisMaxQuery) Source

func (q *DisMaxQuery) Source() (interface{}, error)

Source returns the JSON serializable content for this query.

func (*DisMaxQuery) TieBreaker

func (q *DisMaxQuery) TieBreaker(tieBreaker float64) *DisMaxQuery

TieBreaker is the factor by which the score of each non-maximum disjunct for a document is multiplied with and added into the final score.

If non-zero, the value should be small, on the order of 0.1, which says that 10 occurrences of word in a lower-scored field that is also in a higher scored field is just as good as a unique word in the lower scored field (i.e., one that is not in any higher scored field).

type DiscoveryNode

type DiscoveryNode struct {
	Name             string                 `json:"name"`
	TransportAddress string                 `json:"transport_address"`
	Host             string                 `json:"host"`
	IP               string                 `json:"ip"`
	Roles            []string               `json:"roles"` // "master", "data", or "ingest"
	Attributes       map[string]interface{} `json:"attributes"`
	// Tasks returns the tasks by its id (as a string).
	Tasks map[string]*TaskInfo `json:"tasks"`
}

type DistanceFeatureQuery added in v7.0.7

type DistanceFeatureQuery struct {
	// contains filtered or unexported fields
}

DistanceFeatureQuery uses a script to provide a custom score for returned documents.

A DistanceFeatureQuery query is useful if, for example, a scoring function is expensive and you only need to calculate the score of a filtered set of documents.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.4/query-dsl-distance-feature-query.html

func NewDistanceFeatureQuery added in v7.0.7

func NewDistanceFeatureQuery(field string, origin interface{}, pivot string) *DistanceFeatureQuery

NewDistanceFeatureQuery creates and initializes a new script_score query.

func (*DistanceFeatureQuery) Boost added in v7.0.7

Boost sets the boost for this query.

func (*DistanceFeatureQuery) Field added in v7.0.7

Field to be used in the DistanceFeatureQuery.

func (*DistanceFeatureQuery) Origin added in v7.0.7

func (q *DistanceFeatureQuery) Origin(origin interface{}) *DistanceFeatureQuery

Origin is the date or point of origin used to calculate distances.

If the field is a date or date_nanos field, the origin value must be a date. Date math such as "now-1h" is supported.

If the field is a geo_point field, the origin must be a GeoPoint.

func (*DistanceFeatureQuery) Pivot added in v7.0.7

Pivot is distance from the origin at which relevance scores receive half of the boost value.

If field is a date or date_nanos field, the pivot value must be a time unit, such as "1h" or "10d".

If field is a geo_point field, the pivot value must be a distance unit, such as "1km" or "12m". You can pass a string, or a GeoPoint.

func (*DistanceFeatureQuery) QueryName added in v7.0.7

func (q *DistanceFeatureQuery) QueryName(queryName string) *DistanceFeatureQuery

QueryName sets the query name for the filter.

func (*DistanceFeatureQuery) Source added in v7.0.7

func (q *DistanceFeatureQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

type DiversifiedSamplerAggregation

type DiversifiedSamplerAggregation struct {
	// contains filtered or unexported fields
}

DiversifiedSamplerAggregation Like the ‘sampler` aggregation this is a filtering aggregation used to limit any sub aggregations’ processing to a sample of the top-scoring documents. The diversified_sampler aggregation adds the ability to limit the number of matches that share a common value such as an "author".

See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-diversified-sampler-aggregation.html

func NewDiversifiedSamplerAggregation

func NewDiversifiedSamplerAggregation() *DiversifiedSamplerAggregation

func (*DiversifiedSamplerAggregation) ExecutionHint

func (*DiversifiedSamplerAggregation) Field

Field on which the aggregation is processed.

func (*DiversifiedSamplerAggregation) MaxDocsPerValue

func (a *DiversifiedSamplerAggregation) MaxDocsPerValue(maxDocsPerValue int) *DiversifiedSamplerAggregation

func (*DiversifiedSamplerAggregation) Meta

func (a *DiversifiedSamplerAggregation) Meta(metaData map[string]interface{}) *DiversifiedSamplerAggregation

Meta sets the meta data to be included in the aggregation response.

func (*DiversifiedSamplerAggregation) Script

func (*DiversifiedSamplerAggregation) ShardSize

ShardSize sets the maximum number of docs returned from each shard.

func (*DiversifiedSamplerAggregation) Source

func (a *DiversifiedSamplerAggregation) Source() (interface{}, error)

func (*DiversifiedSamplerAggregation) SubAggregation

func (a *DiversifiedSamplerAggregation) SubAggregation(name string, subAggregation Aggregation) *DiversifiedSamplerAggregation

type DocvalueField

type DocvalueField struct {
	Field  string
	Format string
}

DocvalueField represents a docvalue field, its name and its format (optional).

func (DocvalueField) Source

func (d DocvalueField) Source() (interface{}, error)

Source serializes the DocvalueField into JSON.

type DocvalueFields

type DocvalueFields []DocvalueField

DocvalueFields is a slice of DocvalueField instances.

func (DocvalueFields) Source

func (d DocvalueFields) Source() (interface{}, error)

Source serializes the DocvalueFields into JSON.

type Doer added in v7.0.4

type Doer interface {
	Do(*http.Request) (*http.Response, error)
}

Doer is an interface to perform HTTP requests. It can be used for mocking.

type EWMAMovAvgModel

type EWMAMovAvgModel struct {
	// contains filtered or unexported fields
}

EWMAMovAvgModel calculates an exponentially weighted moving average.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-movavg-aggregation.html#_ewma_exponentially_weighted

func NewEWMAMovAvgModel

func NewEWMAMovAvgModel() *EWMAMovAvgModel

NewEWMAMovAvgModel creates and initializes a new EWMAMovAvgModel.

func (*EWMAMovAvgModel) Alpha

func (m *EWMAMovAvgModel) Alpha(alpha float64) *EWMAMovAvgModel

Alpha controls the smoothing of the data. Alpha = 1 retains no memory of past values (e.g. a random walk), while alpha = 0 retains infinite memory of past values (e.g. the series mean). Useful values are somewhere in between. Defaults to 0.5.

func (*EWMAMovAvgModel) Name

func (m *EWMAMovAvgModel) Name() string

Name of the model.

func (*EWMAMovAvgModel) Settings

func (m *EWMAMovAvgModel) Settings() map[string]interface{}

Settings of the model.

type Error

type Error struct {
	Status  int           `json:"status"`
	Details *ErrorDetails `json:"error,omitempty"`
}

Error encapsulates error details as returned from Elasticsearch.

func (*Error) Error

func (e *Error) Error() string

Error returns a string representation of the error.

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"`
	Suppressed   []*ErrorDetails          `json:"suppressed,omitempty"`
	FailedShards []map[string]interface{} `json:"failed_shards,omitempty"`
	Header       map[string]interface{}   `json:"header,omitempty"`

	ScriptStack []string             `json:"script_stack,omitempty"` // from ScriptException
	Script      string               `json:"script,omitempty"`       // from ScriptException
	Lang        string               `json:"lang,omitempty"`         // from ScriptException
	Position    *ScriptErrorPosition `json:"position,omitempty"`     // from ScriptException (7.7+)
}

ErrorDetails encapsulate error details from Elasticsearch. It is used in e.g. elastic.Error and elastic.BulkResponseItem.

type ExistsQuery

type ExistsQuery struct {
	// contains filtered or unexported fields
}

ExistsQuery is a query that only matches on documents that the field has a value in them.

For more details, see: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-exists-query.html

func NewExistsQuery

func NewExistsQuery(name string) *ExistsQuery

NewExistsQuery creates and initializes a new exists query.

func (*ExistsQuery) QueryName

func (q *ExistsQuery) QueryName(queryName string) *ExistsQuery

QueryName sets the query name for the filter that can be used when searching for matched queries per hit.

func (*ExistsQuery) Source

func (q *ExistsQuery) Source() (interface{}, error)

Source returns the JSON serializable content for this query.

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/7.0/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) ErrorTrace added in v7.0.7

func (s *ExistsService) ErrorTrace(errorTrace bool) *ExistsService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*ExistsService) FilterPath added in v7.0.7

func (s *ExistsService) FilterPath(filterPath ...string) *ExistsService

FilterPath specifies a list of filters used to reduce the response.

func (*ExistsService) Header added in v7.0.7

func (s *ExistsService) Header(name string, value string) *ExistsService

Header adds a header to the request.

func (*ExistsService) Headers added in v7.0.7

func (s *ExistsService) Headers(headers http.Header) *ExistsService

Headers specifies the headers of the request.

func (*ExistsService) Human added in v7.0.7

func (s *ExistsService) Human(human bool) *ExistsService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

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 tells Elasticsearch whether to return a formatted JSON response.

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.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-refresh.html for details.

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 ExplainResponse

type ExplainResponse struct {
	Index       string                 `json:"_index"`
	Type        string                 `json:"_type"`
	Id          string                 `json:"_id"`
	Matched     bool                   `json:"matched"`
	Explanation map[string]interface{} `json:"explanation"`
}

ExplainResponse is the response of ExplainService.Do.

type ExplainService

type ExplainService struct {
	// contains filtered or unexported fields
}

ExplainService computes a score explanation for a query and a specific document. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-explain.html.

func NewExplainService

func NewExplainService(client *Client) *ExplainService

NewExplainService creates a new ExplainService.

func (*ExplainService) AnalyzeWildcard

func (s *ExplainService) AnalyzeWildcard(analyzeWildcard bool) *ExplainService

AnalyzeWildcard specifies whether wildcards and prefix queries in the query string query should be analyzed (default: false).

func (*ExplainService) Analyzer

func (s *ExplainService) Analyzer(analyzer string) *ExplainService

Analyzer is the analyzer for the query string query.

func (*ExplainService) BodyJson

func (s *ExplainService) BodyJson(body interface{}) *ExplainService

BodyJson sets the query definition using the Query DSL.

func (*ExplainService) BodyString

func (s *ExplainService) BodyString(body string) *ExplainService

BodyString sets the query definition using the Query DSL as a string.

func (*ExplainService) DefaultOperator

func (s *ExplainService) DefaultOperator(defaultOperator string) *ExplainService

DefaultOperator is the default operator for query string query (AND or OR).

func (*ExplainService) Df

Df is the default field for query string query (default: _all).

func (*ExplainService) Do

Do executes the operation.

func (*ExplainService) ErrorTrace added in v7.0.7

func (s *ExplainService) ErrorTrace(errorTrace bool) *ExplainService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*ExplainService) Fields

func (s *ExplainService) Fields(fields ...string) *ExplainService

Fields is a list of fields to return in the response.

func (*ExplainService) FilterPath added in v7.0.7

func (s *ExplainService) FilterPath(filterPath ...string) *ExplainService

FilterPath specifies a list of filters used to reduce the response.

func (*ExplainService) Header added in v7.0.7

func (s *ExplainService) Header(name string, value string) *ExplainService

Header adds a header to the request.

func (*ExplainService) Headers added in v7.0.7

func (s *ExplainService) Headers(headers http.Header) *ExplainService

Headers specifies the headers of the request.

func (*ExplainService) Human added in v7.0.7

func (s *ExplainService) Human(human bool) *ExplainService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*ExplainService) Id

Id is the document ID.

func (*ExplainService) Index

func (s *ExplainService) Index(index string) *ExplainService

Index is the name of the index.

func (*ExplainService) Lenient

func (s *ExplainService) Lenient(lenient bool) *ExplainService

Lenient specifies whether format-based query failures (such as providing text to a numeric field) should be ignored.

func (*ExplainService) LowercaseExpandedTerms

func (s *ExplainService) LowercaseExpandedTerms(lowercaseExpandedTerms bool) *ExplainService

LowercaseExpandedTerms specifies whether query terms should be lowercased.

func (*ExplainService) Parent

func (s *ExplainService) Parent(parent string) *ExplainService

Parent is the ID of the parent document.

func (*ExplainService) Preference

func (s *ExplainService) Preference(preference string) *ExplainService

Preference specifies the node or shard the operation should be performed on (default: random).

func (*ExplainService) Pretty

func (s *ExplainService) Pretty(pretty bool) *ExplainService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*ExplainService) Q

Query in the Lucene query string syntax.

func (*ExplainService) Query

func (s *ExplainService) Query(query Query) *ExplainService

Query sets a query definition using the Query DSL.

func (*ExplainService) Routing

func (s *ExplainService) Routing(routing string) *ExplainService

Routing sets a specific routing value.

func (*ExplainService) Source

func (s *ExplainService) Source(source string) *ExplainService

Source is the URL-encoded query definition (instead of using the request body).

func (*ExplainService) Type deprecated

func (s *ExplainService) Type(typ string) *ExplainService

Type is the type of the document.

Deprecated: Types are in the process of being removed.

func (*ExplainService) Validate

func (s *ExplainService) Validate() error

Validate checks if the operation is valid.

func (*ExplainService) XSource

func (s *ExplainService) XSource(xSource ...string) *ExplainService

XSource is true or false to return the _source field or not, or a list of fields to return.

func (*ExplainService) XSourceExclude

func (s *ExplainService) XSourceExclude(xSourceExclude ...string) *ExplainService

XSourceExclude is a list of fields to exclude from the returned _source field.

func (*ExplainService) XSourceInclude

func (s *ExplainService) XSourceInclude(xSourceInclude ...string) *ExplainService

XSourceInclude is a list of fields to extract and return from the _source field.

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.

func (*ExponentialBackoff) Next

func (b *ExponentialBackoff) Next(retry int) (time.Duration, bool)

Next implements BackoffFunc for ExponentialBackoff.

type ExponentialDecayFunction

type ExponentialDecayFunction struct {
	// contains filtered or unexported fields
}

ExponentialDecayFunction builds an exponential decay score function. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-function-score-query.html for details.

func NewExponentialDecayFunction

func NewExponentialDecayFunction() *ExponentialDecayFunction

NewExponentialDecayFunction creates a new ExponentialDecayFunction.

func (*ExponentialDecayFunction) Decay

Decay defines how documents are scored at the distance given a Scale. If no decay is defined, documents at the distance Scale will be scored 0.5.

func (*ExponentialDecayFunction) FieldName

func (fn *ExponentialDecayFunction) FieldName(fieldName string) *ExponentialDecayFunction

FieldName specifies the name of the field to which this decay function is applied to.

func (*ExponentialDecayFunction) GetWeight

func (fn *ExponentialDecayFunction) GetWeight() *float64

GetWeight returns the adjusted score. It is part of the ScoreFunction interface. Returns nil if weight is not specified.

func (*ExponentialDecayFunction) MultiValueMode

func (fn *ExponentialDecayFunction) MultiValueMode(mode string) *ExponentialDecayFunction

MultiValueMode specifies how the decay function should be calculated on a field that has multiple values. Valid modes are: min, max, avg, and sum.

func (*ExponentialDecayFunction) Name

func (fn *ExponentialDecayFunction) Name() string

Name represents the JSON field name under which the output of Source needs to be serialized by FunctionScoreQuery (see FunctionScoreQuery.Source).

func (*ExponentialDecayFunction) Offset

func (fn *ExponentialDecayFunction) Offset(offset interface{}) *ExponentialDecayFunction

Offset, if defined, computes the decay function only for a distance greater than the defined offset.

func (*ExponentialDecayFunction) Origin

func (fn *ExponentialDecayFunction) Origin(origin interface{}) *ExponentialDecayFunction

Origin defines the "central point" by which the decay function calculates "distance".

func (*ExponentialDecayFunction) Scale

func (fn *ExponentialDecayFunction) Scale(scale interface{}) *ExponentialDecayFunction

Scale defines the scale to be used with Decay.

func (*ExponentialDecayFunction) Source

func (fn *ExponentialDecayFunction) Source() (interface{}, error)

Source returns the serializable JSON data of this score function.

func (*ExponentialDecayFunction) Weight

Weight adjusts the score of the score function. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-function-score-query.html#_using_function_score for details.

type ExtendedStatsAggregation

type ExtendedStatsAggregation struct {
	// contains filtered or unexported fields
}

ExtendedExtendedStatsAggregation is a multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. These values can be extracted either from specific numeric fields in the documents, or be generated by a provided script. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-metrics-extendedstats-aggregation.html

func NewExtendedStatsAggregation

func NewExtendedStatsAggregation() *ExtendedStatsAggregation

func (*ExtendedStatsAggregation) Field

func (*ExtendedStatsAggregation) Format

func (*ExtendedStatsAggregation) Meta

func (a *ExtendedStatsAggregation) Meta(metaData map[string]interface{}) *ExtendedStatsAggregation

Meta sets the meta data to be included in the aggregation response.

func (*ExtendedStatsAggregation) Missing

func (a *ExtendedStatsAggregation) Missing(missing interface{}) *ExtendedStatsAggregation

func (*ExtendedStatsAggregation) Script

func (*ExtendedStatsAggregation) Sigma added in v7.0.9

func (*ExtendedStatsAggregation) Source

func (a *ExtendedStatsAggregation) Source() (interface{}, error)

func (*ExtendedStatsAggregation) SubAggregation

func (a *ExtendedStatsAggregation) SubAggregation(name string, subAggregation Aggregation) *ExtendedStatsAggregation

type ExtendedStatsBucketAggregation

type ExtendedStatsBucketAggregation struct {
	// contains filtered or unexported fields
}

ExtendedStatsBucketAggregation is a sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. The specified metric must be numeric and the sibling aggregation must be a multi-bucket aggregation.

This aggregation provides a few more statistics (sum of squares, standard deviation, etc) compared to the stats_bucket aggregation. For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-extended-stats-bucket-aggregation.html

func NewExtendedStatsBucketAggregation

func NewExtendedStatsBucketAggregation() *ExtendedStatsBucketAggregation

NewExtendedStatsBucketAggregation creates and initializes a new ExtendedStatsBucketAggregation.

func (*ExtendedStatsBucketAggregation) BucketsPath

func (s *ExtendedStatsBucketAggregation) BucketsPath(bucketsPaths ...string) *ExtendedStatsBucketAggregation

BucketsPath sets the paths to the buckets to use for this pipeline aggregator.

func (*ExtendedStatsBucketAggregation) Format

Format to use on the output of this aggregation.

func (*ExtendedStatsBucketAggregation) GapInsertZeros

GapInsertZeros inserts zeros for gaps in the series.

func (*ExtendedStatsBucketAggregation) GapPolicy

GapPolicy defines what should be done when a gap in the series is discovered. Valid values include "insert_zeros" or "skip". Default is "insert_zeros".

func (*ExtendedStatsBucketAggregation) GapSkip

GapSkip skips gaps in the series.

func (*ExtendedStatsBucketAggregation) Meta

func (s *ExtendedStatsBucketAggregation) Meta(metaData map[string]interface{}) *ExtendedStatsBucketAggregation

Meta sets the meta data to be included in the aggregation response.

func (*ExtendedStatsBucketAggregation) Sigma

Sigma sets number of standard deviations above/below the mean to display

func (*ExtendedStatsBucketAggregation) Source

func (s *ExtendedStatsBucketAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

type FailedNodeException

type FailedNodeException struct {
	*ErrorDetails
	NodeId string `json:"node_id"`
}

FailedNodeException returns an error on the node level.

type FetchSourceContext

type FetchSourceContext struct {
	// contains filtered or unexported fields
}

FetchSourceContext enables source filtering, i.e. it allows control over how the _source field is returned with every hit. It is used with various endpoints, e.g. when searching for documents, retrieving individual documents, or even updating documents.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-source-filtering.html for details.

func NewFetchSourceContext

func NewFetchSourceContext(fetchSource bool) *FetchSourceContext

NewFetchSourceContext returns a new FetchSourceContext.

func (*FetchSourceContext) Exclude

func (fsc *FetchSourceContext) Exclude(excludes ...string) *FetchSourceContext

Exclude indicates to exclude specific parts of the _source. Wildcards are allowed here.

func (*FetchSourceContext) FetchSource

func (fsc *FetchSourceContext) FetchSource() bool

FetchSource indicates whether to return the _source.

func (*FetchSourceContext) Include

func (fsc *FetchSourceContext) Include(includes ...string) *FetchSourceContext

Include indicates to return specific parts of the _source. Wildcards are allowed here.

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)

SetFetchSource specifies whether to return the _source.

func (*FetchSourceContext) Source

func (fsc *FetchSourceContext) Source() (interface{}, error)

Source returns the JSON-serializable data to be used in a body.

type FieldCaps

type FieldCaps struct {
	Type                   string                 `json:"type"`
	MetadataField          bool                   `json:"metadata_field"`
	Searchable             bool                   `json:"searchable"`
	Aggregatable           bool                   `json:"aggregatable"`
	Indices                []string               `json:"indices,omitempty"`
	NonSearchableIndices   []string               `json:"non_searchable_indices,omitempty"`
	NonAggregatableIndices []string               `json:"non_aggregatable_indices,omitempty"`
	Meta                   map[string]interface{} `json:"meta,omitempty"`
}

FieldCaps contains capabilities of an individual field.

type FieldCapsRequest

type FieldCapsRequest struct {
	Fields          []string        `json:"fields"` // list of fields to retrieve
	IndexFilter     Query           `json:"index_filter,omitempty"`
	RuntimeMappings RuntimeMappings `json:"runtime_mappings,omitempty"`
}

FieldCapsRequest can be used to set up the body to be used in the Field Capabilities API.

type FieldCapsResponse

type FieldCapsResponse struct {
	Indices []string                 `json:"indices,omitempty"` // list of index names
	Fields  map[string]FieldCapsType `json:"fields,omitempty"`  // Name -> type -> caps
}

FieldCapsResponse contains field capabilities.

type FieldCapsService

type FieldCapsService struct {
	// contains filtered or unexported fields
}

FieldCapsService allows retrieving the capabilities of fields among multiple indices.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-field-caps.html for details

func NewFieldCapsService

func NewFieldCapsService(client *Client) *FieldCapsService

NewFieldCapsService creates a new FieldCapsService

func (*FieldCapsService) AllowNoIndices

func (s *FieldCapsService) AllowNoIndices(allowNoIndices bool) *FieldCapsService

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 (*FieldCapsService) BodyJson

func (s *FieldCapsService) BodyJson(body interface{}) *FieldCapsService

BodyJson is documented as: Field json objects containing the name and optionally a range to filter out indices result, that have results outside the defined bounds.

func (*FieldCapsService) BodyString

func (s *FieldCapsService) BodyString(body string) *FieldCapsService

BodyString is documented as: Field json objects containing the name and optionally a range to filter out indices result, that have results outside the defined bounds.

func (*FieldCapsService) Do

Do executes the operation.

func (*FieldCapsService) ErrorTrace added in v7.0.7

func (s *FieldCapsService) ErrorTrace(errorTrace bool) *FieldCapsService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*FieldCapsService) ExpandWildcards

func (s *FieldCapsService) ExpandWildcards(expandWildcards string) *FieldCapsService

ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.

func (*FieldCapsService) Fields

func (s *FieldCapsService) Fields(fields ...string) *FieldCapsService

Fields is a list of fields for to get field capabilities.

func (*FieldCapsService) FilterPath added in v7.0.7

func (s *FieldCapsService) FilterPath(filterPath ...string) *FieldCapsService

FilterPath specifies a list of filters used to reduce the response.

func (*FieldCapsService) Header added in v7.0.7

func (s *FieldCapsService) Header(name string, value string) *FieldCapsService

Header adds a header to the request.

func (*FieldCapsService) Headers added in v7.0.7

func (s *FieldCapsService) Headers(headers http.Header) *FieldCapsService

Headers specifies the headers of the request.

func (*FieldCapsService) Human added in v7.0.7

func (s *FieldCapsService) Human(human bool) *FieldCapsService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*FieldCapsService) IgnoreUnavailable

func (s *FieldCapsService) IgnoreUnavailable(ignoreUnavailable bool) *FieldCapsService

IgnoreUnavailable is documented as: Whether specified concrete indices should be ignored when unavailable (missing or closed).

func (*FieldCapsService) IncludeUnmapped added in v7.0.28

func (s *FieldCapsService) IncludeUnmapped(includeUnmapped bool) *FieldCapsService

IncludeUnmapped specifies whether unmapped fields whould be included in the response.

func (*FieldCapsService) Index

func (s *FieldCapsService) Index(index ...string) *FieldCapsService

Index is a list of index names; use `_all` or empty string to perform the operation on all indices.

func (*FieldCapsService) Pretty

func (s *FieldCapsService) Pretty(pretty bool) *FieldCapsService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*FieldCapsService) Validate

func (s *FieldCapsService) Validate() error

Validate checks if the operation is valid.

type FieldCapsType

type FieldCapsType map[string]FieldCaps // type -> caps

FieldCapsType represents a mapping from type (e.g. keyword) to capabilities.

type FieldScriptStats added in v7.0.32

type FieldScriptStats struct {
	LinesMax    int64 `json:"lines_max"`
	LinesTotal  int64 `json:"lines_total"`
	CharsMax    int64 `json:"chars_max"`
	CharsTotal  int64 `json:"chars_total"`
	SourceMax   int64 `json:"source_max"`
	SourceTotal int64 `json:"source_total"`
	DocMax      int64 `json:"doc_max"`
	DocTotal    int64 `json:"doc_total"`
}

type FieldSort

type FieldSort struct {
	Sorter
	// contains filtered or unexported fields
}

FieldSort sorts by a given field.

func NewFieldSort

func NewFieldSort(fieldName string) *FieldSort

NewFieldSort creates a new FieldSort.

func (*FieldSort) Asc

func (s *FieldSort) Asc() *FieldSort

Asc sets ascending sort order.

func (*FieldSort) Desc

func (s *FieldSort) Desc() *FieldSort

Desc sets descending sort order.

func (*FieldSort) FieldName

func (s *FieldSort) FieldName(fieldName string) *FieldSort

FieldName specifies the name of the field to be used for sorting.

func (*FieldSort) Filter

func (s *FieldSort) Filter(filter Query) *FieldSort

Filter sets a filter that nested objects should match with in order to be taken into account for sorting.

func (*FieldSort) Missing

func (s *FieldSort) Missing(missing interface{}) *FieldSort

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

func (s *FieldSort) Nested(nested *NestedSort) *FieldSort

Nested is available starting with 6.1 and will replace Filter and Path.

func (*FieldSort) NestedFilter

func (s *FieldSort) NestedFilter(nestedFilter Query) *FieldSort

NestedFilter sets a filter that nested objects should match with in order to be taken into account for sorting. Deprecated: Use Filter instead.

func (*FieldSort) NestedPath

func (s *FieldSort) NestedPath(nestedPath string) *FieldSort

NestedPath is used if sorting occurs on a field that is inside a nested object. Deprecated: Use Path instead.

func (*FieldSort) NestedSort

func (s *FieldSort) NestedSort(nestedSort *NestedSort) *FieldSort

NestedSort is available starting with 6.1 and will replace NestedFilter and NestedPath. Deprecated: Use Nested instead.

func (*FieldSort) Order

func (s *FieldSort) Order(ascending bool) *FieldSort

Order defines whether sorting ascending (default) or descending.

func (*FieldSort) Path

func (s *FieldSort) Path(path string) *FieldSort

Path is used if sorting occurs on a field that is inside a nested object.

func (*FieldSort) SortMode

func (s *FieldSort) SortMode(sortMode string) *FieldSort

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

func (s *FieldSort) Source() (interface{}, error)

Source returns the JSON-serializable data.

func (*FieldSort) UnmappedType

func (s *FieldSort) UnmappedType(typ string) *FieldSort

UnmappedType sets the type to use when the current field is not mapped in an index.

type FieldStatistics

type FieldStatistics struct {
	DocCount   int64 `json:"doc_count"`
	SumDocFreq int64 `json:"sum_doc_freq"`
	SumTtf     int64 `json:"sum_ttf"`
}

type FieldValueFactorFunction

type FieldValueFactorFunction struct {
	// contains filtered or unexported fields
}

FieldValueFactorFunction is a function score function that allows you to use a field from a document to influence the score. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-function-score-query.html#_field_value_factor.

func NewFieldValueFactorFunction

func NewFieldValueFactorFunction() *FieldValueFactorFunction

NewFieldValueFactorFunction initializes and returns a new FieldValueFactorFunction.

func (*FieldValueFactorFunction) Factor

Factor is the (optional) factor to multiply the field with. If you do not specify a factor, the default is 1.

func (*FieldValueFactorFunction) Field

Field is the field to be extracted from the document.

func (*FieldValueFactorFunction) GetWeight

func (fn *FieldValueFactorFunction) GetWeight() *float64

GetWeight returns the adjusted score. It is part of the ScoreFunction interface. Returns nil if weight is not specified.

func (*FieldValueFactorFunction) Missing

Missing is used if a document does not have that field.

func (*FieldValueFactorFunction) Modifier

Modifier to apply to the field value. It can be one of: none, log, log1p, log2p, ln, ln1p, ln2p, square, sqrt, or reciprocal. Defaults to: none.

func (*FieldValueFactorFunction) Name

func (fn *FieldValueFactorFunction) Name() string

Name represents the JSON field name under which the output of Source needs to be serialized by FunctionScoreQuery (see FunctionScoreQuery.Source).

func (*FieldValueFactorFunction) Source

func (fn *FieldValueFactorFunction) Source() (interface{}, error)

Source returns the serializable JSON data of this score function.

func (*FieldValueFactorFunction) Weight

Weight adjusts the score of the score function. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-function-score-query.html#_using_function_score for details.

type FilterAggregation

type FilterAggregation struct {
	// contains filtered or unexported fields
}

FilterAggregation defines a single bucket of all the documents in the current document set context that match a specified filter. Often this will be used to narrow down the current aggregation context to a specific set of documents. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-filter-aggregation.html

func NewFilterAggregation

func NewFilterAggregation() *FilterAggregation

func (*FilterAggregation) Filter

func (a *FilterAggregation) Filter(filter Query) *FilterAggregation

func (*FilterAggregation) Meta

func (a *FilterAggregation) Meta(metaData map[string]interface{}) *FilterAggregation

Meta sets the meta data to be included in the aggregation response.

func (*FilterAggregation) Source

func (a *FilterAggregation) Source() (interface{}, error)

func (*FilterAggregation) SubAggregation

func (a *FilterAggregation) SubAggregation(name string, subAggregation Aggregation) *FilterAggregation

type FiltersAggregation

type FiltersAggregation struct {
	// contains filtered or unexported fields
}

FiltersAggregation defines a multi bucket aggregations where each bucket is associated with a filter. Each bucket will collect all documents that match its associated filter.

Notice that the caller has to decide whether to add filters by name (using FilterWithName) or unnamed filters (using Filter or Filters). One cannot use both named and unnamed filters.

For details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-filters-aggregation.html

func NewFiltersAggregation

func NewFiltersAggregation() *FiltersAggregation

NewFiltersAggregation initializes a new FiltersAggregation.

func (*FiltersAggregation) Filter

func (a *FiltersAggregation) Filter(filter Query) *FiltersAggregation

Filter adds an unnamed filter. Notice that you can either use named or unnamed filters, but not both.

func (*FiltersAggregation) FilterWithName

func (a *FiltersAggregation) FilterWithName(name string, filter Query) *FiltersAggregation

FilterWithName adds a filter with a specific name. Notice that you can either use named or unnamed filters, but not both.

func (*FiltersAggregation) Filters

func (a *FiltersAggregation) Filters(filters ...Query) *FiltersAggregation

Filters adds one or more unnamed filters. Notice that you can either use named or unnamed filters, but not both.

func (*FiltersAggregation) Meta

func (a *FiltersAggregation) Meta(metaData map[string]interface{}) *FiltersAggregation

Meta sets the meta data to be included in the aggregation response.

func (*FiltersAggregation) OtherBucket added in v7.0.18

func (a *FiltersAggregation) OtherBucket(otherBucket bool) *FiltersAggregation

OtherBucket indicates whether to include a bucket for documents not matching any filter.

func (*FiltersAggregation) OtherBucketKey added in v7.0.18

func (a *FiltersAggregation) OtherBucketKey(key string) *FiltersAggregation

OtherBucketKey sets the key to use for the bucket for documents not matching any filter.

func (*FiltersAggregation) Source

func (a *FiltersAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface. If the aggregation is invalid, an error is returned. This may e.g. happen if you mixed named and unnamed filters.

func (*FiltersAggregation) SubAggregation

func (a *FiltersAggregation) SubAggregation(name string, subAggregation Aggregation) *FiltersAggregation

SubAggregation adds a sub-aggregation to this aggregation.

type FunctionScoreQuery

type FunctionScoreQuery struct {
	// contains filtered or unexported fields
}

FunctionScoreQuery allows you to modify the score of documents that are retrieved by a query. This can be useful if, for example, a score function is computationally expensive and it is sufficient to compute the score on a filtered set of documents.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-function-score-query.html

func NewFunctionScoreQuery

func NewFunctionScoreQuery() *FunctionScoreQuery

NewFunctionScoreQuery creates and initializes a new function score query.

func (*FunctionScoreQuery) Add

func (q *FunctionScoreQuery) Add(filter Query, scoreFunc ScoreFunction) *FunctionScoreQuery

Add adds a score function that will execute on all the documents matching the filter.

func (*FunctionScoreQuery) AddScoreFunc

func (q *FunctionScoreQuery) AddScoreFunc(scoreFunc ScoreFunction) *FunctionScoreQuery

AddScoreFunc adds a score function that will execute the function on all documents.

func (*FunctionScoreQuery) Boost

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 (*FunctionScoreQuery) BoostMode

func (q *FunctionScoreQuery) BoostMode(boostMode string) *FunctionScoreQuery

BoostMode defines how the combined result of score functions will influence the final score together with the sub query score.

func (*FunctionScoreQuery) Filter

func (q *FunctionScoreQuery) Filter(filter Query) *FunctionScoreQuery

Filter sets the filter for the function score query.

func (*FunctionScoreQuery) MaxBoost

func (q *FunctionScoreQuery) MaxBoost(maxBoost float64) *FunctionScoreQuery

MaxBoost is the maximum boost that will be applied by function score.

func (*FunctionScoreQuery) MinScore

func (q *FunctionScoreQuery) MinScore(minScore float64) *FunctionScoreQuery

MinScore sets the minimum score.

func (*FunctionScoreQuery) Query

func (q *FunctionScoreQuery) Query(query Query) *FunctionScoreQuery

Query sets the query for the function score query.

func (*FunctionScoreQuery) ScoreMode

func (q *FunctionScoreQuery) ScoreMode(scoreMode string) *FunctionScoreQuery

ScoreMode defines how results of individual score functions will be aggregated. Can be first, avg, max, sum, min, or multiply.

func (*FunctionScoreQuery) Source

func (q *FunctionScoreQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

type FuzzyCompletionSuggesterOptions

type FuzzyCompletionSuggesterOptions struct {
	// contains filtered or unexported fields
}

FuzzyCompletionSuggesterOptions represents the options for fuzzy completion suggester.

func NewFuzzyCompletionSuggesterOptions

func NewFuzzyCompletionSuggesterOptions() *FuzzyCompletionSuggesterOptions

NewFuzzyCompletionSuggesterOptions initializes a new FuzzyCompletionSuggesterOptions instance.

func (*FuzzyCompletionSuggesterOptions) EditDistance

func (o *FuzzyCompletionSuggesterOptions) EditDistance(editDistance interface{}) *FuzzyCompletionSuggesterOptions

EditDistance specifies the maximum number of edits, e.g. a number like "1" or "2" or a string like "0..2" or ">5".

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/common-options.html#fuzziness for details.

func (*FuzzyCompletionSuggesterOptions) MaxDeterminizedStates

MaxDeterminizedStates is currently undocumented in Elasticsearch. It represents the maximum automaton states allowed for fuzzy expansion.

func (*FuzzyCompletionSuggesterOptions) MinLength

MinLength represents the minimum length of the input before fuzzy suggestions are returned (defaults to 3).

func (*FuzzyCompletionSuggesterOptions) PrefixLength

PrefixLength represents the minimum length of the input, which is not checked for fuzzy alternatives (defaults to 1).

func (*FuzzyCompletionSuggesterOptions) Source

func (o *FuzzyCompletionSuggesterOptions) Source() (interface{}, error)

Source creates the JSON data.

func (*FuzzyCompletionSuggesterOptions) Transpositions

func (o *FuzzyCompletionSuggesterOptions) Transpositions(transpositions bool) *FuzzyCompletionSuggesterOptions

Transpositions, if set to true, are counted as one change instead of two (defaults to true).

func (*FuzzyCompletionSuggesterOptions) UnicodeAware

UnicodeAware, if true, all measurements (like fuzzy edit distance, transpositions, and lengths) are measured in Unicode code points instead of in bytes. This is slightly slower than raw bytes, so it is set to false by default.

type FuzzyQuery

type FuzzyQuery struct {
	// contains filtered or unexported fields
}

FuzzyQuery uses similarity based on Levenshtein edit distance for string fields, and a +/- margin on numeric and date fields.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-fuzzy-query.html

func NewFuzzyQuery

func NewFuzzyQuery(name string, value interface{}) *FuzzyQuery

NewFuzzyQuery creates a new fuzzy query.

func (*FuzzyQuery) Boost

func (q *FuzzyQuery) Boost(boost float64) *FuzzyQuery

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 (*FuzzyQuery) Fuzziness

func (q *FuzzyQuery) Fuzziness(fuzziness interface{}) *FuzzyQuery

Fuzziness can be an integer/long like 0, 1 or 2 as well as strings like "auto", "0..1", "1..4" or "0.0..1.0".

func (*FuzzyQuery) MaxExpansions

func (q *FuzzyQuery) MaxExpansions(maxExpansions int) *FuzzyQuery

func (*FuzzyQuery) PrefixLength

func (q *FuzzyQuery) PrefixLength(prefixLength int) *FuzzyQuery

func (*FuzzyQuery) QueryName

func (q *FuzzyQuery) QueryName(queryName string) *FuzzyQuery

QueryName sets the query name for the filter that can be used when searching for matched filters per hit.

func (*FuzzyQuery) Rewrite

func (q *FuzzyQuery) Rewrite(rewrite string) *FuzzyQuery

func (*FuzzyQuery) Source

func (q *FuzzyQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

func (*FuzzyQuery) Transpositions

func (q *FuzzyQuery) Transpositions(transpositions bool) *FuzzyQuery

type GNDSignificanceHeuristic

type GNDSignificanceHeuristic struct {
	// contains filtered or unexported fields
}

GNDSignificanceHeuristic implements the "Google Normalized Distance" as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-significantterms-aggregation.html#_google_normalized_distance for details.

func NewGNDSignificanceHeuristic

func NewGNDSignificanceHeuristic() *GNDSignificanceHeuristic

NewGNDSignificanceHeuristic implements a new GNDSignificanceHeuristic.

func (*GNDSignificanceHeuristic) BackgroundIsSuperset

func (sh *GNDSignificanceHeuristic) BackgroundIsSuperset(backgroundIsSuperset bool) *GNDSignificanceHeuristic

BackgroundIsSuperset indicates whether you defined a custom background filter that represents a difference set of documents that you want to compare to.

func (*GNDSignificanceHeuristic) Name

func (sh *GNDSignificanceHeuristic) Name() string

Name returns the name of the heuristic in the REST interface.

func (*GNDSignificanceHeuristic) Source

func (sh *GNDSignificanceHeuristic) Source() (interface{}, error)

Source returns the parameters that need to be added to the REST parameters.

type GaussDecayFunction

type GaussDecayFunction struct {
	// contains filtered or unexported fields
}

GaussDecayFunction builds a gauss decay score function. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-function-score-query.html for details.

func NewGaussDecayFunction

func NewGaussDecayFunction() *GaussDecayFunction

NewGaussDecayFunction returns a new GaussDecayFunction.

func (*GaussDecayFunction) Decay

func (fn *GaussDecayFunction) Decay(decay float64) *GaussDecayFunction

Decay defines how documents are scored at the distance given a Scale. If no decay is defined, documents at the distance Scale will be scored 0.5.

func (*GaussDecayFunction) FieldName

func (fn *GaussDecayFunction) FieldName(fieldName string) *GaussDecayFunction

FieldName specifies the name of the field to which this decay function is applied to.

func (*GaussDecayFunction) GetWeight

func (fn *GaussDecayFunction) GetWeight() *float64

GetWeight returns the adjusted score. It is part of the ScoreFunction interface. Returns nil if weight is not specified.

func (*GaussDecayFunction) MultiValueMode

func (fn *GaussDecayFunction) MultiValueMode(mode string) *GaussDecayFunction

MultiValueMode specifies how the decay function should be calculated on a field that has multiple values. Valid modes are: min, max, avg, and sum.

func (*GaussDecayFunction) Name

func (fn *GaussDecayFunction) Name() string

Name represents the JSON field name under which the output of Source needs to be serialized by FunctionScoreQuery (see FunctionScoreQuery.Source).

func (*GaussDecayFunction) Offset

func (fn *GaussDecayFunction) Offset(offset interface{}) *GaussDecayFunction

Offset, if defined, computes the decay function only for a distance greater than the defined offset.

func (*GaussDecayFunction) Origin

func (fn *GaussDecayFunction) Origin(origin interface{}) *GaussDecayFunction

Origin defines the "central point" by which the decay function calculates "distance".

func (*GaussDecayFunction) Scale

func (fn *GaussDecayFunction) Scale(scale interface{}) *GaussDecayFunction

Scale defines the scale to be used with Decay.

func (*GaussDecayFunction) Source

func (fn *GaussDecayFunction) Source() (interface{}, error)

Source returns the serializable JSON data of this score function.

func (*GaussDecayFunction) Weight

func (fn *GaussDecayFunction) Weight(weight float64) *GaussDecayFunction

Weight adjusts the score of the score function. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-function-score-query.html#_using_function_score for details.

type GeoBoundingBoxQuery

type GeoBoundingBoxQuery struct {
	// contains filtered or unexported fields
}

GeoBoundingBoxQuery allows to filter hits based on a point location using a bounding box.

For more details, see: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-geo-bounding-box-query.html

func NewGeoBoundingBoxQuery

func NewGeoBoundingBoxQuery(name string) *GeoBoundingBoxQuery

NewGeoBoundingBoxQuery creates and initializes a new GeoBoundingBoxQuery.

func (*GeoBoundingBoxQuery) BottomLeft

func (q *GeoBoundingBoxQuery) BottomLeft(bottom, left float64) *GeoBoundingBoxQuery

BottomLeft position from longitude (left) and latitude (bottom).

func (*GeoBoundingBoxQuery) BottomLeftFromGeoHash added in v7.0.29

func (q *GeoBoundingBoxQuery) BottomLeftFromGeoHash(bottomLeft string) *GeoBoundingBoxQuery

BottomLeftFromGeoHash from a Geo hash.

func (*GeoBoundingBoxQuery) BottomLeftFromGeoPoint

func (q *GeoBoundingBoxQuery) BottomLeftFromGeoPoint(point *GeoPoint) *GeoBoundingBoxQuery

BottomLeftFromGeoPoint from a GeoPoint.

func (*GeoBoundingBoxQuery) BottomRight

func (q *GeoBoundingBoxQuery) BottomRight(bottom, right float64) *GeoBoundingBoxQuery

BottomRight position from longitude (right) and latitude (bottom).

func (*GeoBoundingBoxQuery) BottomRightFromGeoHash added in v7.0.29

func (q *GeoBoundingBoxQuery) BottomRightFromGeoHash(bottomRight string) *GeoBoundingBoxQuery

BottomRightFromGeoHash from a Geo hash.

func (*GeoBoundingBoxQuery) BottomRightFromGeoPoint

func (q *GeoBoundingBoxQuery) BottomRightFromGeoPoint(point *GeoPoint) *GeoBoundingBoxQuery

BottomRightFromGeoPoint from a GeoPoint.

func (*GeoBoundingBoxQuery) IgnoreUnmapped added in v7.0.29

func (q *GeoBoundingBoxQuery) IgnoreUnmapped(ignoreUnmapped bool) *GeoBoundingBoxQuery

IgnoreUnmapped indicates whether to ignore unmapped fields (and run a MatchNoDocsQuery in place of this).

func (*GeoBoundingBoxQuery) QueryName

func (q *GeoBoundingBoxQuery) QueryName(queryName string) *GeoBoundingBoxQuery

QueryName gives the query a name. It is used for caching.

func (*GeoBoundingBoxQuery) Source

func (q *GeoBoundingBoxQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

func (*GeoBoundingBoxQuery) TopLeft

func (q *GeoBoundingBoxQuery) TopLeft(top, left float64) *GeoBoundingBoxQuery

TopLeft position from longitude (left) and latitude (top).

func (*GeoBoundingBoxQuery) TopLeftFromGeoHash added in v7.0.29

func (q *GeoBoundingBoxQuery) TopLeftFromGeoHash(topLeft string) *GeoBoundingBoxQuery

TopLeftFromGeoHash from a Geo hash.

func (*GeoBoundingBoxQuery) TopLeftFromGeoPoint

func (q *GeoBoundingBoxQuery) TopLeftFromGeoPoint(point *GeoPoint) *GeoBoundingBoxQuery

TopLeftFromGeoPoint from a GeoPoint.

func (*GeoBoundingBoxQuery) TopRight

func (q *GeoBoundingBoxQuery) TopRight(top, right float64) *GeoBoundingBoxQuery

TopRight position from longitude (right) and latitude (top).

func (*GeoBoundingBoxQuery) TopRightFromGeoHash added in v7.0.29

func (q *GeoBoundingBoxQuery) TopRightFromGeoHash(topRight string) *GeoBoundingBoxQuery

TopRightFromGeoHash from a Geo hash.

func (*GeoBoundingBoxQuery) TopRightFromGeoPoint

func (q *GeoBoundingBoxQuery) TopRightFromGeoPoint(point *GeoPoint) *GeoBoundingBoxQuery

TopRightFromGeoPoint from a GeoPoint.

func (*GeoBoundingBoxQuery) Type

Type sets the type of executing the geo bounding box. It can be either memory or indexed. It defaults to memory.

func (*GeoBoundingBoxQuery) ValidationMethod added in v7.0.29

func (q *GeoBoundingBoxQuery) ValidationMethod(method string) *GeoBoundingBoxQuery

ValidationMethod accepts IGNORE_MALFORMED, COERCE, and STRICT (default). IGNORE_MALFORMED accepts geo points with invalid lat/lon. COERCE tries to infer the correct lat/lon.

func (*GeoBoundingBoxQuery) WKT added in v7.0.29

func (q *GeoBoundingBoxQuery) WKT(wkt interface{}) *GeoBoundingBoxQuery

WKT initializes the bounding box from Well-Known Text (WKT), e.g. "BBOX (-74.1, -71.12, 40.73, 40.01)".

type GeoBoundsAggregation

type GeoBoundsAggregation struct {
	// contains filtered or unexported fields
}

GeoBoundsAggregation is a metric aggregation that computes the bounding box containing all geo_point values for a field. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-metrics-geobounds-aggregation.html

func NewGeoBoundsAggregation

func NewGeoBoundsAggregation() *GeoBoundsAggregation

func (*GeoBoundsAggregation) Field

func (*GeoBoundsAggregation) Meta

func (a *GeoBoundsAggregation) Meta(metaData map[string]interface{}) *GeoBoundsAggregation

Meta sets the meta data to be included in the aggregation response.

func (*GeoBoundsAggregation) Script

func (a *GeoBoundsAggregation) Script(script *Script) *GeoBoundsAggregation

func (*GeoBoundsAggregation) Source

func (a *GeoBoundsAggregation) Source() (interface{}, error)

func (*GeoBoundsAggregation) SubAggregation

func (a *GeoBoundsAggregation) SubAggregation(name string, subAggregation Aggregation) *GeoBoundsAggregation

func (*GeoBoundsAggregation) WrapLongitude

func (a *GeoBoundsAggregation) WrapLongitude(wrapLongitude bool) *GeoBoundsAggregation

type GeoCentroidAggregation

type GeoCentroidAggregation struct {
	// contains filtered or unexported fields
}

GeoCentroidAggregation is a metric aggregation that computes the weighted centroid from all coordinate values for a Geo-point datatype field. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-metrics-geocentroid-aggregation.html

func NewGeoCentroidAggregation

func NewGeoCentroidAggregation() *GeoCentroidAggregation

func (*GeoCentroidAggregation) Field

func (*GeoCentroidAggregation) Meta

func (a *GeoCentroidAggregation) Meta(metaData map[string]interface{}) *GeoCentroidAggregation

Meta sets the meta data to be included in the aggregation response.

func (*GeoCentroidAggregation) Script

func (*GeoCentroidAggregation) Source

func (a *GeoCentroidAggregation) Source() (interface{}, error)

func (*GeoCentroidAggregation) SubAggregation

func (a *GeoCentroidAggregation) SubAggregation(name string, subAggregation Aggregation) *GeoCentroidAggregation

type GeoDistanceAggregation

type GeoDistanceAggregation struct {
	// contains filtered or unexported fields
}

GeoDistanceAggregation is a multi-bucket aggregation that works on geo_point fields and conceptually works very similar to the range aggregation. The user can define a point of origin and a set of distance range buckets. The aggregation evaluate the distance of each document value from the origin point and determines the buckets it belongs to based on the ranges (a document belongs to a bucket if the distance between the document and the origin falls within the distance range of the bucket). See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-geodistance-aggregation.html

func NewGeoDistanceAggregation

func NewGeoDistanceAggregation() *GeoDistanceAggregation

func (*GeoDistanceAggregation) AddRange

func (a *GeoDistanceAggregation) AddRange(from, to interface{}) *GeoDistanceAggregation

func (*GeoDistanceAggregation) AddRangeWithKey

func (a *GeoDistanceAggregation) AddRangeWithKey(key string, from, to interface{}) *GeoDistanceAggregation

func (*GeoDistanceAggregation) AddUnboundedFrom

func (a *GeoDistanceAggregation) AddUnboundedFrom(to float64) *GeoDistanceAggregation

func (*GeoDistanceAggregation) AddUnboundedFromWithKey

func (a *GeoDistanceAggregation) AddUnboundedFromWithKey(key string, to float64) *GeoDistanceAggregation

func (*GeoDistanceAggregation) AddUnboundedTo

func (a *GeoDistanceAggregation) AddUnboundedTo(from float64) *GeoDistanceAggregation

func (*GeoDistanceAggregation) AddUnboundedToWithKey

func (a *GeoDistanceAggregation) AddUnboundedToWithKey(key string, from float64) *GeoDistanceAggregation

func (*GeoDistanceAggregation) Between

func (a *GeoDistanceAggregation) Between(from, to interface{}) *GeoDistanceAggregation

func (*GeoDistanceAggregation) BetweenWithKey

func (a *GeoDistanceAggregation) BetweenWithKey(key string, from, to interface{}) *GeoDistanceAggregation

func (*GeoDistanceAggregation) DistanceType

func (a *GeoDistanceAggregation) DistanceType(distanceType string) *GeoDistanceAggregation

func (*GeoDistanceAggregation) Field

func (*GeoDistanceAggregation) Meta

func (a *GeoDistanceAggregation) Meta(metaData map[string]interface{}) *GeoDistanceAggregation

Meta sets the meta data to be included in the aggregation response.

func (*GeoDistanceAggregation) Point

func (*GeoDistanceAggregation) Source

func (a *GeoDistanceAggregation) Source() (interface{}, error)

func (*GeoDistanceAggregation) SubAggregation

func (a *GeoDistanceAggregation) SubAggregation(name string, subAggregation Aggregation) *GeoDistanceAggregation

func (*GeoDistanceAggregation) Unit

type GeoDistanceQuery

type GeoDistanceQuery struct {
	// contains filtered or unexported fields
}

GeoDistanceQuery filters documents that include only hits that exists within a specific distance from a geo point.

For more details, see: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-geo-distance-query.html

func NewGeoDistanceQuery

func NewGeoDistanceQuery(name string) *GeoDistanceQuery

NewGeoDistanceQuery creates and initializes a new GeoDistanceQuery.

func (*GeoDistanceQuery) Distance

func (q *GeoDistanceQuery) Distance(distance string) *GeoDistanceQuery

func (*GeoDistanceQuery) DistanceType

func (q *GeoDistanceQuery) DistanceType(distanceType string) *GeoDistanceQuery

func (*GeoDistanceQuery) GeoHash

func (q *GeoDistanceQuery) GeoHash(geohash string) *GeoDistanceQuery

func (*GeoDistanceQuery) GeoPoint

func (q *GeoDistanceQuery) GeoPoint(point *GeoPoint) *GeoDistanceQuery

func (*GeoDistanceQuery) Lat

func (*GeoDistanceQuery) Lon

func (*GeoDistanceQuery) Point

func (q *GeoDistanceQuery) Point(lat, lon float64) *GeoDistanceQuery

func (*GeoDistanceQuery) QueryName

func (q *GeoDistanceQuery) QueryName(queryName string) *GeoDistanceQuery

func (*GeoDistanceQuery) Source

func (q *GeoDistanceQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

type GeoDistanceSort

type GeoDistanceSort struct {
	Sorter
	// contains filtered or unexported fields
}

GeoDistanceSort allows for sorting by geographic distance. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-sort.html#_geo_distance_sorting.

func NewGeoDistanceSort

func NewGeoDistanceSort(fieldName string) *GeoDistanceSort

NewGeoDistanceSort creates a new sorter for geo distances.

func (*GeoDistanceSort) Asc

func (s *GeoDistanceSort) Asc() *GeoDistanceSort

Asc sets ascending sort order.

func (*GeoDistanceSort) Desc

func (s *GeoDistanceSort) Desc() *GeoDistanceSort

Desc sets descending sort order.

func (*GeoDistanceSort) DistanceType

func (s *GeoDistanceSort) DistanceType(distanceType string) *GeoDistanceSort

DistanceType describes how to compute the distance, e.g. "arc" or "plane". See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-sort.html#geo-sorting for details.

func (*GeoDistanceSort) FieldName

func (s *GeoDistanceSort) FieldName(fieldName string) *GeoDistanceSort

FieldName specifies the name of the (geo) field to use for sorting.

func (*GeoDistanceSort) GeoDistance

func (s *GeoDistanceSort) GeoDistance(geoDistance string) *GeoDistanceSort

GeoDistance is an alias for DistanceType.

func (*GeoDistanceSort) GeoHashes

func (s *GeoDistanceSort) GeoHashes(geohashes ...string) *GeoDistanceSort

GeoHashes specifies the geo point to create the range distance aggregations from.

func (*GeoDistanceSort) IgnoreUnmapped added in v7.0.27

func (s *GeoDistanceSort) IgnoreUnmapped(ignoreUnmapped bool) *GeoDistanceSort

IgnoreUnmapped indicates whether the unmapped field should be treated as a missing value. Setting it to true is equivalent to specifying an unmapped_type in the field sort. The default is false (unmapped field causes the search to fail).

func (*GeoDistanceSort) NestedFilter

func (s *GeoDistanceSort) NestedFilter(nestedFilter Query) *GeoDistanceSort

NestedFilter sets a filter that nested objects should match with in order to be taken into account for sorting.

func (*GeoDistanceSort) NestedPath

func (s *GeoDistanceSort) NestedPath(nestedPath string) *GeoDistanceSort

NestedPath is used if sorting occurs on a field that is inside a nested object.

func (*GeoDistanceSort) NestedSort

func (s *GeoDistanceSort) NestedSort(nestedSort *NestedSort) *GeoDistanceSort

NestedSort is available starting with 6.1 and will replace NestedFilter and NestedPath.

func (*GeoDistanceSort) Order

func (s *GeoDistanceSort) Order(ascending bool) *GeoDistanceSort

Order defines whether sorting ascending (default) or descending.

func (*GeoDistanceSort) Point

func (s *GeoDistanceSort) Point(lat, lon float64) *GeoDistanceSort

Point specifies a point to create the range distance aggregations from.

func (*GeoDistanceSort) Points

func (s *GeoDistanceSort) Points(points ...*GeoPoint) *GeoDistanceSort

Points specifies the geo point(s) to create the range distance aggregations from.

func (*GeoDistanceSort) SortMode

func (s *GeoDistanceSort) SortMode(sortMode string) *GeoDistanceSort

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 (*GeoDistanceSort) Source

func (s *GeoDistanceSort) Source() (interface{}, error)

Source returns the JSON-serializable data.

func (*GeoDistanceSort) Unit

func (s *GeoDistanceSort) Unit(unit string) *GeoDistanceSort

Unit specifies the distance unit to use. It defaults to km. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/common-options.html#distance-units for details.

type GeoHashGridAggregation

type GeoHashGridAggregation struct {
	// contains filtered or unexported fields
}

func NewGeoHashGridAggregation

func NewGeoHashGridAggregation() *GeoHashGridAggregation

func (*GeoHashGridAggregation) Field

func (*GeoHashGridAggregation) Meta

func (a *GeoHashGridAggregation) Meta(metaData map[string]interface{}) *GeoHashGridAggregation

func (*GeoHashGridAggregation) Precision

func (a *GeoHashGridAggregation) Precision(precision interface{}) *GeoHashGridAggregation

Precision accepts the level as int value between 1 and 12 or Distance Units like "2km", "5mi" as described at https://www.elastic.co/guide/en/elasticsearch/reference/7.0/common-options.html#distance-units and https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-geohashgrid-aggregation.html

func (*GeoHashGridAggregation) ShardSize

func (a *GeoHashGridAggregation) ShardSize(shardSize int) *GeoHashGridAggregation

func (*GeoHashGridAggregation) Size

func (*GeoHashGridAggregation) Source

func (a *GeoHashGridAggregation) Source() (interface{}, error)

func (*GeoHashGridAggregation) SubAggregation

func (a *GeoHashGridAggregation) SubAggregation(name string, subAggregation Aggregation) *GeoHashGridAggregation

type GeoPoint

type GeoPoint struct {
	Lat float64 `json:"lat"`
	Lon float64 `json:"lon"`
}

GeoPoint is a geographic position described via latitude and longitude.

func GeoPointFromLatLon

func GeoPointFromLatLon(lat, lon float64) *GeoPoint

GeoPointFromLatLon initializes a new GeoPoint by latitude and longitude.

func GeoPointFromString

func GeoPointFromString(latLon string) (*GeoPoint, error)

GeoPointFromString initializes a new GeoPoint by a string that is formatted as "{latitude},{longitude}", e.g. "40.10210,-70.12091".

func (*GeoPoint) MarshalJSON

func (pt *GeoPoint) MarshalJSON() ([]byte, error)

MarshalJSON encodes the GeoPoint to JSON.

func (*GeoPoint) Source

func (pt *GeoPoint) Source() map[string]float64

Source returns the object to be serialized in Elasticsearch DSL.

type GeoPolygonQuery

type GeoPolygonQuery struct {
	// contains filtered or unexported fields
}

GeoPolygonQuery allows to include hits that only fall within a polygon of points.

For more details, see: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-geo-polygon-query.html

func NewGeoPolygonQuery

func NewGeoPolygonQuery(name string) *GeoPolygonQuery

NewGeoPolygonQuery creates and initializes a new GeoPolygonQuery.

func (*GeoPolygonQuery) AddGeoPoint

func (q *GeoPolygonQuery) AddGeoPoint(point *GeoPoint) *GeoPolygonQuery

AddGeoPoint adds a GeoPoint.

func (*GeoPolygonQuery) AddPoint

func (q *GeoPolygonQuery) AddPoint(lat, lon float64) *GeoPolygonQuery

AddPoint adds a point from latitude and longitude.

func (*GeoPolygonQuery) QueryName

func (q *GeoPolygonQuery) QueryName(queryName string) *GeoPolygonQuery

func (*GeoPolygonQuery) Source

func (q *GeoPolygonQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

type GeoTileGridAggregation added in v7.0.23

type GeoTileGridAggregation struct {
	// contains filtered or unexported fields
}

func NewGeoTileGridAggregation added in v7.0.23

func NewGeoTileGridAggregation() *GeoTileGridAggregation

NewGeoTileGridAggregation Create new bucket aggregation of Geotile grid type https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-geotilegrid-aggregation.html

func (*GeoTileGridAggregation) Bounds added in v7.0.23

Bounds The bounding box to filter the points in the bucket. Optional.

func (*GeoTileGridAggregation) Field added in v7.0.23

Field The name of the field indexed with GeoPoints. Mandatory.

func (*GeoTileGridAggregation) Meta added in v7.0.23

func (a *GeoTileGridAggregation) Meta(metaData map[string]interface{}) *GeoTileGridAggregation

Meta Sets the meta data to be included in the aggregation response.

func (*GeoTileGridAggregation) Precision added in v7.0.23

func (a *GeoTileGridAggregation) Precision(precision int) *GeoTileGridAggregation

Precision The integer zoom of the key used to define cells/buckets in the results. Defaults to 7. Values outside of [0,29] will be rejected. Optional.

func (*GeoTileGridAggregation) ShardSize added in v7.0.23

func (a *GeoTileGridAggregation) ShardSize(shardSize int) *GeoTileGridAggregation

ShardSize The maximum number of buckets to return from each shard. Optional.

func (*GeoTileGridAggregation) Size added in v7.0.23

Size The maximum number of buckets to return in the result structure. Optional.

func (*GeoTileGridAggregation) Source added in v7.0.23

func (a *GeoTileGridAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

func (*GeoTileGridAggregation) SubAggregation added in v7.0.23

func (a *GeoTileGridAggregation) SubAggregation(name string, subAggregation Aggregation) *GeoTileGridAggregation

SubAggregation Adds a sub-aggregation to this aggregation.

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
	SeqNo       *int64                 `json:"_seq_no"`
	PrimaryTerm *int64                 `json:"_primary_term"`
	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 GetScriptResponse

type GetScriptResponse struct {
	Id     string          `json:"_id"`
	Found  bool            `json:"found"`
	Script json.RawMessage `json:"script"`
}

GetScriptResponse is the result of getting a stored script in Elasticsearch.

type GetScriptService

type GetScriptService struct {
	// contains filtered or unexported fields
}

GetScriptService reads a stored script in Elasticsearch.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/modules-scripting.html for details.

func NewGetScriptService

func NewGetScriptService(client *Client) *GetScriptService

NewGetScriptService creates a new GetScriptService.

func (*GetScriptService) Do

Do executes the operation.

func (*GetScriptService) ErrorTrace added in v7.0.7

func (s *GetScriptService) ErrorTrace(errorTrace bool) *GetScriptService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*GetScriptService) FilterPath added in v7.0.7

func (s *GetScriptService) FilterPath(filterPath ...string) *GetScriptService

FilterPath specifies a list of filters used to reduce the response.

func (*GetScriptService) Header added in v7.0.7

func (s *GetScriptService) Header(name string, value string) *GetScriptService

Header adds a header to the request.

func (*GetScriptService) Headers added in v7.0.7

func (s *GetScriptService) Headers(headers http.Header) *GetScriptService

Headers specifies the headers of the request.

func (*GetScriptService) Human added in v7.0.7

func (s *GetScriptService) Human(human bool) *GetScriptService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*GetScriptService) Id

Id is the script ID.

func (*GetScriptService) Pretty

func (s *GetScriptService) Pretty(pretty bool) *GetScriptService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*GetScriptService) Validate

func (s *GetScriptService) Validate() error

Validate checks if the operation is valid.

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/7.0/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) ErrorTrace added in v7.0.7

func (s *GetService) ErrorTrace(errorTrace bool) *GetService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*GetService) FetchSource

func (s *GetService) FetchSource(fetchSource bool) *GetService

func (*GetService) FetchSourceContext

func (s *GetService) FetchSourceContext(fetchSourceContext *FetchSourceContext) *GetService

func (*GetService) FilterPath added in v7.0.7

func (s *GetService) FilterPath(filterPath ...string) *GetService

FilterPath specifies a list of filters used to reduce the response.

func (*GetService) Header added in v7.0.7

func (s *GetService) Header(name string, value string) *GetService

Header adds a header to the request.

func (*GetService) Headers added in v7.0.7

func (s *GetService) Headers(headers http.Header) *GetService

Headers specifies the headers of the request.

func (*GetService) Human added in v7.0.7

func (s *GetService) Human(human bool) *GetService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*GetService) Id

func (s *GetService) Id(id string) *GetService

Id is the document ID.

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 tells Elasticsearch whether to return a formatted JSON response.

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.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-refresh.html for details.

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 deprecated

func (s *GetService) Type(typ string) *GetService

Type is the type of the document

Deprecated: Types are in the process of being removed.

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 GlobalAggregation

type GlobalAggregation struct {
	// contains filtered or unexported fields
}

GlobalAggregation defines a single bucket of all the documents within the search execution context. This context is defined by the indices and the document types you’re searching on, but is not influenced by the search query itself. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-global-aggregation.html

func NewGlobalAggregation

func NewGlobalAggregation() *GlobalAggregation

func (*GlobalAggregation) Meta

func (a *GlobalAggregation) Meta(metaData map[string]interface{}) *GlobalAggregation

Meta sets the meta data to be included in the aggregation response.

func (*GlobalAggregation) Source

func (a *GlobalAggregation) Source() (interface{}, error)

func (*GlobalAggregation) SubAggregation

func (a *GlobalAggregation) SubAggregation(name string, subAggregation Aggregation) *GlobalAggregation

type HasChildQuery

type HasChildQuery struct {
	// contains filtered or unexported fields
}

HasChildQuery accepts a query and the child type to run against, and results in parent documents that have child docs matching the query.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-has-child-query.html

func NewHasChildQuery

func NewHasChildQuery(childType string, query Query) *HasChildQuery

NewHasChildQuery creates and initializes a new has_child query.

func (*HasChildQuery) Boost

func (q *HasChildQuery) Boost(boost float64) *HasChildQuery

Boost sets the boost for this query.

func (*HasChildQuery) InnerHit

func (q *HasChildQuery) InnerHit(innerHit *InnerHit) *HasChildQuery

InnerHit sets the inner hit definition in the scope of this query and reusing the defined type and query.

func (*HasChildQuery) MaxChildren

func (q *HasChildQuery) MaxChildren(maxChildren int) *HasChildQuery

MaxChildren defines the maximum number of children that are required to match for the parent to be considered a match.

func (*HasChildQuery) MinChildren

func (q *HasChildQuery) MinChildren(minChildren int) *HasChildQuery

MinChildren defines the minimum number of children that are required to match for the parent to be considered a match.

func (*HasChildQuery) QueryName

func (q *HasChildQuery) QueryName(queryName string) *HasChildQuery

QueryName specifies the query name for the filter that can be used when searching for matched filters per hit.

func (*HasChildQuery) ScoreMode

func (q *HasChildQuery) ScoreMode(scoreMode string) *HasChildQuery

ScoreMode defines how the scores from the matching child documents are mapped into the parent document. Allowed values are: min, max, avg, or none.

func (*HasChildQuery) ShortCircuitCutoff

func (q *HasChildQuery) ShortCircuitCutoff(shortCircuitCutoff int) *HasChildQuery

ShortCircuitCutoff configures what cut off point only to evaluate parent documents that contain the matching parent id terms instead of evaluating all parent docs.

func (*HasChildQuery) Source

func (q *HasChildQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

type HasParentQuery

type HasParentQuery struct {
	// contains filtered or unexported fields
}

HasParentQuery accepts a query and a parent type. The query is executed in the parent document space which is specified by the parent type. This query returns child documents which associated parents have matched. For the rest has_parent query has the same options and works in the same manner as has_child query.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-has-parent-query.html

func NewHasParentQuery

func NewHasParentQuery(parentType string, query Query) *HasParentQuery

NewHasParentQuery creates and initializes a new has_parent query.

func (*HasParentQuery) Boost

func (q *HasParentQuery) Boost(boost float64) *HasParentQuery

Boost sets the boost for this query.

func (*HasParentQuery) IgnoreUnmapped

func (q *HasParentQuery) IgnoreUnmapped(ignore bool) *HasParentQuery

IgnoreUnmapped specifies whether unmapped types should be ignored. If set to false, the query failes when an unmapped type is found.

func (*HasParentQuery) InnerHit

func (q *HasParentQuery) InnerHit(innerHit *InnerHit) *HasParentQuery

InnerHit sets the inner hit definition in the scope of this query and reusing the defined type and query.

func (*HasParentQuery) QueryName

func (q *HasParentQuery) QueryName(queryName string) *HasParentQuery

QueryName specifies the query name for the filter that can be used when searching for matched filters per hit.

func (*HasParentQuery) Score

func (q *HasParentQuery) Score(score bool) *HasParentQuery

Score defines if the parent score is mapped into the child documents.

func (*HasParentQuery) Source

func (q *HasParentQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

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/7.0/search-request-highlighting.html

func NewHighlight

func NewHighlight() *Highlight

func (*Highlight) BoundaryChars

func (hl *Highlight) BoundaryChars(boundaryChars string) *Highlight

func (*Highlight) BoundaryMaxScan

func (hl *Highlight) BoundaryMaxScan(boundaryMaxScan int) *Highlight

func (*Highlight) BoundaryScannerLocale

func (hl *Highlight) BoundaryScannerLocale(boundaryScannerLocale string) *Highlight

func (*Highlight) BoundaryScannerType

func (hl *Highlight) BoundaryScannerType(boundaryScannerType string) *Highlight

func (*Highlight) Encoder

func (hl *Highlight) Encoder(encoder string) *Highlight

func (*Highlight) Field

func (hl *Highlight) Field(name string) *Highlight

func (*Highlight) Fields

func (hl *Highlight) Fields(fields ...*HighlighterField) *Highlight

func (*Highlight) ForceSource

func (hl *Highlight) ForceSource(forceSource bool) *Highlight

func (*Highlight) FragmentSize

func (hl *Highlight) FragmentSize(fragmentSize int) *Highlight

func (*Highlight) Fragmenter

func (hl *Highlight) Fragmenter(fragmenter string) *Highlight

func (*Highlight) HighlightFilter

func (hl *Highlight) HighlightFilter(highlightFilter bool) *Highlight

func (*Highlight) HighlightQuery

func (hl *Highlight) HighlightQuery(highlightQuery Query) *Highlight

func (*Highlight) HighlighterType

func (hl *Highlight) HighlighterType(highlighterType string) *Highlight

func (*Highlight) MaxAnalyzedOffset added in v7.0.32

func (hl *Highlight) MaxAnalyzedOffset(maxAnalyzedOffset int) *Highlight

func (*Highlight) NoMatchSize

func (hl *Highlight) NoMatchSize(noMatchSize int) *Highlight

func (*Highlight) NumOfFragments

func (hl *Highlight) NumOfFragments(numOfFragments int) *Highlight

func (*Highlight) Options

func (hl *Highlight) Options(options map[string]interface{}) *Highlight

func (*Highlight) Order

func (hl *Highlight) Order(order string) *Highlight

func (*Highlight) PostTags

func (hl *Highlight) PostTags(postTags ...string) *Highlight

func (*Highlight) PreTags

func (hl *Highlight) PreTags(preTags ...string) *Highlight

func (*Highlight) RequireFieldMatch

func (hl *Highlight) RequireFieldMatch(requireFieldMatch bool) *Highlight

func (*Highlight) Source

func (hl *Highlight) Source() (interface{}, error)

Creates the query source for the bool query.

func (*Highlight) TagsSchema

func (hl *Highlight) TagsSchema(schemaName string) *Highlight

func (*Highlight) UseExplicitFieldOrder

func (hl *Highlight) UseExplicitFieldOrder(useExplicitFieldOrder bool) *Highlight

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 HistogramAggregation

type HistogramAggregation struct {
	// contains filtered or unexported fields
}

HistogramAggregation is a multi-bucket values source based aggregation that can be applied on numeric values extracted from the documents. It dynamically builds fixed size (a.k.a. interval) buckets over the values. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-histogram-aggregation.html

func NewHistogramAggregation

func NewHistogramAggregation() *HistogramAggregation

func (*HistogramAggregation) ExtendedBounds

func (a *HistogramAggregation) ExtendedBounds(min, max float64) *HistogramAggregation

func (*HistogramAggregation) ExtendedBoundsMax

func (a *HistogramAggregation) ExtendedBoundsMax(max float64) *HistogramAggregation

func (*HistogramAggregation) ExtendedBoundsMin

func (a *HistogramAggregation) ExtendedBoundsMin(min float64) *HistogramAggregation

func (*HistogramAggregation) Field

func (*HistogramAggregation) Interval

func (a *HistogramAggregation) Interval(interval float64) *HistogramAggregation

Interval for this builder, must be greater than 0.

func (*HistogramAggregation) MaxBounds

func (*HistogramAggregation) Meta

func (a *HistogramAggregation) Meta(metaData map[string]interface{}) *HistogramAggregation

Meta sets the meta data to be included in the aggregation response.

func (*HistogramAggregation) MinBounds

func (*HistogramAggregation) MinDocCount

func (a *HistogramAggregation) MinDocCount(minDocCount int64) *HistogramAggregation

func (*HistogramAggregation) Missing

func (a *HistogramAggregation) Missing(missing interface{}) *HistogramAggregation

Missing configures the value to use when documents miss a value.

func (*HistogramAggregation) Offset

Offset into the histogram

func (*HistogramAggregation) Order

func (a *HistogramAggregation) Order(order string, asc bool) *HistogramAggregation

Order specifies the sort order. Valid values for order are: "_key", "_count", a sub-aggregation name, or a sub-aggregation name with a metric.

func (*HistogramAggregation) OrderByAggregation

func (a *HistogramAggregation) OrderByAggregation(aggName string, asc bool) *HistogramAggregation

OrderByAggregation creates a bucket ordering strategy which sorts buckets based on a single-valued calc get.

func (*HistogramAggregation) OrderByAggregationAndMetric

func (a *HistogramAggregation) OrderByAggregationAndMetric(aggName, metric string, asc bool) *HistogramAggregation

OrderByAggregationAndMetric creates a bucket ordering strategy which sorts buckets based on a multi-valued calc get.

func (*HistogramAggregation) OrderByCount

func (a *HistogramAggregation) OrderByCount(asc bool) *HistogramAggregation

func (*HistogramAggregation) OrderByCountAsc

func (a *HistogramAggregation) OrderByCountAsc() *HistogramAggregation

func (*HistogramAggregation) OrderByCountDesc

func (a *HistogramAggregation) OrderByCountDesc() *HistogramAggregation

func (*HistogramAggregation) OrderByKey

func (a *HistogramAggregation) OrderByKey(asc bool) *HistogramAggregation

func (*HistogramAggregation) OrderByKeyAsc

func (a *HistogramAggregation) OrderByKeyAsc() *HistogramAggregation

func (*HistogramAggregation) OrderByKeyDesc

func (a *HistogramAggregation) OrderByKeyDesc() *HistogramAggregation

func (*HistogramAggregation) Script

func (a *HistogramAggregation) Script(script *Script) *HistogramAggregation

func (*HistogramAggregation) Source

func (a *HistogramAggregation) Source() (interface{}, error)

func (*HistogramAggregation) SubAggregation

func (a *HistogramAggregation) SubAggregation(name string, subAggregation Aggregation) *HistogramAggregation

type HoltLinearMovAvgModel

type HoltLinearMovAvgModel struct {
	// contains filtered or unexported fields
}

HoltLinearMovAvgModel calculates a doubly exponential weighted moving average.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-movavg-aggregation.html#_holt_linear

func NewHoltLinearMovAvgModel

func NewHoltLinearMovAvgModel() *HoltLinearMovAvgModel

NewHoltLinearMovAvgModel creates and initializes a new HoltLinearMovAvgModel.

func (*HoltLinearMovAvgModel) Alpha

Alpha controls the smoothing of the data. Alpha = 1 retains no memory of past values (e.g. a random walk), while alpha = 0 retains infinite memory of past values (e.g. the series mean). Useful values are somewhere in between. Defaults to 0.5.

func (*HoltLinearMovAvgModel) Beta

Beta is equivalent to Alpha but controls the smoothing of the trend instead of the data.

func (*HoltLinearMovAvgModel) Name

func (m *HoltLinearMovAvgModel) Name() string

Name of the model.

func (*HoltLinearMovAvgModel) Settings

func (m *HoltLinearMovAvgModel) Settings() map[string]interface{}

Settings of the model.

type HoltWintersMovAvgModel

type HoltWintersMovAvgModel struct {
	// contains filtered or unexported fields
}

HoltWintersMovAvgModel calculates a triple exponential weighted moving average.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-movavg-aggregation.html#_holt_winters

func NewHoltWintersMovAvgModel

func NewHoltWintersMovAvgModel() *HoltWintersMovAvgModel

NewHoltWintersMovAvgModel creates and initializes a new HoltWintersMovAvgModel.

func (*HoltWintersMovAvgModel) Alpha

Alpha controls the smoothing of the data. Alpha = 1 retains no memory of past values (e.g. a random walk), while alpha = 0 retains infinite memory of past values (e.g. the series mean). Useful values are somewhere in between. Defaults to 0.5.

func (*HoltWintersMovAvgModel) Beta

Beta is equivalent to Alpha but controls the smoothing of the trend instead of the data.

func (*HoltWintersMovAvgModel) Gamma

func (*HoltWintersMovAvgModel) Name

func (m *HoltWintersMovAvgModel) Name() string

Name of the model.

func (*HoltWintersMovAvgModel) Pad

func (*HoltWintersMovAvgModel) Period

func (*HoltWintersMovAvgModel) SeasonalityType

func (m *HoltWintersMovAvgModel) SeasonalityType(typ string) *HoltWintersMovAvgModel

func (*HoltWintersMovAvgModel) Settings

func (m *HoltWintersMovAvgModel) Settings() map[string]interface{}

Settings of the model.

type IPRangeAggregation

type IPRangeAggregation struct {
	// contains filtered or unexported fields
}

IPRangeAggregation is a range aggregation that is dedicated for IP addresses.

See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-iprange-aggregation.html

func NewIPRangeAggregation

func NewIPRangeAggregation() *IPRangeAggregation

func (*IPRangeAggregation) AddMaskRange

func (a *IPRangeAggregation) AddMaskRange(mask string) *IPRangeAggregation

func (*IPRangeAggregation) AddMaskRangeWithKey

func (a *IPRangeAggregation) AddMaskRangeWithKey(key, mask string) *IPRangeAggregation

func (*IPRangeAggregation) AddRange

func (a *IPRangeAggregation) AddRange(from, to string) *IPRangeAggregation

func (*IPRangeAggregation) AddRangeWithKey

func (a *IPRangeAggregation) AddRangeWithKey(key, from, to string) *IPRangeAggregation

func (*IPRangeAggregation) AddUnboundedFrom

func (a *IPRangeAggregation) AddUnboundedFrom(to string) *IPRangeAggregation

func (*IPRangeAggregation) AddUnboundedFromWithKey

func (a *IPRangeAggregation) AddUnboundedFromWithKey(key, to string) *IPRangeAggregation

func (*IPRangeAggregation) AddUnboundedTo

func (a *IPRangeAggregation) AddUnboundedTo(from string) *IPRangeAggregation

func (*IPRangeAggregation) AddUnboundedToWithKey

func (a *IPRangeAggregation) AddUnboundedToWithKey(key, from string) *IPRangeAggregation

func (*IPRangeAggregation) Between

func (a *IPRangeAggregation) Between(from, to string) *IPRangeAggregation

func (*IPRangeAggregation) BetweenWithKey

func (a *IPRangeAggregation) BetweenWithKey(key, from, to string) *IPRangeAggregation

func (*IPRangeAggregation) Field

func (a *IPRangeAggregation) Field(field string) *IPRangeAggregation

func (*IPRangeAggregation) Gt

func (*IPRangeAggregation) GtWithKey

func (a *IPRangeAggregation) GtWithKey(key, from string) *IPRangeAggregation

func (*IPRangeAggregation) Keyed

func (a *IPRangeAggregation) Keyed(keyed bool) *IPRangeAggregation

func (*IPRangeAggregation) Lt

func (*IPRangeAggregation) LtWithKey

func (a *IPRangeAggregation) LtWithKey(key, to string) *IPRangeAggregation

func (*IPRangeAggregation) Meta

func (a *IPRangeAggregation) Meta(metaData map[string]interface{}) *IPRangeAggregation

Meta sets the meta data to be included in the aggregation response.

func (*IPRangeAggregation) Source

func (a *IPRangeAggregation) Source() (interface{}, error)

func (*IPRangeAggregation) SubAggregation

func (a *IPRangeAggregation) SubAggregation(name string, subAggregation Aggregation) *IPRangeAggregation

type IPRangeAggregationEntry

type IPRangeAggregationEntry struct {
	Key  string
	Mask string
	From string
	To   string
}

type IdsQuery

type IdsQuery struct {
	// contains filtered or unexported fields
}

IdsQuery filters documents that only have the provided ids. Note, this query uses the _uid field.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.6/query-dsl-ids-query.html

func NewIdsQuery

func NewIdsQuery(types ...string) *IdsQuery

NewIdsQuery creates and initializes a new ids query.

Notice that types are in the process of being removed. You should filter on a field instead.

func (*IdsQuery) Boost

func (q *IdsQuery) Boost(boost float64) *IdsQuery

Boost sets the boost for this query.

func (*IdsQuery) Ids

func (q *IdsQuery) Ids(ids ...string) *IdsQuery

Ids adds ids to the filter.

func (*IdsQuery) QueryName

func (q *IdsQuery) QueryName(queryName string) *IdsQuery

QueryName sets the query name for the filter.

func (*IdsQuery) Source

func (q *IdsQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

type IndexBoost added in v7.0.15

type IndexBoost struct {
	Index string
	Boost float64
}

IndexBoost specifies an index by some boost factor.

func (IndexBoost) Source added in v7.0.15

func (b IndexBoost) Source() (interface{}, error)

Source generates a JSON-serializable output for IndexBoost.

type IndexBoosts added in v7.0.15

type IndexBoosts []IndexBoost

IndexBoosts is a slice of IndexBoost entities.

func (IndexBoosts) Source added in v7.0.15

func (b IndexBoosts) Source() (interface{}, error)

Source generates a JSON-serializable output for IndexBoosts.

type IndexFeatureStats added in v7.0.32

type IndexFeatureStats struct {
	Name       string `json:"name"`
	Count      int    `json:"count"`
	IndexCount int    `json:"index_count"`

	ScriptCount int `json:"script_count"`
}

type IndexResponse

type IndexResponse struct {
	Index         string      `json:"_index,omitempty"`
	Type          string      `json:"_type,omitempty"`
	Id            string      `json:"_id,omitempty"`
	Version       int64       `json:"_version,omitempty"`
	Result        string      `json:"result,omitempty"`
	Shards        *ShardsInfo `json:"_shards,omitempty"`
	SeqNo         int64       `json:"_seq_no,omitempty"`
	PrimaryTerm   int64       `json:"_primary_term,omitempty"`
	Status        int         `json:"status,omitempty"`
	ForcedRefresh bool        `json:"forced_refresh,omitempty"`
}

IndexResponse is the result of indexing a document in Elasticsearch.

type IndexSegments

type IndexSegments struct {
	// Shards provides a map into the shard related information of an index.
	// The key of the map is the number of a specific shard.
	Shards map[string][]*IndexSegmentsShards `json:"shards,omitempty"`
}

type IndexSegmentsDetails

type IndexSegmentsDetails struct {
	Generation    int64                   `json:"generation,omitempty"`
	NumDocs       int64                   `json:"num_docs,omitempty"`
	DeletedDocs   int64                   `json:"deleted_docs,omitempty"`
	Size          string                  `json:"size,omitempty"`
	SizeInBytes   int64                   `json:"size_in_bytes,omitempty"`
	Memory        string                  `json:"memory,omitempty"`
	MemoryInBytes int64                   `json:"memory_in_bytes,omitempty"`
	Committed     bool                    `json:"committed,omitempty"`
	Search        bool                    `json:"search,omitempty"`
	Version       string                  `json:"version,omitempty"`
	Compound      bool                    `json:"compound,omitempty"`
	MergeId       string                  `json:"merge_id,omitempty"`
	Sort          []*IndexSegmentsSort    `json:"sort,omitempty"`
	RAMTree       []*IndexSegmentsRamTree `json:"ram_tree,omitempty"`
	Attributes    map[string]string       `json:"attributes,omitempty"`
}

type IndexSegmentsRamTree

type IndexSegmentsRamTree struct {
	Description string                  `json:"description,omitempty"`
	Size        string                  `json:"size,omitempty"`
	SizeInBytes int64                   `json:"size_in_bytes,omitempty"`
	Children    []*IndexSegmentsRamTree `json:"children,omitempty"`
}

type IndexSegmentsRouting

type IndexSegmentsRouting struct {
	State          string `json:"state,omitempty"`
	Primary        bool   `json:"primary,omitempty"`
	Node           string `json:"node,omitempty"`
	RelocatingNode string `json:"relocating_node,omitempty"`
}

type IndexSegmentsShards

type IndexSegmentsShards struct {
	Routing              *IndexSegmentsRouting `json:"routing,omitempty"`
	NumCommittedSegments int64                 `json:"num_committed_segments,omitempty"`
	NumSearchSegments    int64                 `json:"num_search_segments"`

	// Segments provides a map into the segment related information of a shard.
	// The key of the map is the specific lucene segment id.
	Segments map[string]*IndexSegmentsDetails `json:"segments,omitempty"`
}

type IndexSegmentsSort

type IndexSegmentsSort struct {
	Field   string      `json:"field,omitempty"`
	Mode    string      `json:"mode,omitempty"`
	Missing interface{} `json:"missing,omitempty"`
	Reverse bool        `json:"reverse,omitempty"`
}

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/7.0/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

Do executes the operation.

func (*IndexService) ErrorTrace added in v7.0.7

func (s *IndexService) ErrorTrace(errorTrace bool) *IndexService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndexService) FilterPath added in v7.0.7

func (s *IndexService) FilterPath(filterPath ...string) *IndexService

FilterPath specifies a list of filters used to reduce the response.

func (*IndexService) Header added in v7.0.7

func (s *IndexService) Header(name string, value string) *IndexService

Header adds a header to the request.

func (*IndexService) Headers added in v7.0.7

func (s *IndexService) Headers(headers http.Header) *IndexService

Headers specifies the headers of the request.

func (*IndexService) Human added in v7.0.7

func (s *IndexService) Human(human bool) *IndexService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndexService) Id

func (s *IndexService) Id(id string) *IndexService

Id is the document ID.

func (*IndexService) IfPrimaryTerm added in v7.0.5

func (s *IndexService) IfPrimaryTerm(primaryTerm int64) *IndexService

IfPrimaryTerm indicates to only perform the index operation if the last operation that has changed the document has the specified primary term.

func (*IndexService) IfSeqNo added in v7.0.5

func (s *IndexService) IfSeqNo(seqNo int64) *IndexService

IfSeqNo indicates to only perform the index operation if the last operation that has changed the document has the specified sequence number.

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 tells Elasticsearch whether to return a formatted JSON response.

func (*IndexService) Refresh

func (s *IndexService) Refresh(refresh string) *IndexService

Refresh the index after performing the operation.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-refresh.html for details.

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 deprecated

func (s *IndexService) Type(typ string) *IndexService

Type is the type of the document.

Deprecated: Types are in the process of being removed.

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 IndexStats

type IndexStats struct {
	UUID      string                          `json:"uuid,omitempty"`
	Primaries *IndexStatsDetails              `json:"primaries,omitempty"`
	Total     *IndexStatsDetails              `json:"total,omitempty"`
	Shards    map[string][]*IndexStatsDetails `json:"shards,omitempty"`
}

IndexStats is index stats for a specific index.

type IndexStatsCommit added in v7.0.7

type IndexStatsCommit struct {
	ID         string            `json:"id,omitempty"` // lucene commit ID in base64, e.g. "m2tDMYHzSpSV6zJH0lIAnA=="
	Generation int64             `json:"generation,omitempty"`
	UserData   map[string]string `json:"user_data,omitempty"`
	NumDocs    int64             `json:"num_docs,omitempty"`
}

type IndexStatsCompletion

type IndexStatsCompletion struct {
	Size        string `json:"size,omitempty"`
	SizeInBytes int64  `json:"size_in_bytes,omitempty"`
}

type IndexStatsDetails

type IndexStatsDetails struct {
	Routing         *IndexStatsRouting         `json:"routing,omitempty"`
	Docs            *IndexStatsDocs            `json:"docs,omitempty"`
	Store           *IndexStatsStore           `json:"store,omitempty"`
	Indexing        *IndexStatsIndexing        `json:"indexing,omitempty"`
	Get             *IndexStatsGet             `json:"get,omitempty"`
	Search          *IndexStatsSearch          `json:"search,omitempty"`
	Merges          *IndexStatsMerges          `json:"merges,omitempty"`
	Refresh         *IndexStatsRefresh         `json:"refresh,omitempty"`
	Recovery        *IndexStatsRecovery        `json:"recovery,omitempty"`
	Flush           *IndexStatsFlush           `json:"flush,omitempty"`
	Warmer          *IndexStatsWarmer          `json:"warmer,omitempty"`
	FilterCache     *IndexStatsFilterCache     `json:"filter_cache,omitempty"`
	IdCache         *IndexStatsIdCache         `json:"id_cache,omitempty"`
	Fielddata       *IndexStatsFielddata       `json:"fielddata,omitempty"`
	Percolate       *IndexStatsPercolate       `json:"percolate,omitempty"`
	Completion      *IndexStatsCompletion      `json:"completion,omitempty"`
	Segments        *IndexStatsSegments        `json:"segments,omitempty"`
	Translog        *IndexStatsTranslog        `json:"translog,omitempty"`
	Suggest         *IndexStatsSuggest         `json:"suggest,omitempty"`
	QueryCache      *IndexStatsQueryCache      `json:"query_cache,omitempty"`
	RequestCache    *IndexStatsRequestCache    `json:"request_cache,omitempty"`
	Commit          *IndexStatsCommit          `json:"commit,omitempty"`
	SeqNo           *IndexStatsSeqNo           `json:"seq_no,omitempty"`
	RetentionLeases *IndexStatsRetentionLeases `json:"retention_leases,omitempty"`
	ShardPath       *IndexStatsShardPath       `json:"shard_path,omitempty"`
	ShardStats      *IndexStatsShardStats      `json:"shard_stats,omitempty"`
}

type IndexStatsDocs

type IndexStatsDocs struct {
	Count   int64 `json:"count,omitempty"`
	Deleted int64 `json:"deleted,omitempty"`
}

type IndexStatsFielddata

type IndexStatsFielddata struct {
	MemorySize        string `json:"memory_size,omitempty"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes,omitempty"`
	Evictions         int64  `json:"evictions,omitempty"`
}

type IndexStatsFilterCache

type IndexStatsFilterCache struct {
	MemorySize        string `json:"memory_size,omitempty"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes,omitempty"`
	Evictions         int64  `json:"evictions,omitempty"`
}

type IndexStatsFlush

type IndexStatsFlush struct {
	Total             int64  `json:"total,omitempty"`
	TotalTime         string `json:"total_time,omitempty"`
	TotalTimeInMillis int64  `json:"total_time_in_millis,omitempty"`
	Periodic          int64  `json:"periodic,omitempty"`
}

type IndexStatsGet

type IndexStatsGet struct {
	Total               int64  `json:"total,omitempty"`
	GetTime             string `json:"getTime,omitempty"` // 7.4.0 uses "getTime", earlier versions used "get_time"
	TimeInMillis        int64  `json:"time_in_millis,omitempty"`
	ExistsTotal         int64  `json:"exists_total,omitempty"`
	ExistsTime          string `json:"exists_time,omitempty"`
	ExistsTimeInMillis  int64  `json:"exists_time_in_millis,omitempty"`
	MissingTotal        int64  `json:"missing_total,omitempty"`
	MissingTime         string `json:"missing_time,omitempty"`
	MissingTimeInMillis int64  `json:"missing_time_in_millis,omitempty"`
	Current             int64  `json:"current,omitempty"`
}

type IndexStatsIdCache

type IndexStatsIdCache struct {
	MemorySize        string `json:"memory_size,omitempty"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes,omitempty"`
}

type IndexStatsIndexing

type IndexStatsIndexing struct {
	IndexTotal           int64  `json:"index_total,omitempty"`
	IndexTime            string `json:"index_time,omitempty"`
	IndexTimeInMillis    int64  `json:"index_time_in_millis,omitempty"`
	IndexCurrent         int64  `json:"index_current,omitempty"`
	IndexFailed          int64  `json:"index_failed,omitempty"`
	DeleteTotal          int64  `json:"delete_total,omitempty"`
	DeleteTime           string `json:"delete_time,omitempty"`
	DeleteTimeInMillis   int64  `json:"delete_time_in_millis,omitempty"`
	DeleteCurrent        int64  `json:"delete_current,omitempty"`
	NoopUpdateTotal      int64  `json:"noop_update_total,omitempty"`
	IsThrottled          bool   `json:"is_throttled,omitempty"`
	ThrottleTime         string `json:"throttle_time,omitempty"`
	ThrottleTimeInMillis int64  `json:"throttle_time_in_millis,omitempty"`
}

type IndexStatsMerges

type IndexStatsMerges struct {
	Current                    int64  `json:"current,omitempty"`
	CurrentDocs                int64  `json:"current_docs,omitempty"`
	CurrentSize                string `json:"current_size,omitempty"`
	CurrentSizeInBytes         int64  `json:"current_size_in_bytes,omitempty"`
	Total                      int64  `json:"total,omitempty"`
	TotalTime                  string `json:"total_time,omitempty"`
	TotalTimeInMillis          int64  `json:"total_time_in_millis,omitempty"`
	TotalDocs                  int64  `json:"total_docs,omitempty"`
	TotalSize                  string `json:"total_size,omitempty"`
	TotalSizeInBytes           int64  `json:"total_size_in_bytes,omitempty"`
	TotalStoppedTime           string `json:"total_stopped_time,omitempty"`
	TotalStoppedTimeInMillis   int64  `json:"total_stopped_time_in_millis,omitempty"`
	TotalThrottledTime         string `json:"total_throttled_time,omitempty"`
	TotalThrottledTimeInMillis int64  `json:"total_throttled_time_in_millis,omitempty"`
	TotalAutoThrottle          string `json:"total_auto_throttle,omitempty"`
	TotalAutoThrottleInBytes   int64  `json:"total_auto_throttle_in_bytes,omitempty"`
}

type IndexStatsPercolate

type IndexStatsPercolate struct {
	Total             int64  `json:"total,omitempty"`
	GetTime           string `json:"get_time,omitempty"`
	TimeInMillis      int64  `json:"time_in_millis,omitempty"`
	Current           int64  `json:"current,omitempty"`
	MemorySize        string `json:"memory_size,omitempty"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes,omitempty"`
	Queries           int64  `json:"queries,omitempty"`
}

type IndexStatsQueryCache

type IndexStatsQueryCache struct {
	MemorySize        string `json:"memory_size,omitempty"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes,omitempty"`
	TotalCount        int64  `json:"total_count,omitempty"`
	HitCount          int64  `json:"hit_count,omitempty"`
	MissCount         int64  `json:"miss_count,omitempty"`
	CacheSize         int64  `json:"cache_size,omitempty"`
	CacheCount        int64  `json:"cache_count,omitempty"`
	Evictions         int64  `json:"evictions,omitempty"`
}

type IndexStatsRecovery added in v7.0.7

type IndexStatsRecovery struct {
	CurrentAsSource      int64  `json:"current_as_source,omitempty"`
	CurrentAsTarget      int64  `json:"current_as_target,omitempty"`
	ThrottleTime         string `json:"throttle_time,omitempty"`
	ThrottleTimeInMillis int64  `json:"throttle_time_in_millis,omitempty"`
}

type IndexStatsRefresh

type IndexStatsRefresh struct {
	Total                     int64  `json:"total,omitempty"`
	TotalTime                 string `json:"total_time,omitempty"`
	TotalTimeInMillis         int64  `json:"total_time_in_millis,omitempty"`
	ExternalTotal             int64  `json:"external_total,omitempty"`
	ExternalTotalTime         string `json:"external_total_time,omitempty"`
	ExternalTotalTimeInMillis int64  `json:"external_total_time_in_millis,omitempty"`
	Listeners                 int64  `json:"listeners,omitempty"`
}

type IndexStatsRequestCache added in v7.0.7

type IndexStatsRequestCache struct {
	MemorySize        string `json:"memory_size,omitempty"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes,omitempty"`
	Evictions         int64  `json:"evictions,omitempty"`
	HitCount          int64  `json:"hit_count,omitempty"`
	MissCount         int64  `json:"miss_count,omitempty"`
}

type IndexStatsRetentionLease added in v7.0.5

type IndexStatsRetentionLease struct {
	Id             string `json:"id,omitempty"`
	RetainingSeqNo int64  `json:"retaining_seq_no,omitempty"`
	Timestamp      int64  `json:"timestamp,omitempty"`
	Source         string `json:"source,omitempty"`
}

type IndexStatsRetentionLeases added in v7.0.5

type IndexStatsRetentionLeases struct {
	PrimaryTerm int64                       `json:"primary_term,omitempty"`
	Version     int64                       `json:"version,omitempty"`
	Leases      []*IndexStatsRetentionLease `json:"leases,omitempty"`
}

type IndexStatsRouting added in v7.0.7

type IndexStatsRouting struct {
	State          string  `json:"state"` // e.g. "STARTED"
	Primary        bool    `json:"primary"`
	Node           string  `json:"node"` // e.g. "-aXnGv4oTW6bIIl0db3eCg"
	RelocatingNode *string `json:"relocating_node"`
}

type IndexStatsSearch

type IndexStatsSearch struct {
	OpenContexts        int64  `json:"open_contexts,omitempty"`
	QueryTotal          int64  `json:"query_total,omitempty"`
	QueryTime           string `json:"query_time,omitempty"`
	QueryTimeInMillis   int64  `json:"query_time_in_millis,omitempty"`
	QueryCurrent        int64  `json:"query_current,omitempty"`
	FetchTotal          int64  `json:"fetch_total,omitempty"`
	FetchTime           string `json:"fetch_time,omitempty"`
	FetchTimeInMillis   int64  `json:"fetch_time_in_millis,omitempty"`
	FetchCurrent        int64  `json:"fetch_current,omitempty"`
	ScrollTotal         int64  `json:"scroll_total,omitempty"`
	ScrollTime          string `json:"scroll_time,omitempty"`
	ScrollTimeInMillis  int64  `json:"scroll_time_in_millis,omitempty"`
	ScrollCurrent       int64  `json:"scroll_current,omitempty"`
	SuggestTotal        int64  `json:"suggest_total,omitempty"`
	SuggestTime         string `json:"suggest_time,omitempty"`
	SuggestTimeInMillis int64  `json:"suggest_time_in_millis,omitempty"`
	SuggestCurrent      int64  `json:"suggest_current,omitempty"`
}

type IndexStatsSegments

type IndexStatsSegments struct {
	Count                     int64                                       `json:"count"`
	Memory                    string                                      `json:"memory"` // e.g. "61.3kb"
	MemoryInBytes             int64                                       `json:"memory_in_bytes"`
	TermsMemory               string                                      `json:"terms_memory"` // e.g. "61.3kb"
	TermsMemoryInBytes        int64                                       `json:"terms_memory_in_bytes"`
	StoredFieldsMemory        string                                      `json:"stored_fields_memory"` // e.g. "61.3kb"
	StoredFieldsMemoryInBytes int64                                       `json:"stored_fields_memory_in_bytes"`
	TermVectorsMemory         string                                      `json:"term_vectors_memory"` // e.g. "61.3kb"
	TermVectorsMemoryInBytes  int64                                       `json:"term_vectors_memory_in_bytes"`
	NormsMemory               string                                      `json:"norms_memory"` // e.g. "61.3kb"
	NormsMemoryInBytes        int64                                       `json:"norms_memory_in_bytes"`
	PointsMemory              string                                      `json:"points_memory"` // e.g. "61.3kb"
	PointsMemoryInBytes       int64                                       `json:"points_memory_in_bytes"`
	DocValuesMemory           string                                      `json:"doc_values_memory"` // e.g. "61.3kb"
	DocValuesMemoryInBytes    int64                                       `json:"doc_values_memory_in_bytes"`
	IndexWriterMemory         string                                      `json:"index_writer_memory"` // e.g. "61.3kb"
	IndexWriterMemoryInBytes  int64                                       `json:"index_writer_memory_in_bytes"`
	VersionMapMemory          string                                      `json:"version_map_memory"` // e.g. "61.3kb"
	VersionMapMemoryInBytes   int64                                       `json:"version_map_memory_in_bytes"`
	FixedBitSet               string                                      `json:"fixed_bit_set"` // e.g. "61.3kb"
	FixedBitSetInBytes        int64                                       `json:"fixed_bit_set_memory_in_bytes"`
	MaxUnsafeAutoIDTimestamp  int64                                       `json:"max_unsafe_auto_id_timestamp"`
	FileSizes                 map[string]*ClusterStatsIndicesSegmentsFile `json:"file_sizes"`
}

type IndexStatsSeqNo added in v7.0.5

type IndexStatsSeqNo struct {
	MaxSeqNo         int64 `json:"max_seq_no,omitempty"`
	LocalCheckpoint  int64 `json:"local_checkpoint,omitempty"`
	GlobalCheckpoint int64 `json:"global_checkpoint,omitempty"`
}

type IndexStatsShardPath added in v7.0.7

type IndexStatsShardPath struct {
	StatePath        string `json:"state_path"` // e.g. "/usr/share/elasticsearch/data/nodes/0"
	DataPath         string `json:"data_path"`  // e.g. "/usr/share/elasticsearch/data/nodes/0"
	IsCustomDataPath bool   `json:"is_custom_data_path"`
}

type IndexStatsShardStats added in v7.0.32

type IndexStatsShardStats struct {
	TotalCount int64 `json:"total_count,omitempty"`
}

type IndexStatsStore

type IndexStatsStore struct {
	Size                    string `json:"size,omitempty"` // human size, e.g. 119.3mb
	SizeInBytes             int64  `json:"size_in_bytes,omitempty"`
	TotalDataSetSize        string `json:"total_data_set_size,omitempty"`
	TotalDataSetSizeInBytes int64  `json:"total_data_set_size_in_bytes,omitempty"`
	Reserved                string `json:"reserved,omitempty"`
	ReservedInBytes         int64  `json:"reserved_in_bytes,omitempty"`
}

type IndexStatsSuggest

type IndexStatsSuggest struct {
	Total        int64  `json:"total,omitempty"`
	Time         string `json:"time,omitempty"`
	TimeInMillis int64  `json:"time_in_millis,omitempty"`
	Current      int64  `json:"current,omitempty"`
}

type IndexStatsTranslog

type IndexStatsTranslog struct {
	Operations              int64  `json:"operations,omitempty"`
	Size                    string `json:"size,omitempty"`
	SizeInBytes             int64  `json:"size_in_bytes,omitempty"`
	UncommittedOperations   int64  `json:"uncommitted_operations,omitempty"`
	UncommittedSize         string `json:"uncommitted_size,omitempty"`
	UncommittedSizeInBytes  int64  `json:"uncommitted_size_in_bytes,omitempty"`
	EarliestLastModifiedAge int64  `json:"earliest_last_modified_age,omitempty"`
}

type IndexStatsWarmer

type IndexStatsWarmer struct {
	Current           int64  `json:"current,omitempty"`
	Total             int64  `json:"total,omitempty"`
	TotalTime         string `json:"total_time,omitempty"`
	TotalTimeInMillis int64  `json:"total_time_in_millis,omitempty"`
}

type IndicesAnalyzeRequest

type IndicesAnalyzeRequest struct {
	Text       []string `json:"text,omitempty"`
	Analyzer   string   `json:"analyzer,omitempty"`
	Tokenizer  string   `json:"tokenizer,omitempty"`
	Filter     []string `json:"filter,omitempty"`
	CharFilter []string `json:"char_filter,omitempty"`
	Field      string   `json:"field,omitempty"`
	Explain    bool     `json:"explain,omitempty"`
	Attributes []string `json:"attributes,omitempty"`
}

IndicesAnalyzeRequest specifies the parameters of the analyze request.

type IndicesAnalyzeResponse

type IndicesAnalyzeResponse struct {
	Tokens []AnalyzeToken               `json:"tokens"` // json part for normal message
	Detail IndicesAnalyzeResponseDetail `json:"detail"` // json part for verbose message of explain request
}

type IndicesAnalyzeResponseDetail

type IndicesAnalyzeResponseDetail struct {
	CustomAnalyzer bool                `json:"custom_analyzer"`
	Analyzer       *AnalyzeTokenList   `json:"analyzer,omitempty"`
	Charfilters    []*CharFilteredText `json:"charfilters,omitempty"`
	Tokenizer      *AnalyzeTokenList   `json:"tokenizer,omitempty"`
	TokenFilters   []*AnalyzeTokenList `json:"tokenfilters,omitempty"`
}

type IndicesAnalyzeService

type IndicesAnalyzeService struct {
	// contains filtered or unexported fields
}

IndicesAnalyzeService performs the analysis process on a text and returns the tokens breakdown of the text.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/indices-analyze.html for detail.

func NewIndicesAnalyzeService

func NewIndicesAnalyzeService(client *Client) *IndicesAnalyzeService

NewIndicesAnalyzeService creates a new IndicesAnalyzeService.

func (*IndicesAnalyzeService) Analyzer

func (s *IndicesAnalyzeService) Analyzer(analyzer string) *IndicesAnalyzeService

Analyzer is the name of the analyzer to use.

func (*IndicesAnalyzeService) Attributes

func (s *IndicesAnalyzeService) Attributes(attributes ...string) *IndicesAnalyzeService

Attributes is a list of token attributes to output; this parameter works only with explain=true.

func (*IndicesAnalyzeService) BodyJson

func (s *IndicesAnalyzeService) BodyJson(body interface{}) *IndicesAnalyzeService

BodyJson is the text on which the analysis should be performed.

func (*IndicesAnalyzeService) BodyString

func (s *IndicesAnalyzeService) BodyString(body string) *IndicesAnalyzeService

BodyString is the text on which the analysis should be performed.

func (*IndicesAnalyzeService) CharFilter

func (s *IndicesAnalyzeService) CharFilter(charFilter ...string) *IndicesAnalyzeService

CharFilter is a list of character filters to use for the analysis.

func (*IndicesAnalyzeService) Do

Do will execute the request with the given context.

func (*IndicesAnalyzeService) ErrorTrace added in v7.0.7

func (s *IndicesAnalyzeService) ErrorTrace(errorTrace bool) *IndicesAnalyzeService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesAnalyzeService) Explain

func (s *IndicesAnalyzeService) Explain(explain bool) *IndicesAnalyzeService

Explain, when true, outputs more advanced details (default: false).

func (*IndicesAnalyzeService) Field

Field specifies to use a specific analyzer configured for this field (instead of passing the analyzer name).

func (*IndicesAnalyzeService) Filter

func (s *IndicesAnalyzeService) Filter(filter ...string) *IndicesAnalyzeService

Filter is a list of filters to use for the analysis.

func (*IndicesAnalyzeService) FilterPath added in v7.0.7

func (s *IndicesAnalyzeService) FilterPath(filterPath ...string) *IndicesAnalyzeService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesAnalyzeService) Format

Format of the output.

func (*IndicesAnalyzeService) Header added in v7.0.7

func (s *IndicesAnalyzeService) Header(name string, value string) *IndicesAnalyzeService

Header adds a header to the request.

func (*IndicesAnalyzeService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesAnalyzeService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesAnalyzeService) Index

Index is the name of the index to scope the operation.

func (*IndicesAnalyzeService) PreferLocal

func (s *IndicesAnalyzeService) PreferLocal(preferLocal bool) *IndicesAnalyzeService

PreferLocal, when true, specifies that a local shard should be used if available. When false, a random shard is used (default: true).

func (*IndicesAnalyzeService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesAnalyzeService) Request

Request passes the analyze request to use.

func (*IndicesAnalyzeService) Text

Text is the text on which the analysis should be performed (when request body is not used).

func (*IndicesAnalyzeService) Tokenizer

func (s *IndicesAnalyzeService) Tokenizer(tokenizer string) *IndicesAnalyzeService

Tokenizer is the name of the tokenizer to use for the analysis.

func (*IndicesAnalyzeService) Validate

func (s *IndicesAnalyzeService) Validate() error

type IndicesClearCacheResponse added in v7.0.12

type IndicesClearCacheResponse struct {
	Shards *ShardsInfo `json:"_shards"`
}

IndicesClearCacheResponse is the response of IndicesClearCacheService.Do.

type IndicesClearCacheService added in v7.0.12

type IndicesClearCacheService struct {
	// contains filtered or unexported fields
}

IndicesClearCacheService allows to clear either all caches or specific cached associated with one or more indices.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.6/indices-clearcache.html for details.

func NewIndicesClearCacheService added in v7.0.12

func NewIndicesClearCacheService(client *Client) *IndicesClearCacheService

NewIndicesClearCacheService initializes a new instance of IndicesClearCacheService.

func (*IndicesClearCacheService) AllowNoIndices added in v7.0.12

func (s *IndicesClearCacheService) AllowNoIndices(allowNoIndices bool) *IndicesClearCacheService

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 (*IndicesClearCacheService) Do added in v7.0.12

Do executes the operation.

func (*IndicesClearCacheService) ErrorTrace added in v7.0.12

func (s *IndicesClearCacheService) ErrorTrace(errorTrace bool) *IndicesClearCacheService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesClearCacheService) ExpandWildcards added in v7.0.12

func (s *IndicesClearCacheService) ExpandWildcards(expandWildcards string) *IndicesClearCacheService

ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.

func (*IndicesClearCacheService) FieldData added in v7.0.12

func (s *IndicesClearCacheService) FieldData(fieldData bool) *IndicesClearCacheService

FieldData indicates whether to clear the fields cache. Use the fields parameter to clear the cache of specific fields only.

func (*IndicesClearCacheService) Fields added in v7.0.12

Fields indicates comma-separated list of field names used to limit the fielddata parameter. Defaults to all fields.

func (*IndicesClearCacheService) FilterPath added in v7.0.12

func (s *IndicesClearCacheService) FilterPath(filterPath ...string) *IndicesClearCacheService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesClearCacheService) Header added in v7.0.12

Header adds a header to the request.

func (*IndicesClearCacheService) Headers added in v7.0.12

Headers specifies the headers of the request.

func (*IndicesClearCacheService) Human added in v7.0.12

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesClearCacheService) IgnoreUnavailable added in v7.0.12

func (s *IndicesClearCacheService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesClearCacheService

IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).

func (*IndicesClearCacheService) Index added in v7.0.12

Index is the comma-separated list or wildcard expression of index names used to clear cache.

func (*IndicesClearCacheService) Pretty added in v7.0.12

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesClearCacheService) Query added in v7.0.12

Query indicates whether to clear only query cache.

func (*IndicesClearCacheService) Request added in v7.0.12

func (s *IndicesClearCacheService) Request(requestCache bool) *IndicesClearCacheService

Request indicates whether to clear only request cache.

func (*IndicesClearCacheService) Validate added in v7.0.12

func (s *IndicesClearCacheService) Validate() error

Validate checks if the operation is valid.

type IndicesCloseResponse

type IndicesCloseResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

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/7.0/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

Do executes the operation.

func (*IndicesCloseService) ErrorTrace added in v7.0.7

func (s *IndicesCloseService) ErrorTrace(errorTrace bool) *IndicesCloseService

ErrorTrace specifies whether to include the stack trace of returned errors.

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) FilterPath added in v7.0.7

func (s *IndicesCloseService) FilterPath(filterPath ...string) *IndicesCloseService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesCloseService) Header added in v7.0.7

func (s *IndicesCloseService) Header(name string, value string) *IndicesCloseService

Header adds a header to the request.

func (*IndicesCloseService) Headers added in v7.0.7

func (s *IndicesCloseService) Headers(headers http.Header) *IndicesCloseService

Headers specifies the headers of the request.

func (*IndicesCloseService) Human added in v7.0.7

func (s *IndicesCloseService) Human(human bool) *IndicesCloseService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

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

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 tells Elasticsearch whether to return a formatted JSON response.

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"`
	Index              string `json:"index,omitempty"`
}

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/7.0/indices-create-index.html for details.

Example
// Get a client to the local Elasticsearch instance.
client, err := elastic.NewClient()
if err != nil {
	// Handle error
	panic(err)
}
// Create a new index.
createIndex, err := client.CreateIndex("twitter").Do(context.Background())
if err != nil {
	// Handle error
	panic(err)
}
if !createIndex.Acknowledged {
	// Not acknowledged
}
Output:

func NewIndicesCreateService

func NewIndicesCreateService(client *Client) *IndicesCreateService

NewIndicesCreateService returns a new IndicesCreateService.

func (*IndicesCreateService) Body

Body specifies the configuration of the index as a string. It is an alias for BodyString.

func (*IndicesCreateService) BodyJson

func (s *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 (s *IndicesCreateService) BodyString(body string) *IndicesCreateService

BodyString specifies the configuration of the index as a string.

func (*IndicesCreateService) Do

Do executes the operation.

func (*IndicesCreateService) ErrorTrace added in v7.0.7

func (s *IndicesCreateService) ErrorTrace(errorTrace bool) *IndicesCreateService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesCreateService) FilterPath added in v7.0.7

func (s *IndicesCreateService) FilterPath(filterPath ...string) *IndicesCreateService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesCreateService) Header added in v7.0.7

func (s *IndicesCreateService) Header(name string, value string) *IndicesCreateService

Header adds a header to the request.

func (*IndicesCreateService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesCreateService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesCreateService) IncludeTypeName added in v7.0.28

func (s *IndicesCreateService) IncludeTypeName(includeTypeName bool) *IndicesCreateService

IncludeTypeName indicates whether a type should be expected in the body of the mappings.

func (*IndicesCreateService) Index

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 (s *IndicesCreateService) Pretty(pretty bool) *IndicesCreateService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesCreateService) Timeout

func (s *IndicesCreateService) Timeout(timeout string) *IndicesCreateService

Timeout the explicit operation timeout, e.g. "5s".

type IndicesDataStream added in v7.0.31

type IndicesDataStream struct {
	Name               string                           `json:"name,omitempty"`
	TimestampField     *IndicesDataStreamTimestampField `json:"timestamp_field,omitempty"`
	Indices            []string                         `json:"indices,omitempty"`
	Generation         int64                            `json:"generation,omitempty"`
	Status             string                           `json:"status,omitempty"`
	IndexTemplate      string                           `json:"template,omitempty"`
	IlmPolicy          string                           `json:"ilm_policy,omitempty"`
	Meta               map[string]interface{}           `json:"_meta,omitempty"`
	Hidden             bool                             `json:"hidden,omitempty"`
	System             bool                             `json:"system,omitempty"`
	AllowCustomRouting bool                             `json:"allow_custom_routing,omitempty"`
	Replicated         bool                             `json:"replicated,omitempty"`
}

type IndicesDataStreamTimestampField added in v7.0.32

type IndicesDataStreamTimestampField struct {
	Name string `json:"name,omitempty"`
}

type IndicesDeleteComponentTemplateResponse added in v7.0.25

type IndicesDeleteComponentTemplateResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

IndicesDeleteComponentTemplateResponse is the response of IndicesDeleteComponentTemplateService.Do.

type IndicesDeleteComponentTemplateService added in v7.0.25

type IndicesDeleteComponentTemplateService struct {
	// contains filtered or unexported fields
}

IndicesDeleteComponentTemplateService deletes component templates.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-delete-component-template.html for more details.

func NewIndicesDeleteComponentTemplateService added in v7.0.25

func NewIndicesDeleteComponentTemplateService(client *Client) *IndicesDeleteComponentTemplateService

NewIndicesDeleteComponentTemplateService creates a new IndicesDeleteComponentTemplateService.

func (*IndicesDeleteComponentTemplateService) Do added in v7.0.25

Do executes the operation.

func (*IndicesDeleteComponentTemplateService) ErrorTrace added in v7.0.25

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesDeleteComponentTemplateService) FilterPath added in v7.0.25

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesDeleteComponentTemplateService) Header added in v7.0.25

Header adds a header to the request.

func (*IndicesDeleteComponentTemplateService) Headers added in v7.0.25

Headers specifies the headers of the request.

func (*IndicesDeleteComponentTemplateService) Human added in v7.0.25

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesDeleteComponentTemplateService) MasterTimeout added in v7.0.25

MasterTimeout specifies the timeout for connection to master.

func (*IndicesDeleteComponentTemplateService) Name added in v7.0.25

Name is the name of the template.

func (*IndicesDeleteComponentTemplateService) Pretty added in v7.0.25

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesDeleteComponentTemplateService) Timeout added in v7.0.25

Timeout is an explicit operation timeout.

func (*IndicesDeleteComponentTemplateService) Validate added in v7.0.25

Validate checks if the operation is valid.

type IndicesDeleteIndexTemplateResponse added in v7.0.22

type IndicesDeleteIndexTemplateResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

IndicesDeleteIndexTemplateResponse is the response of IndicesDeleteIndexTemplateService.Do.

type IndicesDeleteIndexTemplateService added in v7.0.22

type IndicesDeleteIndexTemplateService struct {
	// contains filtered or unexported fields
}

IndicesDeleteIndexTemplateService deletes index templates.

Index templates have changed during in 7.8 update of Elasticsearch. This service implements the new version (7.8 or later). If you want the old version, please use the IndicesDeleteTemplateService.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-delete-template.html for more details.

func NewIndicesDeleteIndexTemplateService added in v7.0.22

func NewIndicesDeleteIndexTemplateService(client *Client) *IndicesDeleteIndexTemplateService

NewIndicesDeleteIndexTemplateService creates a new IndicesDeleteIndexTemplateService.

func (*IndicesDeleteIndexTemplateService) Do added in v7.0.22

Do executes the operation.

func (*IndicesDeleteIndexTemplateService) ErrorTrace added in v7.0.22

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesDeleteIndexTemplateService) FilterPath added in v7.0.22

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesDeleteIndexTemplateService) Header added in v7.0.22

Header adds a header to the request.

func (*IndicesDeleteIndexTemplateService) Headers added in v7.0.22

Headers specifies the headers of the request.

func (*IndicesDeleteIndexTemplateService) Human added in v7.0.22

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesDeleteIndexTemplateService) MasterTimeout added in v7.0.22

MasterTimeout specifies the timeout for connection to master.

func (*IndicesDeleteIndexTemplateService) Name added in v7.0.22

Name is the name of the template.

func (*IndicesDeleteIndexTemplateService) Pretty added in v7.0.22

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesDeleteIndexTemplateService) Timeout added in v7.0.22

Timeout is an explicit operation timeout.

func (*IndicesDeleteIndexTemplateService) Validate added in v7.0.22

Validate checks if the operation is valid.

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/7.0/indices-delete-index.html for details.

Example
// Get a client to the local Elasticsearch instance.
client, err := elastic.NewClient()
if err != nil {
	// Handle error
	panic(err)
}
// Delete an index.
deleteIndex, err := client.DeleteIndex("twitter").Do(context.Background())
if err != nil {
	// Handle error
	panic(err)
}
if !deleteIndex.Acknowledged {
	// Not acknowledged
}
Output:

func NewIndicesDeleteService

func NewIndicesDeleteService(client *Client) *IndicesDeleteService

NewIndicesDeleteService creates and initializes a new IndicesDeleteService.

func (*IndicesDeleteService) AllowNoIndices added in v7.0.25

func (s *IndicesDeleteService) AllowNoIndices(allowNoIndices bool) *IndicesDeleteService

AllowNoIndices indicates whether to ignore if a wildcard expression resolves to no concrete indices (default: false).

func (*IndicesDeleteService) Do

Do executes the operation.

func (*IndicesDeleteService) ErrorTrace added in v7.0.7

func (s *IndicesDeleteService) ErrorTrace(errorTrace bool) *IndicesDeleteService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesDeleteService) ExpandWildcards added in v7.0.25

func (s *IndicesDeleteService) ExpandWildcards(expandWildcards string) *IndicesDeleteService

ExpandWildcards indicates whether wildcard expressions should get expanded to open or closed indices (default: open).

func (*IndicesDeleteService) FilterPath added in v7.0.7

func (s *IndicesDeleteService) FilterPath(filterPath ...string) *IndicesDeleteService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesDeleteService) Header added in v7.0.7

func (s *IndicesDeleteService) Header(name string, value string) *IndicesDeleteService

Header adds a header to the request.

func (*IndicesDeleteService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesDeleteService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesDeleteService) IgnoreUnavailable added in v7.0.25

func (s *IndicesDeleteService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesDeleteService

IgnoreUnavailable indicates whether to ignore unavailable indexes (default: false).

func (*IndicesDeleteService) Index

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 tells Elasticsearch whether to return a formatted JSON response.

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 IndicesDeleteTemplateResponse

type IndicesDeleteTemplateResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

IndicesDeleteTemplateResponse is the response of IndicesDeleteTemplateService.Do.

type IndicesDeleteTemplateService deprecated

type IndicesDeleteTemplateService struct {
	// contains filtered or unexported fields
}

IndicesDeleteTemplateService deletes templates.

Index templates have changed during in 7.8 update of Elasticsearch. This service implements the legacy version (7.7 or lower). If you want the new version, please use the IndicesDeleteIndexTemplateService.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-delete-template-v1.html for more details.

Deprecated: Legacy index templates are deprecated in favor of composable templates.

func NewIndicesDeleteTemplateService

func NewIndicesDeleteTemplateService(client *Client) *IndicesDeleteTemplateService

NewIndicesDeleteTemplateService creates a new IndicesDeleteTemplateService.

func (*IndicesDeleteTemplateService) Do deprecated

Do executes the operation.

Deprecated: Legacy index templates are deprecated in favor of composable templates.

func (*IndicesDeleteTemplateService) ErrorTrace added in v7.0.7

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesDeleteTemplateService) FilterPath added in v7.0.7

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesDeleteTemplateService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesDeleteTemplateService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesDeleteTemplateService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesDeleteTemplateService) MasterTimeout

func (s *IndicesDeleteTemplateService) MasterTimeout(masterTimeout string) *IndicesDeleteTemplateService

MasterTimeout specifies the timeout for connection to master.

func (*IndicesDeleteTemplateService) Name

Name is the name of the template.

func (*IndicesDeleteTemplateService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesDeleteTemplateService) Timeout

Timeout is an explicit operation timeout.

func (*IndicesDeleteTemplateService) Validate

func (s *IndicesDeleteTemplateService) 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/7.0/indices-exists.html for details.

Example
// Get a client to the local Elasticsearch instance.
client, err := elastic.NewClient()
if err != nil {
	// Handle error
	panic(err)
}
// Use the IndexExists service to check if the index "twitter" exists.
exists, err := client.IndexExists("twitter").Do(context.Background())
if err != nil {
	// Handle error
	panic(err)
}
if exists {
	// ...
}
Output:

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

Do executes the operation.

func (*IndicesExistsService) ErrorTrace added in v7.0.7

func (s *IndicesExistsService) ErrorTrace(errorTrace bool) *IndicesExistsService

ErrorTrace specifies whether to include the stack trace of returned errors.

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) FilterPath added in v7.0.7

func (s *IndicesExistsService) FilterPath(filterPath ...string) *IndicesExistsService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesExistsService) Header added in v7.0.7

func (s *IndicesExistsService) Header(name string, value string) *IndicesExistsService

Header adds a header to the request.

func (*IndicesExistsService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesExistsService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

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

Index is a list of one or more indices to check.

func (*IndicesExistsService) Local

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 tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesExistsService) Validate

func (s *IndicesExistsService) Validate() error

Validate checks if the operation is valid.

type IndicesExistsTemplateService deprecated

type IndicesExistsTemplateService struct {
	// contains filtered or unexported fields
}

IndicesExistsTemplateService checks if a given template exists. See http://www.elastic.co/guide/en/elasticsearch/reference/7.0/indices-templates.html#indices-templates-exists for documentation.

Deprecated: Legacy index templates are deprecated in favor of composable templates.

func NewIndicesExistsTemplateService

func NewIndicesExistsTemplateService(client *Client) *IndicesExistsTemplateService

NewIndicesExistsTemplateService creates a new IndicesExistsTemplateService.

func (*IndicesExistsTemplateService) Do deprecated

Do executes the operation.

Deprecated: Legacy index templates are deprecated in favor of composable templates.

func (*IndicesExistsTemplateService) ErrorTrace added in v7.0.7

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesExistsTemplateService) FilterPath added in v7.0.7

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesExistsTemplateService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesExistsTemplateService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesExistsTemplateService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesExistsTemplateService) Local

Local indicates whether to return local information, i.e. do not retrieve the state from master node (default: false).

func (*IndicesExistsTemplateService) MasterTimeout added in v7.0.22

func (s *IndicesExistsTemplateService) MasterTimeout(masterTimeout string) *IndicesExistsTemplateService

MasterTimeout specifies the timeout for connection to master.

func (*IndicesExistsTemplateService) Name

Name is the name of the template.

func (*IndicesExistsTemplateService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesExistsTemplateService) Validate

func (s *IndicesExistsTemplateService) 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/7.0/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

Do executes the service.

func (*IndicesFlushService) ErrorTrace added in v7.0.7

func (s *IndicesFlushService) ErrorTrace(errorTrace bool) *IndicesFlushService

ErrorTrace specifies whether to include the stack trace of returned errors.

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) FilterPath added in v7.0.7

func (s *IndicesFlushService) FilterPath(filterPath ...string) *IndicesFlushService

FilterPath specifies a list of filters used to reduce the response.

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) Header added in v7.0.7

func (s *IndicesFlushService) Header(name string, value string) *IndicesFlushService

Header adds a header to the request.

func (*IndicesFlushService) Headers added in v7.0.7

func (s *IndicesFlushService) Headers(headers http.Header) *IndicesFlushService

Headers specifies the headers of the request.

func (*IndicesFlushService) Human added in v7.0.7

func (s *IndicesFlushService) Human(human bool) *IndicesFlushService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

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 tells Elasticsearch whether to return a formatted JSON response.

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 IndicesForcemergeResponse

type IndicesForcemergeResponse struct {
	Shards *ShardsInfo `json:"_shards"`
}

IndicesForcemergeResponse is the response of IndicesForcemergeService.Do.

type IndicesForcemergeService

type IndicesForcemergeService struct {
	// contains filtered or unexported fields
}

IndicesForcemergeService allows to force merging of one or more indices. The merge relates to the number of segments a Lucene index holds within each shard. The force merge operation allows to reduce the number of segments by merging them.

See http://www.elastic.co/guide/en/elasticsearch/reference/7.0/indices-forcemerge.html for more information.

func NewIndicesForcemergeService

func NewIndicesForcemergeService(client *Client) *IndicesForcemergeService

NewIndicesForcemergeService creates a new IndicesForcemergeService.

func (*IndicesForcemergeService) AllowNoIndices

func (s *IndicesForcemergeService) AllowNoIndices(allowNoIndices bool) *IndicesForcemergeService

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 (*IndicesForcemergeService) Do

Do executes the operation.

func (*IndicesForcemergeService) ErrorTrace added in v7.0.7

func (s *IndicesForcemergeService) ErrorTrace(errorTrace bool) *IndicesForcemergeService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesForcemergeService) ExpandWildcards

func (s *IndicesForcemergeService) ExpandWildcards(expandWildcards string) *IndicesForcemergeService

ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both..

func (*IndicesForcemergeService) FilterPath added in v7.0.7

func (s *IndicesForcemergeService) FilterPath(filterPath ...string) *IndicesForcemergeService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesForcemergeService) Flush

Flush specifies whether the index should be flushed after performing the operation (default: true).

func (*IndicesForcemergeService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesForcemergeService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesForcemergeService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesForcemergeService) IgnoreUnavailable

func (s *IndicesForcemergeService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesForcemergeService

IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).

func (*IndicesForcemergeService) Index

Index is a list of index names; use `_all` or empty string to perform the operation on all indices.

func (*IndicesForcemergeService) MaxNumSegments

func (s *IndicesForcemergeService) MaxNumSegments(maxNumSegments interface{}) *IndicesForcemergeService

MaxNumSegments specifies the number of segments the index should be merged into (default: dynamic).

func (*IndicesForcemergeService) OnlyExpungeDeletes

func (s *IndicesForcemergeService) OnlyExpungeDeletes(onlyExpungeDeletes bool) *IndicesForcemergeService

OnlyExpungeDeletes specifies whether the operation should only expunge deleted documents.

func (*IndicesForcemergeService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesForcemergeService) Validate

func (s *IndicesForcemergeService) Validate() error

Validate checks if the operation is valid.

type IndicesFreezeResponse

type IndicesFreezeResponse struct {
	Shards *ShardsInfo `json:"_shards"`
}

IndicesFreezeResponse is the outcome of freezing an index.

type IndicesFreezeService deprecated

type IndicesFreezeService struct {
	// contains filtered or unexported fields
}

IndicesFreezeService freezes an index.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/freeze-index-api.html and https://www.elastic.co/blog/creating-frozen-indices-with-the-elasticsearch-freeze-index-api for details.

Deprecated: Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization.

func NewIndicesFreezeService

func NewIndicesFreezeService(client *Client) *IndicesFreezeService

NewIndicesFreezeService creates a new IndicesFreezeService.

func (*IndicesFreezeService) AllowNoIndices

func (s *IndicesFreezeService) AllowNoIndices(allowNoIndices bool) *IndicesFreezeService

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 (*IndicesFreezeService) Do deprecated

Do executes the service.

Deprecated: Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization.

func (*IndicesFreezeService) ErrorTrace added in v7.0.7

func (s *IndicesFreezeService) ErrorTrace(errorTrace bool) *IndicesFreezeService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesFreezeService) ExpandWildcards

func (s *IndicesFreezeService) ExpandWildcards(expandWildcards string) *IndicesFreezeService

ExpandWildcards specifies whether to expand wildcard expression to concrete indices that are open, closed or both..

func (*IndicesFreezeService) FilterPath added in v7.0.7

func (s *IndicesFreezeService) FilterPath(filterPath ...string) *IndicesFreezeService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesFreezeService) Header added in v7.0.7

func (s *IndicesFreezeService) Header(name string, value string) *IndicesFreezeService

Header adds a header to the request.

func (*IndicesFreezeService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesFreezeService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesFreezeService) IgnoreUnavailable

func (s *IndicesFreezeService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesFreezeService

IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).

func (*IndicesFreezeService) Index

Index is the name of the index to freeze.

func (*IndicesFreezeService) MasterTimeout

func (s *IndicesFreezeService) MasterTimeout(masterTimeout string) *IndicesFreezeService

MasterTimeout allows to specify a timeout for connection to master.

func (*IndicesFreezeService) Pretty

func (s *IndicesFreezeService) Pretty(pretty bool) *IndicesFreezeService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesFreezeService) Timeout

func (s *IndicesFreezeService) Timeout(timeout string) *IndicesFreezeService

Timeout allows to specify an explicit timeout.

func (*IndicesFreezeService) Validate

func (s *IndicesFreezeService) Validate() error

Validate checks if the operation is valid.

func (*IndicesFreezeService) WaitForActiveShards

func (s *IndicesFreezeService) WaitForActiveShards(numShards string) *IndicesFreezeService

WaitForActiveShards sets the number of active shards to wait for before the operation returns.

type IndicesGetComponentTemplate added in v7.0.25

type IndicesGetComponentTemplate struct {
	Version  int                              `json:"version,omitempty"`
	Template *IndicesGetComponentTemplateData `json:"template,omitempty"`
}

type IndicesGetComponentTemplateData added in v7.0.25

type IndicesGetComponentTemplateData struct {
	Settings map[string]interface{} `json:"settings,omitempty"`
	Mappings map[string]interface{} `json:"mappings,omitempty"`
	Aliases  map[string]interface{} `json:"aliases,omitempty"`
}

type IndicesGetComponentTemplateResponse added in v7.0.25

type IndicesGetComponentTemplateResponse struct {
	ComponentTemplates []IndicesGetComponentTemplates `json:"component_templates"`
}

IndicesGetComponentTemplateResponse is the response of IndicesGetComponentTemplateService.Do.

type IndicesGetComponentTemplateService added in v7.0.25

type IndicesGetComponentTemplateService struct {
	// contains filtered or unexported fields
}

IndicesGetComponentTemplateService returns a component template.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.10/getting-component-templates.html for more details.

func NewIndicesGetComponentTemplateService added in v7.0.25

func NewIndicesGetComponentTemplateService(client *Client) *IndicesGetComponentTemplateService

NewIndicesGetComponentTemplateService creates a new IndicesGetComponentTemplateService.

func (*IndicesGetComponentTemplateService) Do added in v7.0.25

Do executes the operation.

func (*IndicesGetComponentTemplateService) ErrorTrace added in v7.0.25

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesGetComponentTemplateService) FilterPath added in v7.0.25

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesGetComponentTemplateService) FlatSettings added in v7.0.25

FlatSettings is returns settings in flat format (default: false).

func (*IndicesGetComponentTemplateService) Header added in v7.0.25

Header adds a header to the request.

func (*IndicesGetComponentTemplateService) Headers added in v7.0.25

Headers specifies the headers of the request.

func (*IndicesGetComponentTemplateService) Human added in v7.0.25

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesGetComponentTemplateService) Local added in v7.0.25

Local indicates whether to return local information, i.e. do not retrieve the state from master node (default: false).

func (*IndicesGetComponentTemplateService) MasterTimeout added in v7.0.25

MasterTimeout specifies the timeout for connection to master.

func (*IndicesGetComponentTemplateService) Name added in v7.0.25

Name is the name of the component template.

func (*IndicesGetComponentTemplateService) Pretty added in v7.0.25

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesGetComponentTemplateService) Validate added in v7.0.25

Validate checks if the operation is valid.

type IndicesGetComponentTemplates added in v7.0.25

type IndicesGetComponentTemplates struct {
	Name              string                       `json:"name"`
	ComponentTemplate *IndicesGetComponentTemplate `json:"component_template"`
}

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/7.0/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) ErrorTrace added in v7.0.7

ErrorTrace specifies whether to include the stack trace of returned errors.

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

Field is a list of fields.

func (*IndicesGetFieldMappingService) FilterPath added in v7.0.7

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesGetFieldMappingService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesGetFieldMappingService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesGetFieldMappingService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

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

Index is a list of index names.

func (*IndicesGetFieldMappingService) Local

Local indicates whether to return local information, do not retrieve the state from master node (default: false).

func (*IndicesGetFieldMappingService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesGetFieldMappingService) Type

Type is a list of document types.

func (*IndicesGetFieldMappingService) Validate

func (s *IndicesGetFieldMappingService) Validate() error

Validate checks if the operation is valid.

type IndicesGetIndexTemplate added in v7.0.22

type IndicesGetIndexTemplate struct {
	IndexPatterns   []string                     `json:"index_patterns,omitempty"`
	ComposedOf      []string                     `json:"composed_of,omitempty"`
	Priority        int                          `json:"priority,omitempty"`
	Version         int                          `json:"version,omitempty"`
	Template        *IndicesGetIndexTemplateData `json:"template,omitempty"`
	Meta            map[string]interface{}       `json:"_meta,omitempty"`
	DataStream      *IndicesDataStream           `json:"data_stream,omitempty"`
	AllowAutoCreate bool                         `json:"allow_auto_create,omitempty"`
}

type IndicesGetIndexTemplateData added in v7.0.22

type IndicesGetIndexTemplateData struct {
	Settings map[string]interface{} `json:"settings,omitempty"`
	Mappings map[string]interface{} `json:"mappings,omitempty"`
	Aliases  map[string]interface{} `json:"aliases,omitempty"`
}

type IndicesGetIndexTemplateResponse added in v7.0.22

type IndicesGetIndexTemplateResponse struct {
	IndexTemplates IndicesGetIndexTemplatesSlice `json:"index_templates"`
}

IndicesGetIndexTemplateResponse is the response of IndicesGetIndexTemplateService.Do.

type IndicesGetIndexTemplateService added in v7.0.22

type IndicesGetIndexTemplateService struct {
	// contains filtered or unexported fields
}

IndicesGetIndexTemplateService returns an index template.

Index templates have changed during in 7.8 update of Elasticsearch. This service implements the new version (7.8 or later). If you want the old version, please use the IndicesGetTemplateService.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-get-template.html for more details.

func NewIndicesGetIndexTemplateService added in v7.0.22

func NewIndicesGetIndexTemplateService(client *Client) *IndicesGetIndexTemplateService

NewIndicesGetIndexTemplateService creates a new IndicesGetIndexTemplateService.

func (*IndicesGetIndexTemplateService) Do added in v7.0.22

Do executes the operation.

func (*IndicesGetIndexTemplateService) ErrorTrace added in v7.0.22

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesGetIndexTemplateService) FilterPath added in v7.0.22

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesGetIndexTemplateService) FlatSettings added in v7.0.22

FlatSettings is returns settings in flat format (default: false).

func (*IndicesGetIndexTemplateService) Header added in v7.0.22

Header adds a header to the request.

func (*IndicesGetIndexTemplateService) Headers added in v7.0.22

Headers specifies the headers of the request.

func (*IndicesGetIndexTemplateService) Human added in v7.0.22

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesGetIndexTemplateService) Local added in v7.0.22

Local indicates whether to return local information, i.e. do not retrieve the state from master node (default: false).

func (*IndicesGetIndexTemplateService) MasterTimeout added in v7.0.22

func (s *IndicesGetIndexTemplateService) MasterTimeout(masterTimeout string) *IndicesGetIndexTemplateService

MasterTimeout specifies the timeout for connection to master.

func (*IndicesGetIndexTemplateService) Name added in v7.0.22

Name is the name of the index template.

func (*IndicesGetIndexTemplateService) Pretty added in v7.0.22

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesGetIndexTemplateService) Validate added in v7.0.22

func (s *IndicesGetIndexTemplateService) Validate() error

Validate checks if the operation is valid.

type IndicesGetIndexTemplates added in v7.0.22

type IndicesGetIndexTemplates struct {
	Name          string                   `json:"name"`
	IndexTemplate *IndicesGetIndexTemplate `json:"index_template"`
}

type IndicesGetIndexTemplatesSlice added in v7.0.31

type IndicesGetIndexTemplatesSlice []IndicesGetIndexTemplates

IndicesGetIndexTemplatesSlice is a slice of IndicesGetIndexTemplates.

func (IndicesGetIndexTemplatesSlice) ByName added in v7.0.31

ByName returns the template with the given name, if it exists. The bool indicates whether a template with that name has been found.

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/7.0/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) ErrorTrace added in v7.0.7

func (s *IndicesGetMappingService) ErrorTrace(errorTrace bool) *IndicesGetMappingService

ErrorTrace specifies whether to include the stack trace of returned errors.

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) FilterPath added in v7.0.7

func (s *IndicesGetMappingService) FilterPath(filterPath ...string) *IndicesGetMappingService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesGetMappingService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesGetMappingService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesGetMappingService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

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

Index is a list of index names.

func (*IndicesGetMappingService) Local

Local indicates whether to return local information, do not retrieve the state from master node (default: false).

func (*IndicesGetMappingService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesGetMappingService) Type

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/7.0/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

Do executes the operation.

func (*IndicesGetService) ErrorTrace added in v7.0.7

func (s *IndicesGetService) ErrorTrace(errorTrace bool) *IndicesGetService

ErrorTrace specifies whether to include the stack trace of returned errors.

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) FilterPath added in v7.0.7

func (s *IndicesGetService) FilterPath(filterPath ...string) *IndicesGetService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesGetService) Header added in v7.0.7

func (s *IndicesGetService) Header(name string, value string) *IndicesGetService

Header adds a header to the request.

func (*IndicesGetService) Headers added in v7.0.7

func (s *IndicesGetService) Headers(headers http.Header) *IndicesGetService

Headers specifies the headers of the request.

func (*IndicesGetService) Human

func (s *IndicesGetService) Human(human bool) *IndicesGetService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

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 tells Elasticsearch whether to return a formatted JSON response.

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/7.0/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

Do executes the operation.

func (*IndicesGetSettingsService) ErrorTrace added in v7.0.7

func (s *IndicesGetSettingsService) ErrorTrace(errorTrace bool) *IndicesGetSettingsService

ErrorTrace specifies whether to include the stack trace of returned errors.

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) FilterPath added in v7.0.7

func (s *IndicesGetSettingsService) FilterPath(filterPath ...string) *IndicesGetSettingsService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesGetSettingsService) FlatSettings

func (s *IndicesGetSettingsService) FlatSettings(flatSettings bool) *IndicesGetSettingsService

FlatSettings indicates whether to return settings in flat format (default: false).

func (*IndicesGetSettingsService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesGetSettingsService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesGetSettingsService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

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

Index is a list of index names; use `_all` or empty string to perform the operation on all indices.

func (*IndicesGetSettingsService) Local

Local indicates whether to return local information, do not retrieve the state from master node (default: false).

func (*IndicesGetSettingsService) Name

Name are the names of the settings that should be included.

func (*IndicesGetSettingsService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesGetSettingsService) Validate

func (s *IndicesGetSettingsService) Validate() error

Validate checks if the operation is valid.

type IndicesGetTemplateResponse

type IndicesGetTemplateResponse struct {
	Order         int                    `json:"order,omitempty"`
	Version       int                    `json:"version,omitempty"`
	IndexPatterns []string               `json:"index_patterns,omitempty"`
	Settings      map[string]interface{} `json:"settings,omitempty"`
	Mappings      map[string]interface{} `json:"mappings,omitempty"`
	Aliases       map[string]interface{} `json:"aliases,omitempty"`
}

IndicesGetTemplateResponse is the response of IndicesGetTemplateService.Do.

type IndicesGetTemplateService deprecated

type IndicesGetTemplateService struct {
	// contains filtered or unexported fields
}

IndicesGetTemplateService returns an index template (v1).

Index templates have changed during in 7.8 update of Elasticsearch. This service implements the legacy version (7.7 or lower). If you want the new version, please use the IndicesGetIndexTemplateService.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-get-template-v1.html for more details.

Deprecated: Legacy index templates are deprecated in favor of composable templates.

func NewIndicesGetTemplateService

func NewIndicesGetTemplateService(client *Client) *IndicesGetTemplateService

NewIndicesGetTemplateService creates a new IndicesGetTemplateService.

func (*IndicesGetTemplateService) Do deprecated

Do executes the operation.

Deprecated: Legacy index templates are deprecated in favor of composable templates.

func (*IndicesGetTemplateService) ErrorTrace added in v7.0.7

func (s *IndicesGetTemplateService) ErrorTrace(errorTrace bool) *IndicesGetTemplateService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesGetTemplateService) FilterPath added in v7.0.7

func (s *IndicesGetTemplateService) FilterPath(filterPath ...string) *IndicesGetTemplateService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesGetTemplateService) FlatSettings

func (s *IndicesGetTemplateService) FlatSettings(flatSettings bool) *IndicesGetTemplateService

FlatSettings is returns settings in flat format (default: false).

func (*IndicesGetTemplateService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesGetTemplateService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesGetTemplateService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesGetTemplateService) Local

Local indicates whether to return local information, i.e. do not retrieve the state from master node (default: false).

func (*IndicesGetTemplateService) Name

Name is the name of the index template.

func (*IndicesGetTemplateService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesGetTemplateService) Validate

func (s *IndicesGetTemplateService) Validate() error

Validate checks if the operation is valid.

type IndicesOpenResponse

type IndicesOpenResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

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/7.0/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

Do executes the operation.

func (*IndicesOpenService) ErrorTrace added in v7.0.7

func (s *IndicesOpenService) ErrorTrace(errorTrace bool) *IndicesOpenService

ErrorTrace specifies whether to include the stack trace of returned errors.

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) FilterPath added in v7.0.7

func (s *IndicesOpenService) FilterPath(filterPath ...string) *IndicesOpenService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesOpenService) Header added in v7.0.7

func (s *IndicesOpenService) Header(name string, value string) *IndicesOpenService

Header adds a header to the request.

func (*IndicesOpenService) Headers added in v7.0.7

func (s *IndicesOpenService) Headers(headers http.Header) *IndicesOpenService

Headers specifies the headers of the request.

func (*IndicesOpenService) Human added in v7.0.7

func (s *IndicesOpenService) Human(human bool) *IndicesOpenService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

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 tells Elasticsearch whether to return a formatted JSON response.

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.

func (*IndicesOpenService) WaitForActiveShards

func (s *IndicesOpenService) WaitForActiveShards(waitForActiveShards string) *IndicesOpenService

WaitForActiveShards specifies the number of shards that must be allocated before the Open operation returns. Valid values are "all" or an integer between 0 and number_of_replicas+1 (default: 0)

type IndicesPutComponentTemplateResponse added in v7.0.25

type IndicesPutComponentTemplateResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

IndicesPutComponentTemplateResponse is the response of IndicesPutComponentTemplateService.Do.

type IndicesPutComponentTemplateService added in v7.0.25

type IndicesPutComponentTemplateService struct {
	// contains filtered or unexported fields
}

IndicesPutComponentTemplateService creates or updates component templates.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-component-template.html for more details on this API.

func NewIndicesPutComponentTemplateService added in v7.0.25

func NewIndicesPutComponentTemplateService(client *Client) *IndicesPutComponentTemplateService

NewIndicesPutComponentTemplateService creates a new IndicesPutComponentTemplateService.

func (*IndicesPutComponentTemplateService) BodyJson added in v7.0.25

BodyJson is the component template definition as a JSON serializable type, e.g. map[string]interface{}.

func (*IndicesPutComponentTemplateService) BodyString added in v7.0.25

BodyString is the component template definition as a raw string.

func (*IndicesPutComponentTemplateService) Cause added in v7.0.25

Cause is the user-defined reason for creating/updating the the component template.

func (*IndicesPutComponentTemplateService) Create added in v7.0.25

Create indicates whether the component template should only be added if new or can also replace an existing one.

func (*IndicesPutComponentTemplateService) Do added in v7.0.25

Do executes the operation.

func (*IndicesPutComponentTemplateService) ErrorTrace added in v7.0.25

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesPutComponentTemplateService) FilterPath added in v7.0.25

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesPutComponentTemplateService) Header added in v7.0.25

Header adds a header to the request.

func (*IndicesPutComponentTemplateService) Headers added in v7.0.25

Headers specifies the headers of the request.

func (*IndicesPutComponentTemplateService) Human added in v7.0.25

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesPutComponentTemplateService) MasterTimeout added in v7.0.25

MasterTimeout specifies the timeout for connection to master.

func (*IndicesPutComponentTemplateService) Name added in v7.0.25

Name is the name of the component template.

func (*IndicesPutComponentTemplateService) Pretty added in v7.0.25

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesPutComponentTemplateService) Validate added in v7.0.25

Validate checks if the operation is valid.

type IndicesPutIndexTemplateResponse added in v7.0.22

type IndicesPutIndexTemplateResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

IndicesPutIndexTemplateResponse is the response of IndicesPutIndexTemplateService.Do.

type IndicesPutIndexTemplateService added in v7.0.22

type IndicesPutIndexTemplateService struct {
	// contains filtered or unexported fields
}

IndicesPutIndexTemplateService creates or updates index templates.

Index templates have changed during in 7.8 update of Elasticsearch. This service implements the new version (7.8 or higher) for managing index templates. If you want the v1/legacy version, please see e.g. IndicesPutTemplateService and friends.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-put-template.html for more details on this API.

func NewIndicesPutIndexTemplateService added in v7.0.22

func NewIndicesPutIndexTemplateService(client *Client) *IndicesPutIndexTemplateService

NewIndicesPutIndexTemplateService creates a new IndicesPutIndexTemplateService.

func (*IndicesPutIndexTemplateService) BodyJson added in v7.0.22

func (s *IndicesPutIndexTemplateService) BodyJson(body interface{}) *IndicesPutIndexTemplateService

BodyJson is the index template definition as a JSON serializable type, e.g. map[string]interface{}.

func (*IndicesPutIndexTemplateService) BodyString added in v7.0.22

BodyString is the index template definition as a raw string.

func (*IndicesPutIndexTemplateService) Cause added in v7.0.22

Cause is the user-defined reason for creating/updating the the index template.

func (*IndicesPutIndexTemplateService) Create added in v7.0.22

Create indicates whether the index template should only be added if new or can also replace an existing one.

func (*IndicesPutIndexTemplateService) Do added in v7.0.22

Do executes the operation.

func (*IndicesPutIndexTemplateService) ErrorTrace added in v7.0.22

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesPutIndexTemplateService) FilterPath added in v7.0.22

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesPutIndexTemplateService) Header added in v7.0.22

Header adds a header to the request.

func (*IndicesPutIndexTemplateService) Headers added in v7.0.22

Headers specifies the headers of the request.

func (*IndicesPutIndexTemplateService) Human added in v7.0.22

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesPutIndexTemplateService) MasterTimeout added in v7.0.22

func (s *IndicesPutIndexTemplateService) MasterTimeout(masterTimeout string) *IndicesPutIndexTemplateService

MasterTimeout specifies the timeout for connection to master.

func (*IndicesPutIndexTemplateService) Name added in v7.0.22

Name is the name of the index template.

func (*IndicesPutIndexTemplateService) Pretty added in v7.0.22

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesPutIndexTemplateService) Validate added in v7.0.22

func (s *IndicesPutIndexTemplateService) 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/7.0/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

BodyString is the mapping definition serialized as a string.

func (*IndicesPutMappingService) Do

Do executes the operation.

func (*IndicesPutMappingService) ErrorTrace added in v7.0.7

func (s *IndicesPutMappingService) ErrorTrace(errorTrace bool) *IndicesPutMappingService

ErrorTrace specifies whether to include the stack trace of returned errors.

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) FilterPath added in v7.0.7

func (s *IndicesPutMappingService) FilterPath(filterPath ...string) *IndicesPutMappingService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesPutMappingService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesPutMappingService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesPutMappingService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

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) IncludeTypeName added in v7.0.28

func (s *IndicesPutMappingService) IncludeTypeName(includeTypeName bool) *IndicesPutMappingService

IncludeTypeName indicates whether a type should be expected in the body of the mappings.

func (*IndicesPutMappingService) Index

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

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesPutMappingService) Timeout

Timeout is an explicit operation timeout.

func (*IndicesPutMappingService) Validate

func (s *IndicesPutMappingService) Validate() error

Validate checks if the operation is valid.

func (*IndicesPutMappingService) WriteIndexOnly added in v7.0.28

func (s *IndicesPutMappingService) WriteIndexOnly(writeIndexOnly bool) *IndicesPutMappingService

WriteIndexOnly, when true, applies mappings only to the write index of an alias or data stream.

type IndicesPutSettingsResponse

type IndicesPutSettingsResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

IndicesPutSettingsResponse is the response of IndicesPutSettingsService.Do.

type IndicesPutSettingsService

type IndicesPutSettingsService struct {
	// contains filtered or unexported fields
}

IndicesPutSettingsService changes specific index level settings in real time.

See the documentation at https://www.elastic.co/guide/en/elasticsearch/reference/7.0/indices-update-settings.html.

func NewIndicesPutSettingsService

func NewIndicesPutSettingsService(client *Client) *IndicesPutSettingsService

NewIndicesPutSettingsService creates a new IndicesPutSettingsService.

func (*IndicesPutSettingsService) AllowNoIndices

func (s *IndicesPutSettingsService) AllowNoIndices(allowNoIndices bool) *IndicesPutSettingsService

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 (*IndicesPutSettingsService) BodyJson

func (s *IndicesPutSettingsService) BodyJson(body interface{}) *IndicesPutSettingsService

BodyJson is documented as: The index settings to be updated.

func (*IndicesPutSettingsService) BodyString

BodyString is documented as: The index settings to be updated.

func (*IndicesPutSettingsService) Do

Do executes the operation.

func (*IndicesPutSettingsService) ErrorTrace added in v7.0.7

func (s *IndicesPutSettingsService) ErrorTrace(errorTrace bool) *IndicesPutSettingsService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesPutSettingsService) ExpandWildcards

func (s *IndicesPutSettingsService) ExpandWildcards(expandWildcards string) *IndicesPutSettingsService

ExpandWildcards specifies whether to expand wildcard expression to concrete indices that are open, closed or both.

func (*IndicesPutSettingsService) FilterPath added in v7.0.7

func (s *IndicesPutSettingsService) FilterPath(filterPath ...string) *IndicesPutSettingsService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesPutSettingsService) FlatSettings

func (s *IndicesPutSettingsService) FlatSettings(flatSettings bool) *IndicesPutSettingsService

FlatSettings indicates whether to return settings in flat format (default: false).

func (*IndicesPutSettingsService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesPutSettingsService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesPutSettingsService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesPutSettingsService) IgnoreUnavailable

func (s *IndicesPutSettingsService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesPutSettingsService

IgnoreUnavailable specifies whether specified concrete indices should be ignored when unavailable (missing or closed).

func (*IndicesPutSettingsService) Index

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 (*IndicesPutSettingsService) MasterTimeout

func (s *IndicesPutSettingsService) MasterTimeout(masterTimeout string) *IndicesPutSettingsService

MasterTimeout is the timeout for connection to master.

func (*IndicesPutSettingsService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesPutSettingsService) Validate

func (s *IndicesPutSettingsService) Validate() error

Validate checks if the operation is valid.

type IndicesPutTemplateResponse

type IndicesPutTemplateResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

IndicesPutTemplateResponse is the response of IndicesPutTemplateService.Do.

type IndicesPutTemplateService deprecated

type IndicesPutTemplateService struct {
	// contains filtered or unexported fields
}

IndicesPutTemplateService creates or updates templates.

Index templates have changed during in 7.8 update of Elasticsearch. This service implements the legacy version (7.7 or lower). If you want the new version, please use the IndicesPutIndexTemplateService.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-templates-v1.html for more details.

Deprecated: Legacy index templates are deprecated in favor of composable templates.

func NewIndicesPutTemplateService

func NewIndicesPutTemplateService(client *Client) *IndicesPutTemplateService

NewIndicesPutTemplateService creates a new IndicesPutTemplateService.

func (*IndicesPutTemplateService) BodyJson

func (s *IndicesPutTemplateService) BodyJson(body interface{}) *IndicesPutTemplateService

BodyJson is documented as: The template definition.

func (*IndicesPutTemplateService) BodyString

BodyString is documented as: The template definition.

func (*IndicesPutTemplateService) Cause

Cause describes the cause for this index template creation. This is currently undocumented, but part of the Java source.

func (*IndicesPutTemplateService) Create

Create indicates whether the index template should only be added if new or can also replace an existing one.

func (*IndicesPutTemplateService) Do deprecated

Do executes the operation.

Deprecated: Legacy index templates are deprecated in favor of composable templates.

func (*IndicesPutTemplateService) ErrorTrace added in v7.0.7

func (s *IndicesPutTemplateService) ErrorTrace(errorTrace bool) *IndicesPutTemplateService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesPutTemplateService) FilterPath added in v7.0.7

func (s *IndicesPutTemplateService) FilterPath(filterPath ...string) *IndicesPutTemplateService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesPutTemplateService) FlatSettings

func (s *IndicesPutTemplateService) FlatSettings(flatSettings bool) *IndicesPutTemplateService

FlatSettings indicates whether to return settings in flat format (default: false).

func (*IndicesPutTemplateService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesPutTemplateService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesPutTemplateService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesPutTemplateService) IncludeTypeName added in v7.0.28

func (s *IndicesPutTemplateService) IncludeTypeName(includeTypeName bool) *IndicesPutTemplateService

IncludeTypeName indicates whether a type should be expected in the body of the mappings.

func (*IndicesPutTemplateService) MasterTimeout

func (s *IndicesPutTemplateService) MasterTimeout(masterTimeout string) *IndicesPutTemplateService

MasterTimeout specifies the timeout for connection to master.

func (*IndicesPutTemplateService) Name

Name is the name of the index template.

func (*IndicesPutTemplateService) Order

func (s *IndicesPutTemplateService) Order(order interface{}) *IndicesPutTemplateService

Order is the order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers).

func (*IndicesPutTemplateService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesPutTemplateService) Timeout

Timeout is an explicit operation timeout.

func (*IndicesPutTemplateService) Validate

func (s *IndicesPutTemplateService) Validate() error

Validate checks if the operation is valid.

func (*IndicesPutTemplateService) Version

Version sets the version number for this template.

type IndicesRolloverResponse

type IndicesRolloverResponse struct {
	OldIndex           string          `json:"old_index"`
	NewIndex           string          `json:"new_index"`
	RolledOver         bool            `json:"rolled_over"`
	DryRun             bool            `json:"dry_run"`
	Acknowledged       bool            `json:"acknowledged"`
	ShardsAcknowledged bool            `json:"shards_acknowledged"`
	Conditions         map[string]bool `json:"conditions"`
}

IndicesRolloverResponse is the response of IndicesRolloverService.Do.

type IndicesRolloverService

type IndicesRolloverService struct {
	// contains filtered or unexported fields
}

IndicesRolloverService rolls an alias over to a new index when the existing index is considered to be too large or too old.

It is documented at https://www.elastic.co/guide/en/elasticsearch/reference/7.0/indices-rollover-index.html.

func NewIndicesRolloverService

func NewIndicesRolloverService(client *Client) *IndicesRolloverService

NewIndicesRolloverService creates a new IndicesRolloverService.

func (*IndicesRolloverService) AddCondition

func (s *IndicesRolloverService) AddCondition(name string, value interface{}) *IndicesRolloverService

AddCondition adds a condition to the rollover decision.

func (*IndicesRolloverService) AddMapping

func (s *IndicesRolloverService) AddMapping(typ string, mapping interface{}) *IndicesRolloverService

AddMapping adds a mapping for the given type.

func (*IndicesRolloverService) AddMaxIndexAgeCondition

func (s *IndicesRolloverService) AddMaxIndexAgeCondition(time string) *IndicesRolloverService

AddMaxIndexAgeCondition adds a condition to set the max index age.

func (*IndicesRolloverService) AddMaxIndexDocsCondition

func (s *IndicesRolloverService) AddMaxIndexDocsCondition(docs int64) *IndicesRolloverService

AddMaxIndexDocsCondition adds a condition to set the max documents in the index.

func (*IndicesRolloverService) AddSetting

func (s *IndicesRolloverService) AddSetting(name string, value interface{}) *IndicesRolloverService

AddSetting adds an index setting.

func (*IndicesRolloverService) Alias

Alias is the name of the alias to rollover.

func (*IndicesRolloverService) BodyJson

func (s *IndicesRolloverService) BodyJson(body interface{}) *IndicesRolloverService

BodyJson sets the conditions that needs to be met for executing rollover, specified as a serializable JSON instance which is sent as the body of the request.

func (*IndicesRolloverService) BodyString

BodyString sets the conditions that needs to be met for executing rollover, specified as a string which is sent as the body of the request.

func (*IndicesRolloverService) Conditions

func (s *IndicesRolloverService) Conditions(conditions map[string]interface{}) *IndicesRolloverService

Conditions allows to specify all conditions as a dictionary.

func (*IndicesRolloverService) Do

Do executes the operation.

func (*IndicesRolloverService) DryRun

DryRun, when set, specifies that only conditions are checked without performing the actual rollover.

func (*IndicesRolloverService) ErrorTrace added in v7.0.7

func (s *IndicesRolloverService) ErrorTrace(errorTrace bool) *IndicesRolloverService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesRolloverService) FilterPath added in v7.0.7

func (s *IndicesRolloverService) FilterPath(filterPath ...string) *IndicesRolloverService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesRolloverService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesRolloverService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesRolloverService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesRolloverService) Mappings

func (s *IndicesRolloverService) Mappings(mappings map[string]interface{}) *IndicesRolloverService

Mappings adds the index mappings.

func (*IndicesRolloverService) MasterTimeout

func (s *IndicesRolloverService) MasterTimeout(masterTimeout string) *IndicesRolloverService

MasterTimeout specifies the timeout for connection to master.

func (*IndicesRolloverService) NewIndex

func (s *IndicesRolloverService) NewIndex(newIndex string) *IndicesRolloverService

NewIndex is the name of the rollover index.

func (*IndicesRolloverService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesRolloverService) Settings

func (s *IndicesRolloverService) Settings(settings map[string]interface{}) *IndicesRolloverService

Settings adds the index settings.

func (*IndicesRolloverService) Timeout

Timeout sets an explicit operation timeout.

func (*IndicesRolloverService) Validate

func (s *IndicesRolloverService) Validate() error

Validate checks if the operation is valid.

func (*IndicesRolloverService) WaitForActiveShards

func (s *IndicesRolloverService) WaitForActiveShards(waitForActiveShards string) *IndicesRolloverService

WaitForActiveShards sets the number of active shards to wait for on the newly created rollover index before the operation returns.

type IndicesSegmentsResponse

type IndicesSegmentsResponse struct {
	// Shards provides information returned from shards.
	Shards *ShardsInfo `json:"_shards"`

	// Indices provides a map into the stats of an index.
	// The key of the map is the index name.
	Indices map[string]*IndexSegments `json:"indices,omitempty"`
}

IndicesSegmentsResponse is the response of IndicesSegmentsService.Do.

type IndicesSegmentsService

type IndicesSegmentsService struct {
	// contains filtered or unexported fields
}

IndicesSegmentsService provides low level segments information that a Lucene index (shard level) is built with. Allows to be used to provide more information on the state of a shard and an index, possibly optimization information, data "wasted" on deletes, and so on.

Find further documentation at https://www.elastic.co/guide/en/elasticsearch/reference/7.0/indices-segments.html.

func NewIndicesSegmentsService

func NewIndicesSegmentsService(client *Client) *IndicesSegmentsService

NewIndicesSegmentsService creates a new IndicesSegmentsService.

func (*IndicesSegmentsService) AllowNoIndices

func (s *IndicesSegmentsService) AllowNoIndices(allowNoIndices bool) *IndicesSegmentsService

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 (*IndicesSegmentsService) Do

Do executes the operation.

func (*IndicesSegmentsService) ErrorTrace added in v7.0.7

func (s *IndicesSegmentsService) ErrorTrace(errorTrace bool) *IndicesSegmentsService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesSegmentsService) ExpandWildcards

func (s *IndicesSegmentsService) ExpandWildcards(expandWildcards string) *IndicesSegmentsService

ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.

func (*IndicesSegmentsService) FilterPath added in v7.0.7

func (s *IndicesSegmentsService) FilterPath(filterPath ...string) *IndicesSegmentsService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesSegmentsService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesSegmentsService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesSegmentsService) Human

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesSegmentsService) IgnoreUnavailable

func (s *IndicesSegmentsService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesSegmentsService

IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).

func (*IndicesSegmentsService) Index

Index is a comma-separated list of index names; use `_all` or empty string to perform the operation on all indices.

func (*IndicesSegmentsService) OperationThreading

func (s *IndicesSegmentsService) OperationThreading(operationThreading interface{}) *IndicesSegmentsService

OperationThreading is undocumented in Elasticsearch as of now.

func (*IndicesSegmentsService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesSegmentsService) Validate

func (s *IndicesSegmentsService) Validate() error

Validate checks if the operation is valid.

func (*IndicesSegmentsService) Verbose

func (s *IndicesSegmentsService) Verbose(verbose bool) *IndicesSegmentsService

Verbose, when set to true, includes detailed memory usage by Lucene.

type IndicesShardsSyncedFlushResult

type IndicesShardsSyncedFlushResult struct {
	Total      int                                     `json:"total"`
	Successful int                                     `json:"successful"`
	Failed     int                                     `json:"failed"`
	Failures   []IndicesShardsSyncedFlushResultFailure `json:"failures,omitempty"`
}

IndicesShardsSyncedFlushResult represents synced flush information about a specific index.

type IndicesShardsSyncedFlushResultFailure

type IndicesShardsSyncedFlushResultFailure struct {
	Shard   int    `json:"shard"`
	Reason  string `json:"reason"`
	Routing struct {
		State                    string  `json:"state"`
		Primary                  bool    `json:"primary"`
		Node                     string  `json:"node"`
		RelocatingNode           *string `json:"relocating_node"`
		Shard                    int     `json:"shard"`
		Index                    string  `json:"index"`
		ExpectedShardSizeInBytes int64   `json:"expected_shard_size_in_bytes,omitempty"`
	} `json:"routing"`
}

IndicesShardsSyncedFlushResultFailure represents a failure of a synced flush operation.

type IndicesShrinkResponse

type IndicesShrinkResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

IndicesShrinkResponse is the response of IndicesShrinkService.Do.

type IndicesShrinkService

type IndicesShrinkService struct {
	// contains filtered or unexported fields
}

IndicesShrinkService allows you to shrink an existing index into a new index with fewer primary shards.

For further details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/indices-shrink-index.html.

func NewIndicesShrinkService

func NewIndicesShrinkService(client *Client) *IndicesShrinkService

NewIndicesShrinkService creates a new IndicesShrinkService.

func (*IndicesShrinkService) BodyJson

func (s *IndicesShrinkService) BodyJson(body interface{}) *IndicesShrinkService

BodyJson is the configuration for the target index (`settings` and `aliases`) defined as a JSON-serializable instance to be sent as the request body.

func (*IndicesShrinkService) BodyString

func (s *IndicesShrinkService) BodyString(body string) *IndicesShrinkService

BodyString is the configuration for the target index (`settings` and `aliases`) defined as a string to send as the request body.

func (*IndicesShrinkService) Do

Do executes the operation.

func (*IndicesShrinkService) ErrorTrace added in v7.0.7

func (s *IndicesShrinkService) ErrorTrace(errorTrace bool) *IndicesShrinkService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesShrinkService) FilterPath added in v7.0.7

func (s *IndicesShrinkService) FilterPath(filterPath ...string) *IndicesShrinkService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesShrinkService) Header added in v7.0.7

func (s *IndicesShrinkService) Header(name string, value string) *IndicesShrinkService

Header adds a header to the request.

func (*IndicesShrinkService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesShrinkService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesShrinkService) MasterTimeout

func (s *IndicesShrinkService) MasterTimeout(masterTimeout string) *IndicesShrinkService

MasterTimeout specifies the timeout for connection to master.

func (*IndicesShrinkService) Pretty

func (s *IndicesShrinkService) Pretty(pretty bool) *IndicesShrinkService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesShrinkService) Source

Source is the name of the source index to shrink.

func (*IndicesShrinkService) Target

Target is the name of the target index to shrink into.

func (*IndicesShrinkService) Timeout

func (s *IndicesShrinkService) Timeout(timeout string) *IndicesShrinkService

Timeout is an explicit operation timeout.

func (*IndicesShrinkService) Validate

func (s *IndicesShrinkService) Validate() error

Validate checks if the operation is valid.

func (*IndicesShrinkService) WaitForActiveShards

func (s *IndicesShrinkService) WaitForActiveShards(waitForActiveShards string) *IndicesShrinkService

WaitForActiveShards sets the number of active shards to wait for on the shrunken index before the operation returns.

type IndicesStatsResponse

type IndicesStatsResponse struct {
	// Shards provides information returned from shards.
	Shards *ShardsInfo `json:"_shards"`

	// All provides summary stats about all indices.
	All *IndexStats `json:"_all,omitempty"`

	// Indices provides a map into the stats of an index. The key of the
	// map is the index name.
	Indices map[string]*IndexStats `json:"indices,omitempty"`
}

IndicesStatsResponse is the response of IndicesStatsService.Do.

type IndicesStatsService

type IndicesStatsService struct {
	// contains filtered or unexported fields
}

IndicesStatsService provides stats on various metrics of one or more indices. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/indices-stats.html.

func NewIndicesStatsService

func NewIndicesStatsService(client *Client) *IndicesStatsService

NewIndicesStatsService creates a new IndicesStatsService.

func (*IndicesStatsService) CompletionFields

func (s *IndicesStatsService) CompletionFields(completionFields ...string) *IndicesStatsService

CompletionFields is a list of fields for `fielddata` and `suggest` index metric (supports wildcards).

func (*IndicesStatsService) Do

Do executes the operation.

func (*IndicesStatsService) ErrorTrace added in v7.0.7

func (s *IndicesStatsService) ErrorTrace(errorTrace bool) *IndicesStatsService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesStatsService) FielddataFields

func (s *IndicesStatsService) FielddataFields(fielddataFields ...string) *IndicesStatsService

FielddataFields is a list of fields for `fielddata` index metric (supports wildcards).

func (*IndicesStatsService) Fields

func (s *IndicesStatsService) Fields(fields ...string) *IndicesStatsService

Fields is a list of fields for `fielddata` and `completion` index metric (supports wildcards).

func (*IndicesStatsService) FilterPath added in v7.0.7

func (s *IndicesStatsService) FilterPath(filterPath ...string) *IndicesStatsService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesStatsService) Groups

func (s *IndicesStatsService) Groups(groups ...string) *IndicesStatsService

Groups is a list of search groups for `search` index metric.

func (*IndicesStatsService) Header added in v7.0.7

func (s *IndicesStatsService) Header(name string, value string) *IndicesStatsService

Header adds a header to the request.

func (*IndicesStatsService) Headers added in v7.0.7

func (s *IndicesStatsService) Headers(headers http.Header) *IndicesStatsService

Headers specifies the headers of the request.

func (*IndicesStatsService) Human

func (s *IndicesStatsService) Human(human bool) *IndicesStatsService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesStatsService) Index

func (s *IndicesStatsService) Index(indices ...string) *IndicesStatsService

Index is the list of index names; use `_all` or empty string to perform the operation on all indices.

func (*IndicesStatsService) Level

Level returns stats aggregated at cluster, index or shard level.

func (*IndicesStatsService) Metric

func (s *IndicesStatsService) Metric(metric ...string) *IndicesStatsService

Metric limits the information returned the specific metrics. Options are: docs, store, indexing, get, search, completion, fielddata, flush, merge, query_cache, refresh, suggest, and warmer.

func (*IndicesStatsService) Pretty

func (s *IndicesStatsService) Pretty(pretty bool) *IndicesStatsService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesStatsService) Type

func (s *IndicesStatsService) Type(types ...string) *IndicesStatsService

Type is a list of document types for the `indexing` index metric.

func (*IndicesStatsService) Validate

func (s *IndicesStatsService) Validate() error

Validate checks if the operation is valid.

type IndicesSyncedFlushResponse

type IndicesSyncedFlushResponse struct {
	Shards *ShardsInfo                                `json:"_shards"`
	Index  map[string]*IndicesShardsSyncedFlushResult `json:"-"`
}

IndicesSyncedFlushResponse is the outcome of a synched flush call.

func (*IndicesSyncedFlushResponse) UnmarshalJSON

func (resp *IndicesSyncedFlushResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the output from Synced Flush API.

type IndicesSyncedFlushService

type IndicesSyncedFlushService struct {
	// contains filtered or unexported fields
}

IndicesSyncedFlushService performs a normal flush, then adds a generated unique marked (sync_id) to all shards.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/indices-synced-flush.html for details.

func NewIndicesSyncedFlushService

func NewIndicesSyncedFlushService(client *Client) *IndicesSyncedFlushService

NewIndicesSyncedFlushService creates a new IndicesSyncedFlushService.

func (*IndicesSyncedFlushService) AllowNoIndices

func (s *IndicesSyncedFlushService) AllowNoIndices(allowNoIndices bool) *IndicesSyncedFlushService

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 (*IndicesSyncedFlushService) Do deprecated

Do executes the service.

Deprecated: Synced flush is deprecated and will be removed in 8.0. Use flush at _/flush or /{index}/_flush instead.

func (*IndicesSyncedFlushService) ErrorTrace added in v7.0.7

func (s *IndicesSyncedFlushService) ErrorTrace(errorTrace bool) *IndicesSyncedFlushService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesSyncedFlushService) ExpandWildcards

func (s *IndicesSyncedFlushService) ExpandWildcards(expandWildcards string) *IndicesSyncedFlushService

ExpandWildcards specifies whether to expand wildcard expression to concrete indices that are open, closed or both..

func (*IndicesSyncedFlushService) FilterPath added in v7.0.7

func (s *IndicesSyncedFlushService) FilterPath(filterPath ...string) *IndicesSyncedFlushService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesSyncedFlushService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesSyncedFlushService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesSyncedFlushService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesSyncedFlushService) IgnoreUnavailable

func (s *IndicesSyncedFlushService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesSyncedFlushService

IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).

func (*IndicesSyncedFlushService) Index

Index is a list of index names; use `_all` or empty string for all indices.

func (*IndicesSyncedFlushService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesSyncedFlushService) Validate

func (s *IndicesSyncedFlushService) Validate() error

Validate checks if the operation is valid.

type IndicesUnfreezeResponse

type IndicesUnfreezeResponse struct {
	Shards *ShardsInfo `json:"_shards"`
}

IndicesUnfreezeResponse is the outcome of freezing an index.

type IndicesUnfreezeService deprecated

type IndicesUnfreezeService struct {
	// contains filtered or unexported fields
}

IndicesUnfreezeService unfreezes an index.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/unfreeze-index-api.html and https://www.elastic.co/blog/creating-frozen-indices-with-the-elasticsearch-freeze-index-api for details.

Deprecated: Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization.

func NewIndicesUnfreezeService

func NewIndicesUnfreezeService(client *Client) *IndicesUnfreezeService

NewIndicesUnfreezeService creates a new IndicesUnfreezeService.

func (*IndicesUnfreezeService) AllowNoIndices

func (s *IndicesUnfreezeService) AllowNoIndices(allowNoIndices bool) *IndicesUnfreezeService

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 (*IndicesUnfreezeService) Do deprecated

Do executes the service.

Deprecated: Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization.

func (*IndicesUnfreezeService) ErrorTrace added in v7.0.7

func (s *IndicesUnfreezeService) ErrorTrace(errorTrace bool) *IndicesUnfreezeService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IndicesUnfreezeService) ExpandWildcards

func (s *IndicesUnfreezeService) ExpandWildcards(expandWildcards string) *IndicesUnfreezeService

ExpandWildcards specifies whether to expand wildcard expression to concrete indices that are open, closed or both..

func (*IndicesUnfreezeService) FilterPath added in v7.0.7

func (s *IndicesUnfreezeService) FilterPath(filterPath ...string) *IndicesUnfreezeService

FilterPath specifies a list of filters used to reduce the response.

func (*IndicesUnfreezeService) Header added in v7.0.7

Header adds a header to the request.

func (*IndicesUnfreezeService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IndicesUnfreezeService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IndicesUnfreezeService) IgnoreUnavailable

func (s *IndicesUnfreezeService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesUnfreezeService

IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).

func (*IndicesUnfreezeService) Index

Index is the name of the index to unfreeze.

func (*IndicesUnfreezeService) MasterTimeout

func (s *IndicesUnfreezeService) MasterTimeout(masterTimeout string) *IndicesUnfreezeService

MasterTimeout allows to specify a timeout for connection to master.

func (*IndicesUnfreezeService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IndicesUnfreezeService) Timeout

Timeout allows to specify an explicit timeout.

func (*IndicesUnfreezeService) Validate

func (s *IndicesUnfreezeService) Validate() error

Validate checks if the operation is valid.

func (*IndicesUnfreezeService) WaitForActiveShards

func (s *IndicesUnfreezeService) WaitForActiveShards(numShards string) *IndicesUnfreezeService

WaitForActiveShards sets the number of active shards to wait for before the operation returns.

type IngestDeletePipelineResponse

type IngestDeletePipelineResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

IngestDeletePipelineResponse is the response of IngestDeletePipelineService.Do.

type IngestDeletePipelineService

type IngestDeletePipelineService struct {
	// contains filtered or unexported fields
}

IngestDeletePipelineService deletes pipelines by ID. It is documented at https://www.elastic.co/guide/en/elasticsearch/reference/7.0/delete-pipeline-api.html.

func NewIngestDeletePipelineService

func NewIngestDeletePipelineService(client *Client) *IngestDeletePipelineService

NewIngestDeletePipelineService creates a new IngestDeletePipelineService.

func (*IngestDeletePipelineService) Do

Do executes the operation.

func (*IngestDeletePipelineService) ErrorTrace added in v7.0.7

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IngestDeletePipelineService) FilterPath added in v7.0.7

func (s *IngestDeletePipelineService) FilterPath(filterPath ...string) *IngestDeletePipelineService

FilterPath specifies a list of filters used to reduce the response.

func (*IngestDeletePipelineService) Header added in v7.0.7

Header adds a header to the request.

func (*IngestDeletePipelineService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IngestDeletePipelineService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IngestDeletePipelineService) Id

Id is documented as: Pipeline ID.

func (*IngestDeletePipelineService) MasterTimeout

func (s *IngestDeletePipelineService) MasterTimeout(masterTimeout string) *IngestDeletePipelineService

MasterTimeout is documented as: Explicit operation timeout for connection to master node.

func (*IngestDeletePipelineService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IngestDeletePipelineService) Timeout

Timeout is documented as: Explicit operation timeout.

func (*IngestDeletePipelineService) Validate

func (s *IngestDeletePipelineService) Validate() error

Validate checks if the operation is valid.

type IngestGetPipeline

type IngestGetPipeline struct {
	Description string                   `json:"description"`
	Processors  []map[string]interface{} `json:"processors"`
	Version     int64                    `json:"version,omitempty"`
	OnFailure   []map[string]interface{} `json:"on_failure,omitempty"`
}

IngestGetPipeline describes a specific ingest pipeline, its processors etc.

type IngestGetPipelineResponse

type IngestGetPipelineResponse map[string]*IngestGetPipeline

IngestGetPipelineResponse is the response of IngestGetPipelineService.Do.

type IngestGetPipelineService

type IngestGetPipelineService struct {
	// contains filtered or unexported fields
}

IngestGetPipelineService returns pipelines based on ID. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/get-pipeline-api.html for documentation.

func NewIngestGetPipelineService

func NewIngestGetPipelineService(client *Client) *IngestGetPipelineService

NewIngestGetPipelineService creates a new IngestGetPipelineService.

func (*IngestGetPipelineService) Do

Do executes the operation.

func (*IngestGetPipelineService) ErrorTrace added in v7.0.7

func (s *IngestGetPipelineService) ErrorTrace(errorTrace bool) *IngestGetPipelineService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IngestGetPipelineService) FilterPath added in v7.0.7

func (s *IngestGetPipelineService) FilterPath(filterPath ...string) *IngestGetPipelineService

FilterPath specifies a list of filters used to reduce the response.

func (*IngestGetPipelineService) Header added in v7.0.7

Header adds a header to the request.

func (*IngestGetPipelineService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IngestGetPipelineService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IngestGetPipelineService) Id

Id is a list of pipeline ids. Wildcards supported.

func (*IngestGetPipelineService) MasterTimeout

func (s *IngestGetPipelineService) MasterTimeout(masterTimeout string) *IngestGetPipelineService

MasterTimeout is an explicit operation timeout for connection to master node.

func (*IngestGetPipelineService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IngestGetPipelineService) Validate

func (s *IngestGetPipelineService) Validate() error

Validate checks if the operation is valid.

type IngestPutPipelineResponse

type IngestPutPipelineResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

IngestPutPipelineResponse is the response of IngestPutPipelineService.Do.

type IngestPutPipelineService

type IngestPutPipelineService struct {
	// contains filtered or unexported fields
}

IngestPutPipelineService adds pipelines and updates existing pipelines in the cluster.

It is documented at https://www.elastic.co/guide/en/elasticsearch/reference/7.0/put-pipeline-api.html.

func NewIngestPutPipelineService

func NewIngestPutPipelineService(client *Client) *IngestPutPipelineService

NewIngestPutPipelineService creates a new IngestPutPipelineService.

func (*IngestPutPipelineService) BodyJson

func (s *IngestPutPipelineService) BodyJson(body interface{}) *IngestPutPipelineService

BodyJson is the ingest definition, defined as a JSON-serializable document. Use e.g. a map[string]interface{} here.

func (*IngestPutPipelineService) BodyString

BodyString is the ingest definition, specified as a string.

func (*IngestPutPipelineService) Do

Do executes the operation.

func (*IngestPutPipelineService) ErrorTrace added in v7.0.7

func (s *IngestPutPipelineService) ErrorTrace(errorTrace bool) *IngestPutPipelineService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IngestPutPipelineService) FilterPath added in v7.0.7

func (s *IngestPutPipelineService) FilterPath(filterPath ...string) *IngestPutPipelineService

FilterPath specifies a list of filters used to reduce the response.

func (*IngestPutPipelineService) Header added in v7.0.7

Header adds a header to the request.

func (*IngestPutPipelineService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IngestPutPipelineService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IngestPutPipelineService) Id

Id is the pipeline ID.

func (*IngestPutPipelineService) MasterTimeout

func (s *IngestPutPipelineService) MasterTimeout(masterTimeout string) *IngestPutPipelineService

MasterTimeout is an explicit operation timeout for connection to master node.

func (*IngestPutPipelineService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IngestPutPipelineService) Timeout

Timeout specifies an explicit operation timeout.

func (*IngestPutPipelineService) Validate

func (s *IngestPutPipelineService) Validate() error

Validate checks if the operation is valid.

type IngestSimulateDocumentResult

type IngestSimulateDocumentResult struct {
	Doc              map[string]interface{}           `json:"doc"`
	ProcessorResults []*IngestSimulateProcessorResult `json:"processor_results"`
}

type IngestSimulatePipelineResponse

type IngestSimulatePipelineResponse struct {
	Docs []*IngestSimulateDocumentResult `json:"docs"`
}

IngestSimulatePipelineResponse is the response of IngestSimulatePipeline.Do.

type IngestSimulatePipelineService

type IngestSimulatePipelineService struct {
	// contains filtered or unexported fields
}

IngestSimulatePipelineService executes a specific pipeline against the set of documents provided in the body of the request.

The API is documented at https://www.elastic.co/guide/en/elasticsearch/reference/7.0/simulate-pipeline-api.html.

func NewIngestSimulatePipelineService

func NewIngestSimulatePipelineService(client *Client) *IngestSimulatePipelineService

NewIngestSimulatePipelineService creates a new IngestSimulatePipeline.

func (*IngestSimulatePipelineService) BodyJson

func (s *IngestSimulatePipelineService) BodyJson(body interface{}) *IngestSimulatePipelineService

BodyJson is the ingest definition, defined as a JSON-serializable simulate definition. Use e.g. a map[string]interface{} here.

func (*IngestSimulatePipelineService) BodyString

BodyString is the simulate definition, defined as a string.

func (*IngestSimulatePipelineService) Do

Do executes the operation.

func (*IngestSimulatePipelineService) ErrorTrace added in v7.0.7

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*IngestSimulatePipelineService) FilterPath added in v7.0.7

FilterPath specifies a list of filters used to reduce the response.

func (*IngestSimulatePipelineService) Header added in v7.0.7

Header adds a header to the request.

func (*IngestSimulatePipelineService) Headers added in v7.0.7

Headers specifies the headers of the request.

func (*IngestSimulatePipelineService) Human added in v7.0.7

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*IngestSimulatePipelineService) Id

Id specifies the pipeline ID.

func (*IngestSimulatePipelineService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*IngestSimulatePipelineService) Validate

func (s *IngestSimulatePipelineService) Validate() error

Validate checks if the operation is valid.

func (*IngestSimulatePipelineService) Verbose

Verbose mode. Display data output for each processor in executed pipeline.

type IngestSimulateProcessorResult

type IngestSimulateProcessorResult struct {
	ProcessorTag string                 `json:"tag"`
	Doc          map[string]interface{} `json:"doc"`
}

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/7.0/search-request-inner-hits.html for documentation.

See the tests for SearchSource, HasChildFilter, HasChildQuery, HasParentFilter, HasParentQuery, NestedFilter, and NestedQuery for usage examples.

func NewInnerHit

func NewInnerHit() *InnerHit

NewInnerHit creates a new InnerHit.

func (*InnerHit) Collapse added in v7.0.21

func (hit *InnerHit) Collapse(collapse *CollapseBuilder) *InnerHit

func (*InnerHit) DocvalueField

func (hit *InnerHit) DocvalueField(docvalueField string) *InnerHit

func (*InnerHit) DocvalueFieldWithFormat

func (hit *InnerHit) DocvalueFieldWithFormat(docvalueField DocvalueField) *InnerHit

func (*InnerHit) DocvalueFields

func (hit *InnerHit) DocvalueFields(docvalueFields ...string) *InnerHit

func (*InnerHit) DocvalueFieldsWithFormat

func (hit *InnerHit) DocvalueFieldsWithFormat(docvalueFields ...DocvalueField) *InnerHit

func (*InnerHit) Explain

func (hit *InnerHit) Explain(explain bool) *InnerHit

func (*InnerHit) FetchSource

func (hit *InnerHit) FetchSource(fetchSource bool) *InnerHit

func (*InnerHit) FetchSourceContext

func (hit *InnerHit) FetchSourceContext(fetchSourceContext *FetchSourceContext) *InnerHit

func (*InnerHit) From

func (hit *InnerHit) From(from int) *InnerHit

func (*InnerHit) Highlight

func (hit *InnerHit) Highlight(highlight *Highlight) *InnerHit

func (*InnerHit) Highlighter

func (hit *InnerHit) Highlighter() *Highlight

func (*InnerHit) Name

func (hit *InnerHit) Name(name string) *InnerHit

func (*InnerHit) NoStoredFields

func (hit *InnerHit) NoStoredFields() *InnerHit

func (*InnerHit) Path

func (hit *InnerHit) Path(path string) *InnerHit

func (*InnerHit) Query

func (hit *InnerHit) Query(query Query) *InnerHit

func (*InnerHit) ScriptField

func (hit *InnerHit) ScriptField(scriptField *ScriptField) *InnerHit

func (*InnerHit) ScriptFields

func (hit *InnerHit) ScriptFields(scriptFields ...*ScriptField) *InnerHit

func (*InnerHit) Size

func (hit *InnerHit) Size(size int) *InnerHit

func (*InnerHit) Sort

func (hit *InnerHit) Sort(field string, ascending bool) *InnerHit

func (*InnerHit) SortBy

func (hit *InnerHit) SortBy(sorter ...Sorter) *InnerHit

func (*InnerHit) SortWithInfo

func (hit *InnerHit) SortWithInfo(info SortInfo) *InnerHit

func (*InnerHit) Source

func (hit *InnerHit) Source() (interface{}, error)

func (*InnerHit) StoredField

func (hit *InnerHit) StoredField(storedFieldName string) *InnerHit

func (*InnerHit) StoredFields

func (hit *InnerHit) StoredFields(storedFieldNames ...string) *InnerHit

func (*InnerHit) TrackScores

func (hit *InnerHit) TrackScores(trackScores bool) *InnerHit

func (*InnerHit) Type

func (hit *InnerHit) Type(typ string) *InnerHit

func (*InnerHit) Version

func (hit *InnerHit) Version(version bool) *InnerHit

type IntervalQuery added in v7.0.10

type IntervalQuery struct {
	// contains filtered or unexported fields
}

IntervalQuery returns documents based on the order and proximity of matching terms.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/query-dsl-intervals-query.html

func NewIntervalQuery added in v7.0.10

func NewIntervalQuery(field string, rule IntervalQueryRule) *IntervalQuery

NewIntervalQuery creates and initializes a new IntervalQuery.

func (*IntervalQuery) Source added in v7.0.10

func (q *IntervalQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

type IntervalQueryFilter added in v7.0.10

type IntervalQueryFilter struct {
	// contains filtered or unexported fields
}

IntervalQueryFilter specifies filters used in some IntervalQueryRule implementations, e.g. IntervalQueryRuleAllOf.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.5/query-dsl-intervals-query.html#interval_filter for details.

func NewIntervalQueryFilter added in v7.0.10

func NewIntervalQueryFilter() *IntervalQueryFilter

NewIntervalQueryFilter initializes and creates a new IntervalQueryFilter.

func (*IntervalQueryFilter) After added in v7.0.10

After specifies the query to be used to return intervals that follow an interval from the filter rule.

func (*IntervalQueryFilter) Before added in v7.0.10

Before specifies the query to be used to return intervals that occur before an interval from the filter rule.

func (*IntervalQueryFilter) ContainedBy added in v7.0.10

func (r *IntervalQueryFilter) ContainedBy(containedBy IntervalQueryRule) *IntervalQueryFilter

ContainedBy specifies the query to be used to return intervals contained by an interval from the filter rule.

func (*IntervalQueryFilter) Containing added in v7.0.10

func (r *IntervalQueryFilter) Containing(containing IntervalQueryRule) *IntervalQueryFilter

Containing specifies the query to be used to return intervals that contain an interval from the filter rule.

func (*IntervalQueryFilter) NotContainedBy added in v7.0.10

func (r *IntervalQueryFilter) NotContainedBy(notContainedBy IntervalQueryRule) *IntervalQueryFilter

NotContainedBy specifies the query to be used to return intervals that are NOT contained by an interval from the filter rule.

func (*IntervalQueryFilter) NotContaining added in v7.0.10

func (r *IntervalQueryFilter) NotContaining(notContaining IntervalQueryRule) *IntervalQueryFilter

NotContaining specifies the query to be used to return intervals that do NOT contain an interval from the filter rule.

func (*IntervalQueryFilter) NotOverlapping added in v7.0.10

func (r *IntervalQueryFilter) NotOverlapping(notOverlapping IntervalQueryRule) *IntervalQueryFilter

NotOverlapping specifies the query to be used to return intervals that do NOT overlap with an interval from the filter rule.

func (*IntervalQueryFilter) Overlapping added in v7.0.10

func (r *IntervalQueryFilter) Overlapping(overlapping IntervalQueryRule) *IntervalQueryFilter

Overlapping specifies the query to be used to return intervals that overlap with an interval from the filter rule.

func (*IntervalQueryFilter) Script added in v7.0.10

func (r *IntervalQueryFilter) Script(script *Script) *IntervalQueryFilter

Script allows a script to be used to return matching documents. The script must return a boolean value, true or false.

func (*IntervalQueryFilter) Source added in v7.0.10

func (r *IntervalQueryFilter) Source() (interface{}, error)

Source returns JSON for the function score query.

type IntervalQueryRule added in v7.0.10

type IntervalQueryRule interface {
	Query
	// contains filtered or unexported methods
}

IntervalQueryRule represents the generic matching interval rule interface. Interval Rule is actually just a Query, but may be used only inside IntervalQuery. An extra method is added just to shield its implementations (*Rule objects) from other query objects.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.5/query-dsl-intervals-query.html for details.

type IntervalQueryRuleAllOf added in v7.0.10

type IntervalQueryRuleAllOf struct {
	// contains filtered or unexported fields
}

IntervalQueryRuleAllOf is an implementation of IntervalQueryRule.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.5/query-dsl-intervals-query.html#intervals-all_of for details.

func NewIntervalQueryRuleAllOf added in v7.0.10

func NewIntervalQueryRuleAllOf(intervals ...IntervalQueryRule) *IntervalQueryRuleAllOf

NewIntervalQueryRuleAllOf initializes and returns a new instance of IntervalQueryRuleAllOf.

func (*IntervalQueryRuleAllOf) Filter added in v7.0.10

Filter adds an additional interval filter.

func (*IntervalQueryRuleAllOf) MaxGaps added in v7.0.10

func (r *IntervalQueryRuleAllOf) MaxGaps(maxGaps int) *IntervalQueryRuleAllOf

MaxGaps specifies the maximum number of positions between the matching terms. Terms further apart than this are considered matches. Defaults to -1.

func (*IntervalQueryRuleAllOf) Ordered added in v7.0.10

func (r *IntervalQueryRuleAllOf) Ordered(ordered bool) *IntervalQueryRuleAllOf

Ordered, if true, indicates that matching terms must appear in their specified order. Defaults to false.

func (*IntervalQueryRuleAllOf) Source added in v7.0.10

func (r *IntervalQueryRuleAllOf) Source() (interface{}, error)

Source returns JSON for the function score query.

type IntervalQueryRuleAnyOf added in v7.0.10

type IntervalQueryRuleAnyOf struct {
	// contains filtered or unexported fields
}

IntervalQueryRuleAnyOf is an implementation of IntervalQueryRule.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.5/query-dsl-intervals-query.html#intervals-any_of for details.

func NewIntervalQueryRuleAnyOf added in v7.0.10

func NewIntervalQueryRuleAnyOf(intervals ...IntervalQueryRule) *IntervalQueryRuleAnyOf

NewIntervalQueryRuleAnyOf initializes and returns a new instance of IntervalQueryRuleAnyOf.

func (*IntervalQueryRuleAnyOf) Filter added in v7.0.10

Filter adds an additional interval filter.

func (*IntervalQueryRuleAnyOf) Source added in v7.0.10

func (r *IntervalQueryRuleAnyOf) Source() (interface{}, error)

Source returns JSON for the function score query.

type IntervalQueryRuleFuzzy added in v7.0.31

type IntervalQueryRuleFuzzy struct {
	// contains filtered or unexported fields
}

IntervalQueryRuleFuzzy is an implementation of IntervalQueryRule.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.16/query-dsl-intervals-query.html#intervals-fuzzy for details.

func NewIntervalQueryRuleFuzzy added in v7.0.31

func NewIntervalQueryRuleFuzzy(term string) *IntervalQueryRuleFuzzy

NewIntervalQueryRuleFuzzy initializes and returns a new instance of IntervalQueryRuleFuzzy.

func (*IntervalQueryRuleFuzzy) Analyzer added in v7.0.31

func (r *IntervalQueryRuleFuzzy) Analyzer(analyzer string) *IntervalQueryRuleFuzzy

Analyzer specifies the analyzer used to analyze terms in the query.

func (*IntervalQueryRuleFuzzy) Fuzziness added in v7.0.31

func (q *IntervalQueryRuleFuzzy) Fuzziness(fuzziness interface{}) *IntervalQueryRuleFuzzy

Fuzziness is the maximum edit distance allowed for matching. It can be integers like 0, 1 or 2 as well as strings like "auto", "0..1", "1..4" or "0.0..1.0". Defaults to "auto".

func (*IntervalQueryRuleFuzzy) PrefixLength added in v7.0.31

func (q *IntervalQueryRuleFuzzy) PrefixLength(prefixLength int) *IntervalQueryRuleFuzzy

PrefixLength is the number of beginning characters left unchanged when creating expansions. Defaults to 0.

func (*IntervalQueryRuleFuzzy) Source added in v7.0.31

func (r *IntervalQueryRuleFuzzy) Source() (interface{}, error)

Source returns JSON for the function score query.

func (*IntervalQueryRuleFuzzy) Transpositions added in v7.0.31

func (q *IntervalQueryRuleFuzzy) Transpositions(transpositions bool) *IntervalQueryRuleFuzzy

Transpositions indicates whether edits include transpositions of two adjacent characters (ab -> ba). Defaults to true.

func (*IntervalQueryRuleFuzzy) UseField added in v7.0.31

func (r *IntervalQueryRuleFuzzy) UseField(useField string) *IntervalQueryRuleFuzzy

UseField, if specified, matches the intervals from this field rather than the top-level field.

type IntervalQueryRuleMatch added in v7.0.10

type IntervalQueryRuleMatch struct {
	// contains filtered or unexported fields
}

IntervalQueryRuleMatch is an implementation of IntervalQueryRule.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.5/query-dsl-intervals-query.html#intervals-match for details.

func NewIntervalQueryRuleMatch added in v7.0.10

func NewIntervalQueryRuleMatch(query string) *IntervalQueryRuleMatch

NewIntervalQueryRuleMatch initializes and returns a new instance of IntervalQueryRuleMatch.

func (*IntervalQueryRuleMatch) Analyzer added in v7.0.10

func (r *IntervalQueryRuleMatch) Analyzer(analyzer string) *IntervalQueryRuleMatch

Analyzer specifies the analyzer used to analyze terms in the query.

func (*IntervalQueryRuleMatch) Filter added in v7.0.10

Filter adds an additional interval filter.

func (*IntervalQueryRuleMatch) MaxGaps added in v7.0.10

func (r *IntervalQueryRuleMatch) MaxGaps(maxGaps int) *IntervalQueryRuleMatch

MaxGaps specifies the maximum number of positions between the matching terms. Terms further apart than this are considered matches. Defaults to -1.

func (*IntervalQueryRuleMatch) Ordered added in v7.0.10

func (r *IntervalQueryRuleMatch) Ordered(ordered bool) *IntervalQueryRuleMatch

Ordered, if true, indicates that matching terms must appear in their specified order. Defaults to false.

func (*IntervalQueryRuleMatch) Source added in v7.0.10

func (r *IntervalQueryRuleMatch) Source() (interface{}, error)

Source returns JSON for the function score query.

func (*IntervalQueryRuleMatch) UseField added in v7.0.10

func (r *IntervalQueryRuleMatch) UseField(useField string) *IntervalQueryRuleMatch

UseField, if specified, matches the intervals from this field rather than the top-level field.

type IntervalQueryRulePrefix added in v7.0.10

type IntervalQueryRulePrefix struct {
	// contains filtered or unexported fields
}

IntervalQueryRulePrefix is an implementation of IntervalQueryRule.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.5/query-dsl-intervals-query.html#intervals-prefix for details.

func NewIntervalQueryRulePrefix added in v7.0.10

func NewIntervalQueryRulePrefix(prefix string) *IntervalQueryRulePrefix

NewIntervalQueryRulePrefix initializes and returns a new instance of IntervalQueryRulePrefix.

func (*IntervalQueryRulePrefix) Analyzer added in v7.0.10

Analyzer specifies the analyzer used to analyze terms in the query.

func (*IntervalQueryRulePrefix) Source added in v7.0.10

func (r *IntervalQueryRulePrefix) Source() (interface{}, error)

Source returns JSON for the function score query.

func (*IntervalQueryRulePrefix) UseField added in v7.0.10

UseField, if specified, matches the intervals from this field rather than the top-level field.

type IntervalQueryRuleWildcard added in v7.0.10

type IntervalQueryRuleWildcard struct {
	// contains filtered or unexported fields
}

IntervalQueryRuleWildcard is an implementation of IntervalQueryRule.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.5/query-dsl-intervals-query.html#intervals-wildcard for details.

func NewIntervalQueryRuleWildcard added in v7.0.10

func NewIntervalQueryRuleWildcard(pattern string) *IntervalQueryRuleWildcard

NewIntervalQueryRuleWildcard initializes and returns a new instance of IntervalQueryRuleWildcard.

func (*IntervalQueryRuleWildcard) Analyzer added in v7.0.10

Analyzer specifies the analyzer used to analyze terms in the query.

func (*IntervalQueryRuleWildcard) Source added in v7.0.10

func (r *IntervalQueryRuleWildcard) Source() (interface{}, error)

Source returns JSON for the function score query.

func (*IntervalQueryRuleWildcard) UseField added in v7.0.10

UseField, if specified, matches the intervals from this field rather than the top-level field.

type JLHScoreSignificanceHeuristic

type JLHScoreSignificanceHeuristic struct{}

JLHScoreSignificanceHeuristic implements the JLH score as described in https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-significantterms-aggregation.html#_jlh_score.

func NewJLHScoreSignificanceHeuristic

func NewJLHScoreSignificanceHeuristic() *JLHScoreSignificanceHeuristic

NewJLHScoreSignificanceHeuristic initializes a new JLHScoreSignificanceHeuristic.

func (*JLHScoreSignificanceHeuristic) Name

Name returns the name of the heuristic in the REST interface.

func (*JLHScoreSignificanceHeuristic) Source

func (sh *JLHScoreSignificanceHeuristic) Source() (interface{}, error)

Source returns the parameters that need to be added to the REST parameters.

type LaplaceSmoothingModel

type LaplaceSmoothingModel struct {
	// contains filtered or unexported fields
}

LaplaceSmoothingModel implements a laplace smoothing model. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-suggesters-phrase.html#_smoothing_models for details about smoothing models.

func NewLaplaceSmoothingModel

func NewLaplaceSmoothingModel(alpha float64) *LaplaceSmoothingModel

func (*LaplaceSmoothingModel) Source

func (sm *LaplaceSmoothingModel) Source() (interface{}, error)

func (*LaplaceSmoothingModel) Type

func (sm *LaplaceSmoothingModel) Type() string

type LinearDecayFunction

type LinearDecayFunction struct {
	// contains filtered or unexported fields
}

LinearDecayFunction builds a linear decay score function. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-function-score-query.html for details.

func NewLinearDecayFunction

func NewLinearDecayFunction() *LinearDecayFunction

NewLinearDecayFunction initializes and returns a new LinearDecayFunction.

func (*LinearDecayFunction) Decay

Decay defines how documents are scored at the distance given a Scale. If no decay is defined, documents at the distance Scale will be scored 0.5.

func (*LinearDecayFunction) FieldName

func (fn *LinearDecayFunction) FieldName(fieldName string) *LinearDecayFunction

FieldName specifies the name of the field to which this decay function is applied to.

func (*LinearDecayFunction) GetMultiValueMode

func (fn *LinearDecayFunction) GetMultiValueMode() string

GetMultiValueMode returns how the decay function should be calculated on a field that has multiple values. Valid modes are: min, max, avg, and sum.

func (*LinearDecayFunction) GetWeight

func (fn *LinearDecayFunction) GetWeight() *float64

GetWeight returns the adjusted score. It is part of the ScoreFunction interface. Returns nil if weight is not specified.

func (*LinearDecayFunction) MultiValueMode

func (fn *LinearDecayFunction) MultiValueMode(mode string) *LinearDecayFunction

MultiValueMode specifies how the decay function should be calculated on a field that has multiple values. Valid modes are: min, max, avg, and sum.

func (*LinearDecayFunction) Name

func (fn *LinearDecayFunction) Name() string

Name represents the JSON field name under which the output of Source needs to be serialized by FunctionScoreQuery (see FunctionScoreQuery.Source).

func (*LinearDecayFunction) Offset

func (fn *LinearDecayFunction) Offset(offset interface{}) *LinearDecayFunction

Offset, if defined, computes the decay function only for a distance greater than the defined offset.

func (*LinearDecayFunction) Origin

func (fn *LinearDecayFunction) Origin(origin interface{}) *LinearDecayFunction

Origin defines the "central point" by which the decay function calculates "distance".

func (*LinearDecayFunction) Scale

func (fn *LinearDecayFunction) Scale(scale interface{}) *LinearDecayFunction

Scale defines the scale to be used with Decay.

func (*LinearDecayFunction) Source

func (fn *LinearDecayFunction) Source() (interface{}, error)

Source returns the serializable JSON data of this score function.

func (*LinearDecayFunction) Weight

func (fn *LinearDecayFunction) Weight(weight float64) *LinearDecayFunction

Weight adjusts the score of the score function. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-function-score-query.html#_using_function_score for details.

type LinearInterpolationSmoothingModel

type LinearInterpolationSmoothingModel struct {
	// contains filtered or unexported fields
}

LinearInterpolationSmoothingModel implements a linear interpolation smoothing model. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-suggesters-phrase.html#_smoothing_models for details about smoothing models.

func NewLinearInterpolationSmoothingModel

func NewLinearInterpolationSmoothingModel(trigramLamda, bigramLambda, unigramLambda float64) *LinearInterpolationSmoothingModel

func (*LinearInterpolationSmoothingModel) Source

func (sm *LinearInterpolationSmoothingModel) Source() (interface{}, error)

func (*LinearInterpolationSmoothingModel) Type

type LinearMovAvgModel

type LinearMovAvgModel struct {
}

LinearMovAvgModel calculates a linearly weighted moving average, such that older values are linearly less important. "Time" is determined by position in collection.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-movavg-aggregation.html#_linear

func NewLinearMovAvgModel

func NewLinearMovAvgModel() *LinearMovAvgModel

NewLinearMovAvgModel creates and initializes a new LinearMovAvgModel.

func (*LinearMovAvgModel) Name

func (m *LinearMovAvgModel) Name() string

Name of the model.

func (*LinearMovAvgModel) Settings

func (m *LinearMovAvgModel) Settings() map[string]interface{}

Settings of the model.

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/7.0/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) MarshalJSON added in v7.0.30

func (q *MatchAllQuery) MarshalJSON() ([]byte, error)

MarshalJSON enables serializing the type as JSON.

func (*MatchAllQuery) QueryName

func (q *MatchAllQuery) QueryName(name string) *MatchAllQuery

QueryName sets the query name.

func (*MatchAllQuery) Source

func (q *MatchAllQuery) Source() (interface{}, error)

Source returns JSON for the match all query.

type MatchBoolPrefixQuery added in v7.0.25

type MatchBoolPrefixQuery struct {
	// contains filtered or unexported fields
}

MatchBoolPrefixQuery query analyzes its input and constructs a bool query from the terms. Each term except the last is used in a term query. The last term is used in a prefix query.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-match-bool-prefix-query.html

func NewMatchBoolPrefixQuery added in v7.0.25

func NewMatchBoolPrefixQuery(name string, queryText interface{}) *MatchBoolPrefixQuery

NewMatchBoolPrefixQuery creates and initializes a new MatchBoolPrefixQuery.

func (*MatchBoolPrefixQuery) Analyzer added in v7.0.25

func (q *MatchBoolPrefixQuery) Analyzer(analyzer string) *MatchBoolPrefixQuery

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 (*MatchBoolPrefixQuery) Boost added in v7.0.25

Boost sets the boost to apply to this query.

func (*MatchBoolPrefixQuery) Fuzziness added in v7.0.25

func (q *MatchBoolPrefixQuery) Fuzziness(fuzziness string) *MatchBoolPrefixQuery

Fuzziness sets the edit distance for fuzzy queries. Default is "AUTO".

func (*MatchBoolPrefixQuery) FuzzyRewrite added in v7.0.25

func (q *MatchBoolPrefixQuery) FuzzyRewrite(fuzzyRewrite string) *MatchBoolPrefixQuery

FuzzyRewrite sets the fuzzy_rewrite parameter controlling how the fuzzy query will get rewritten.

func (*MatchBoolPrefixQuery) FuzzyTranspositions added in v7.0.25

func (q *MatchBoolPrefixQuery) FuzzyTranspositions(fuzzyTranspositions bool) *MatchBoolPrefixQuery

FuzzyTranspositions if true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.

func (*MatchBoolPrefixQuery) MaxExpansions added in v7.0.25

func (q *MatchBoolPrefixQuery) MaxExpansions(n int) *MatchBoolPrefixQuery

MaxExpansions sets the number of term expansions to use.

func (*MatchBoolPrefixQuery) MinimumShouldMatch added in v7.0.25

func (q *MatchBoolPrefixQuery) MinimumShouldMatch(minimumShouldMatch string) *MatchBoolPrefixQuery

MinimumShouldMatch sets the optional minimumShouldMatch value to apply to the query.

func (*MatchBoolPrefixQuery) Operator added in v7.0.25

func (q *MatchBoolPrefixQuery) Operator(operator string) *MatchBoolPrefixQuery

Operator sets the operator to use when using a boolean query. Can be "AND" or "OR" (default).

func (*MatchBoolPrefixQuery) PrefixLength added in v7.0.25

func (q *MatchBoolPrefixQuery) PrefixLength(prefixLength int) *MatchBoolPrefixQuery

PrefixLength is the number of beginning characters left unchanged for fuzzy matching. Defaults to 0.

func (*MatchBoolPrefixQuery) Source added in v7.0.25

func (q *MatchBoolPrefixQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

type MatchNoneQuery

type MatchNoneQuery struct {
	// contains filtered or unexported fields
}

MatchNoneQuery returns no documents. It is the inverse of MatchAllQuery.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-match-all-query.html

func NewMatchNoneQuery

func NewMatchNoneQuery() *MatchNoneQuery

NewMatchNoneQuery creates and initializes a new match none query.

func (*MatchNoneQuery) QueryName

func (q *MatchNoneQuery) QueryName(name string) *MatchNoneQuery

QueryName sets the query name.

func (MatchNoneQuery) Source

func (q MatchNoneQuery) Source() (interface{}, error)

Source returns JSON for the match none query.

type MatchPhrasePrefixQuery

type MatchPhrasePrefixQuery struct {
	// contains filtered or unexported fields
}

MatchPhrasePrefixQuery is the same as match_phrase, except that it allows for prefix matches on the last term in the text.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-match-query-phrase-prefix.html

func NewMatchPhrasePrefixQuery

func NewMatchPhrasePrefixQuery(name string, value interface{}) *MatchPhrasePrefixQuery

NewMatchPhrasePrefixQuery creates and initializes a new MatchPhrasePrefixQuery.

func (*MatchPhrasePrefixQuery) Analyzer

func (q *MatchPhrasePrefixQuery) Analyzer(analyzer string) *MatchPhrasePrefixQuery

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 (*MatchPhrasePrefixQuery) Boost

Boost sets the boost to apply to this query.

func (*MatchPhrasePrefixQuery) MaxExpansions

func (q *MatchPhrasePrefixQuery) MaxExpansions(n int) *MatchPhrasePrefixQuery

MaxExpansions sets the number of term expansions to use.

func (*MatchPhrasePrefixQuery) QueryName

func (q *MatchPhrasePrefixQuery) QueryName(queryName string) *MatchPhrasePrefixQuery

QueryName sets the query name for the filter that can be used when searching for matched filters per hit.

func (*MatchPhrasePrefixQuery) Slop

Slop sets the phrase slop if evaluated to a phrase query type.

func (*MatchPhrasePrefixQuery) Source

func (q *MatchPhrasePrefixQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

type MatchPhraseQuery

type MatchPhraseQuery struct {
	// contains filtered or unexported fields
}

MatchPhraseQuery analyzes the text and creates a phrase query out of the analyzed text.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-match-query-phrase.html

func NewMatchPhraseQuery

func NewMatchPhraseQuery(name string, value interface{}) *MatchPhraseQuery

NewMatchPhraseQuery creates and initializes a new MatchPhraseQuery.

func (*MatchPhraseQuery) Analyzer

func (q *MatchPhraseQuery) Analyzer(analyzer string) *MatchPhraseQuery

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 (*MatchPhraseQuery) Boost

func (q *MatchPhraseQuery) Boost(boost float64) *MatchPhraseQuery

Boost sets the boost to apply to this query.

func (*MatchPhraseQuery) QueryName

func (q *MatchPhraseQuery) QueryName(queryName string) *MatchPhraseQuery

QueryName sets the query name for the filter that can be used when searching for matched filters per hit.

func (*MatchPhraseQuery) Slop

func (q *MatchPhraseQuery) Slop(slop int) *MatchPhraseQuery

Slop sets the phrase slop if evaluated to a phrase query type.

func (*MatchPhraseQuery) Source

func (q *MatchPhraseQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

func (*MatchPhraseQuery) ZeroTermsQuery added in v7.0.23

func (q *MatchPhraseQuery) ZeroTermsQuery(zeroTermsQuery string) *MatchPhraseQuery

ZeroTermsQuery can be "all" or "none".

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/7.0/query-dsl-match-query.html

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

FuzzyRewrite sets the fuzzy_rewrite parameter controlling how the fuzzy query will get rewritten.

func (*MatchQuery) FuzzyTranspositions

func (q *MatchQuery) FuzzyTranspositions(fuzzyTranspositions bool) *MatchQuery

FuzzyTranspositions sets whether transpositions are supported in fuzzy queries.

The default metric used by fuzzy queries to determine a match is the Damerau-Levenshtein distance formula which supports transpositions. Setting transposition to false will * switch to classic Levenshtein distance. * If not set, Damerau-Levenshtein distance metric will be used.

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

MinimumShouldMatch sets the optional minimumShouldMatch value to apply to the query.

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

PrefixLength sets the length of a length of common (non-fuzzy) prefix for fuzzy match queries. It must be non-negative.

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

func (q *MatchQuery) Source() (interface{}, error)

Source returns JSON for the function score query.

func (*MatchQuery) ZeroTermsQuery

func (q *MatchQuery) ZeroTermsQuery(zeroTermsQuery string) *MatchQuery

ZeroTermsQuery can be "all" or "none".

type MatrixStatsAggregation

type MatrixStatsAggregation struct {
	// contains filtered or unexported fields
}

MatrixMatrixStatsAggregation is a multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. These values can be extracted either from specific numeric fields in the documents, or be generated by a provided script.

The stats that are returned consist of: min, max, sum, count and avg.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-metrics-stats-aggregation.html for details.

func NewMatrixStatsAggregation

func NewMatrixStatsAggregation() *MatrixStatsAggregation

NewMatrixStatsAggregation initializes a new MatrixStatsAggregation.

func (*MatrixStatsAggregation) Fields

func (*MatrixStatsAggregation) Format

func (*MatrixStatsAggregation) Meta

func (a *MatrixStatsAggregation) Meta(metaData map[string]interface{}) *MatrixStatsAggregation

Meta sets the meta data to be included in the aggregation response.

func (*MatrixStatsAggregation) Missing

func (a *MatrixStatsAggregation) Missing(missing interface{}) *MatrixStatsAggregation

Missing configures the value to use when documents miss a value.

func (*MatrixStatsAggregation) Mode

Mode specifies how to operate. Valid values are: sum, avg, median, min, or max.

func (*MatrixStatsAggregation) Source

func (a *MatrixStatsAggregation) Source() (interface{}, error)

Source returns the JSON to serialize into the request, or an error.

func (*MatrixStatsAggregation) SubAggregation

func (a *MatrixStatsAggregation) SubAggregation(name string, subAggregation Aggregation) *MatrixStatsAggregation

func (*MatrixStatsAggregation) ValueType

func (a *MatrixStatsAggregation) ValueType(valueType interface{}) *MatrixStatsAggregation

type MaxAggregation

type MaxAggregation struct {
	// contains filtered or unexported fields
}

MaxAggregation is a single-value metrics aggregation that keeps track and returns the maximum value among the numeric values extracted from the aggregated documents. These values can be extracted either from specific numeric fields in the documents, or be generated by a provided script. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-metrics-max-aggregation.html

func NewMaxAggregation

func NewMaxAggregation() *MaxAggregation

func (*MaxAggregation) Field

func (a *MaxAggregation) Field(field string) *MaxAggregation

func (*MaxAggregation) Format

func (a *MaxAggregation) Format(format string) *MaxAggregation

func (*MaxAggregation) Meta

func (a *MaxAggregation) Meta(metaData map[string]interface{}) *MaxAggregation

Meta sets the meta data to be included in the aggregation response.

func (*MaxAggregation) Missing

func (a *MaxAggregation) Missing(missing interface{}) *MaxAggregation

func (*MaxAggregation) Script

func (a *MaxAggregation) Script(script *Script) *MaxAggregation

func (*MaxAggregation) Source

func (a *MaxAggregation) Source() (interface{}, error)

func (*MaxAggregation) SubAggregation

func (a *MaxAggregation) SubAggregation(name string, subAggregation Aggregation) *MaxAggregation

type MaxBucketAggregation

type MaxBucketAggregation struct {
	// contains filtered or unexported fields
}

MaxBucketAggregation is a sibling pipeline aggregation which identifies the bucket(s) with the maximum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). The specified metric must be numeric and the sibling aggregation must be a multi-bucket aggregation.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-max-bucket-aggregation.html

func NewMaxBucketAggregation

func NewMaxBucketAggregation() *MaxBucketAggregation

NewMaxBucketAggregation creates and initializes a new MaxBucketAggregation.

func (*MaxBucketAggregation) BucketsPath

func (a *MaxBucketAggregation) BucketsPath(bucketsPaths ...string) *MaxBucketAggregation

BucketsPath sets the paths to the buckets to use for this pipeline aggregator.

func (*MaxBucketAggregation) Format

Format to use on the output of this aggregation.

func (*MaxBucketAggregation) GapInsertZeros

func (a *MaxBucketAggregation) GapInsertZeros() *MaxBucketAggregation

GapInsertZeros inserts zeros for gaps in the series.

func (*MaxBucketAggregation) GapPolicy

func (a *MaxBucketAggregation) GapPolicy(gapPolicy string) *MaxBucketAggregation

GapPolicy defines what should be done when a gap in the series is discovered. Valid values include "insert_zeros" or "skip". Default is "insert_zeros".

func (*MaxBucketAggregation) GapSkip

GapSkip skips gaps in the series.

func (*MaxBucketAggregation) Meta

func (a *MaxBucketAggregation) Meta(metaData map[string]interface{}) *MaxBucketAggregation

Meta sets the meta data to be included in the aggregation response.

func (*MaxBucketAggregation) Source

func (a *MaxBucketAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

type MedianAbsoluteDeviationAggregation added in v7.0.15

type MedianAbsoluteDeviationAggregation struct {
	// contains filtered or unexported fields
}

MedianAbsoluteDeviationAggregation is a measure of variability. It is a robust statistic, meaning that it is useful for describing data that may have outliers, or may not be normally distributed. For such data it can be more descriptive than standard deviation.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.6/search-aggregations-metrics-median-absolute-deviation-aggregation.html for details.

func NewMedianAbsoluteDeviationAggregation added in v7.0.15

func NewMedianAbsoluteDeviationAggregation() *MedianAbsoluteDeviationAggregation

func (*MedianAbsoluteDeviationAggregation) Compression added in v7.0.15

func (*MedianAbsoluteDeviationAggregation) Field added in v7.0.15

func (*MedianAbsoluteDeviationAggregation) Format added in v7.0.15

func (*MedianAbsoluteDeviationAggregation) Meta added in v7.0.15

Meta sets the meta data to be included in the aggregation response.

func (*MedianAbsoluteDeviationAggregation) Missing added in v7.0.15

func (*MedianAbsoluteDeviationAggregation) Script added in v7.0.15

func (*MedianAbsoluteDeviationAggregation) Source added in v7.0.15

func (a *MedianAbsoluteDeviationAggregation) Source() (interface{}, error)

func (*MedianAbsoluteDeviationAggregation) SubAggregation added in v7.0.15

type MgetResponse

type MgetResponse struct {
	Docs []*GetResult `json:"docs,omitempty"`
}

MgetResponse is the outcome of a Multi GET API request.

type MgetService

type MgetService struct {
	// contains filtered or unexported fields
}

MgetService allows to get multiple documents based on an index, type (optional) and id (possibly routing). The response includes a docs array with all the fetched documents, each element similar in structure to a document provided by the Get API.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-multi-get.html for details.

func NewMgetService

func NewMgetService(client *Client) *MgetService

NewMgetService initializes a new Multi GET API request call.

func (*MgetService) Add

func (s *MgetService) Add(items ...*MultiGetItem) *MgetService

Add an item to the request.

func (*MgetService) Do

func (s *MgetService) Do(ctx context.Context) (*MgetResponse, error)

Do executes the request.

func (*MgetService) ErrorTrace added in v7.0.7

func (s *MgetService) ErrorTrace(errorTrace bool) *MgetService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*MgetService) FilterPath added in v7.0.7

func (s *MgetService) FilterPath(filterPath ...string) *MgetService

FilterPath specifies a list of filters used to reduce the response.

func (*MgetService) Header added in v7.0.7

func (s *MgetService) Header(name string, value string) *MgetService

Header adds a header to the request.

func (*MgetService) Headers added in v7.0.7

func (s *MgetService) Headers(headers http.Header) *MgetService

Headers specifies the headers of the request.

func (*MgetService) Human added in v7.0.7

func (s *MgetService) Human(human bool) *MgetService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*MgetService) Preference

func (s *MgetService) Preference(preference string) *MgetService

Preference specifies the node or shard the operation should be performed on (default: random).

func (*MgetService) Pretty

func (s *MgetService) Pretty(pretty bool) *MgetService

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*MgetService) Realtime

func (s *MgetService) Realtime(realtime bool) *MgetService

Realtime specifies whether to perform the operation in realtime or search mode.

func (*MgetService) Refresh

func (s *MgetService) Refresh(refresh string) *MgetService

Refresh the shard containing the document before performing the operation.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-refresh.html for details.

func (*MgetService) Routing

func (s *MgetService) Routing(routing string) *MgetService

Routing is the specific routing value.

func (*MgetService) Source

func (s *MgetService) Source() (interface{}, error)

Source returns the request body, which will be serialized into JSON.

func (*MgetService) StoredFields

func (s *MgetService) StoredFields(storedFields ...string) *MgetService

StoredFields is a list of fields to return in the response.

type MinAggregation

type MinAggregation struct {
	// contains filtered or unexported fields
}

MinAggregation is a single-value metrics aggregation that keeps track and returns the minimum value among numeric values extracted from the aggregated documents. These values can be extracted either from specific numeric fields in the documents, or be generated by a provided script. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-metrics-min-aggregation.html

func NewMinAggregation

func NewMinAggregation() *MinAggregation

func (*MinAggregation) Field

func (a *MinAggregation) Field(field string) *MinAggregation

func (*MinAggregation) Format

func (a *MinAggregation) Format(format string) *MinAggregation

func (*MinAggregation) Meta

func (a *MinAggregation) Meta(metaData map[string]interface{}) *MinAggregation

Meta sets the meta data to be included in the aggregation response.

func (*MinAggregation) Missing

func (a *MinAggregation) Missing(missing interface{}) *MinAggregation

func (*MinAggregation) Script

func (a *MinAggregation) Script(script *Script) *MinAggregation

func (*MinAggregation) Source

func (a *MinAggregation) Source() (interface{}, error)

func (*MinAggregation) SubAggregation

func (a *MinAggregation) SubAggregation(name string, subAggregation Aggregation) *MinAggregation

type MinBucketAggregation

type MinBucketAggregation struct {
	// contains filtered or unexported fields
}

MinBucketAggregation is a sibling pipeline aggregation which identifies the bucket(s) with the maximum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). The specified metric must be numeric and the sibling aggregation must be a multi-bucket aggregation.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-min-bucket-aggregation.html

func NewMinBucketAggregation

func NewMinBucketAggregation() *MinBucketAggregation

NewMinBucketAggregation creates and initializes a new MinBucketAggregation.

func (*MinBucketAggregation) BucketsPath

func (a *MinBucketAggregation) BucketsPath(bucketsPaths ...string) *MinBucketAggregation

BucketsPath sets the paths to the buckets to use for this pipeline aggregator.

func (*MinBucketAggregation) Format

Format to use on the output of this aggregation.

func (*MinBucketAggregation) GapInsertZeros

func (a *MinBucketAggregation) GapInsertZeros() *MinBucketAggregation

GapInsertZeros inserts zeros for gaps in the series.

func (*MinBucketAggregation) GapPolicy

func (a *MinBucketAggregation) GapPolicy(gapPolicy string) *MinBucketAggregation

GapPolicy defines what should be done when a gap in the series is discovered. Valid values include "insert_zeros" or "skip". Default is "insert_zeros".

func (*MinBucketAggregation) GapSkip

GapSkip skips gaps in the series.

func (*MinBucketAggregation) Meta

func (a *MinBucketAggregation) Meta(metaData map[string]interface{}) *MinBucketAggregation

Meta sets the meta data to be included in the aggregation response.

func (*MinBucketAggregation) Source

func (a *MinBucketAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

type MissingAggregation

type MissingAggregation struct {
	// contains filtered or unexported fields
}

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). This aggregator will often be used in conjunction with other field data bucket aggregators (such as ranges) to return information for all the documents that could not be placed in any of the other buckets due to missing field data values. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-missing-aggregation.html

func NewMissingAggregation

func NewMissingAggregation() *MissingAggregation

func (*MissingAggregation) Field

func (a *MissingAggregation) Field(field string) *MissingAggregation

func (*MissingAggregation) Meta

func (a *MissingAggregation) Meta(metaData map[string]interface{}) *MissingAggregation

Meta sets the meta data to be included in the aggregation response.

func (*MissingAggregation) Source

func (a *MissingAggregation) Source() (interface{}, error)

func (*MissingAggregation) SubAggregation

func (a *MissingAggregation) SubAggregation(name string, subAggregation Aggregation) *MissingAggregation

type MoreLikeThisQuery

type MoreLikeThisQuery struct {
	// contains filtered or unexported fields
}

MoreLikeThis query (MLT Query) finds documents that are "like" a given set of documents. In order to do so, MLT selects a set of representative terms of these input documents, forms a query using these terms, executes the query and returns the results. The user controls the input documents, how the terms should be selected and how the query is formed.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-mlt-query.html

func NewMoreLikeThisQuery

func NewMoreLikeThisQuery() *MoreLikeThisQuery

NewMoreLikeThisQuery creates and initializes a new MoreLikeThisQuery.

func (*MoreLikeThisQuery) Analyzer

func (q *MoreLikeThisQuery) Analyzer(analyzer string) *MoreLikeThisQuery

Analyzer specifies the analyzer that will be use to analyze the text. Defaults to the analyzer associated with the field.

func (*MoreLikeThisQuery) Boost

func (q *MoreLikeThisQuery) Boost(boost float64) *MoreLikeThisQuery

Boost sets the boost for this query.

func (*MoreLikeThisQuery) BoostTerms

func (q *MoreLikeThisQuery) BoostTerms(boostTerms float64) *MoreLikeThisQuery

BoostTerms sets the boost factor to use when boosting terms. It defaults to 1.

func (*MoreLikeThisQuery) FailOnUnsupportedField

func (q *MoreLikeThisQuery) FailOnUnsupportedField(fail bool) *MoreLikeThisQuery

FailOnUnsupportedField indicates whether to fail or return no result when this query is run against a field which is not supported such as a binary/numeric field.

func (*MoreLikeThisQuery) Field

func (q *MoreLikeThisQuery) Field(fields ...string) *MoreLikeThisQuery

Field adds one or more field names to the query.

func (*MoreLikeThisQuery) Ids

func (q *MoreLikeThisQuery) Ids(ids ...string) *MoreLikeThisQuery

Ids sets the document ids to use in order to find documents that are "like" this.

func (*MoreLikeThisQuery) IgnoreLikeItems

func (q *MoreLikeThisQuery) IgnoreLikeItems(ignoreDocs ...*MoreLikeThisQueryItem) *MoreLikeThisQuery

IgnoreLikeItems sets the documents from which the terms should not be selected from.

func (*MoreLikeThisQuery) IgnoreLikeText

func (q *MoreLikeThisQuery) IgnoreLikeText(ignoreLikeText ...string) *MoreLikeThisQuery

IgnoreLikeText sets the text from which the terms should not be selected from.

func (*MoreLikeThisQuery) Include

func (q *MoreLikeThisQuery) Include(include bool) *MoreLikeThisQuery

Include specifies whether the input documents should also be included in the results returned. Defaults to false.

func (*MoreLikeThisQuery) LikeItems

LikeItems sets the documents to use in order to find documents that are "like" this.

func (*MoreLikeThisQuery) LikeText

func (q *MoreLikeThisQuery) LikeText(likeTexts ...string) *MoreLikeThisQuery

LikeText sets the text to use in order to find documents that are "like" this.

func (*MoreLikeThisQuery) MaxDocFreq

func (q *MoreLikeThisQuery) MaxDocFreq(maxDocFreq int) *MoreLikeThisQuery

MaxDocFreq sets the maximum frequency for which words may still appear. Words that appear in more than this many docs will be ignored. It defaults to unbounded.

func (*MoreLikeThisQuery) MaxQueryTerms

func (q *MoreLikeThisQuery) MaxQueryTerms(maxQueryTerms int) *MoreLikeThisQuery

MaxQueryTerms sets the maximum number of query terms that will be included in any generated query. It defaults to 25.

func (*MoreLikeThisQuery) MaxWordLength

func (q *MoreLikeThisQuery) MaxWordLength(maxWordLength int) *MoreLikeThisQuery

MaxWordLength sets the maximum word length above which words will be ignored. Defaults to unbounded (0).

func (*MoreLikeThisQuery) MinDocFreq

func (q *MoreLikeThisQuery) MinDocFreq(minDocFreq int) *MoreLikeThisQuery

MinDocFreq sets the frequency at which words will be ignored which do not occur in at least this many docs. The default is 5.

func (*MoreLikeThisQuery) MinTermFreq

func (q *MoreLikeThisQuery) MinTermFreq(minTermFreq int) *MoreLikeThisQuery

MinTermFreq is the frequency below which terms will be ignored in the source doc. The default frequency is 2.

func (*MoreLikeThisQuery) MinWordLength

func (q *MoreLikeThisQuery) MinWordLength(minWordLength int) *MoreLikeThisQuery

MinWordLength sets the minimum word length below which words will be ignored. It defaults to 0.

func (*MoreLikeThisQuery) MinimumShouldMatch

func (q *MoreLikeThisQuery) MinimumShouldMatch(minimumShouldMatch string) *MoreLikeThisQuery

MinimumShouldMatch sets the number of terms that must match the generated query expressed in the common syntax for minimum should match. The default value is "30%".

This used to be "PercentTermsToMatch" in Elasticsearch versions before 2.0.

func (*MoreLikeThisQuery) QueryName

func (q *MoreLikeThisQuery) QueryName(queryName string) *MoreLikeThisQuery

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit.

func (*MoreLikeThisQuery) Source

func (q *MoreLikeThisQuery) Source() (interface{}, error)

Source creates the source for the MLT query. It may return an error if the caller forgot to specify any documents to be "liked" in the MoreLikeThisQuery.

func (*MoreLikeThisQuery) StopWord

func (q *MoreLikeThisQuery) StopWord(stopWords ...string) *MoreLikeThisQuery

StopWord sets the stopwords. Any word in this set is considered "uninteresting" and ignored. Even if your Analyzer allows stopwords, you might want to tell the MoreLikeThis code to ignore them, as for the purposes of document similarity it seems reasonable to assume that "a stop word is never interesting".

type MoreLikeThisQueryItem

type MoreLikeThisQueryItem struct {
	// contains filtered or unexported fields
}

MoreLikeThisQueryItem represents a single item of a MoreLikeThisQuery to be "liked" or "unliked".

func NewMoreLikeThisQueryItem

func NewMoreLikeThisQueryItem() *MoreLikeThisQueryItem

NewMoreLikeThisQueryItem creates and initializes a MoreLikeThisQueryItem.

func (*MoreLikeThisQueryItem) Doc

func (item *MoreLikeThisQueryItem) Doc(doc interface{}) *MoreLikeThisQueryItem

Doc represents a raw document template for the item.

func (*MoreLikeThisQueryItem) FetchSourceContext

func (item *MoreLikeThisQueryItem) FetchSourceContext(fsc *FetchSourceContext) *MoreLikeThisQueryItem

FetchSourceContext represents the fetch source of the item which controls if and how _source should be returned.

func (*MoreLikeThisQueryItem) Fields

func (item *MoreLikeThisQueryItem) Fields(fields ...string) *MoreLikeThisQueryItem

Fields represents the list of fields of the item.

func (*MoreLikeThisQueryItem) Id

Id represents the document id of the item.

func (*MoreLikeThisQueryItem) Index

Index represents the index of the item.

func (*MoreLikeThisQueryItem) LikeText

func (item *MoreLikeThisQueryItem) LikeText(likeText string) *MoreLikeThisQueryItem

LikeText represents a text to be "liked".

func (*MoreLikeThisQueryItem) Routing

func (item *MoreLikeThisQueryItem) Routing(routing string) *MoreLikeThisQueryItem

Routing sets the routing associated with the item.

func (*MoreLikeThisQueryItem) Source

func (item *MoreLikeThisQueryItem) Source() (interface{}, error)

Source returns the JSON-serializable fragment of the entity.

func (*MoreLikeThisQueryItem) Type deprecated

Type represents the document type of the item.

Deprecated: Types are in the process of being removed.

func (*MoreLikeThisQueryItem) Version

func (item *MoreLikeThisQueryItem) Version(version int64) *MoreLikeThisQueryItem

Version specifies the version of the item.

func (*MoreLikeThisQueryItem) VersionType

func (item *MoreLikeThisQueryItem) VersionType(versionType string) *MoreLikeThisQueryItem

VersionType represents the version type of the item.

type MovAvgAggregation deprecated

type MovAvgAggregation struct {
	// contains filtered or unexported fields
}

MovAvgAggregation operates on a series of data. It will slide a window across the data and emit the average value of that window.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-movavg-aggregation.html

Deprecated: The MovAvgAggregation has been deprecated in 6.4.0. Use the more generate MovFnAggregation instead.

func NewMovAvgAggregation deprecated

func NewMovAvgAggregation() *MovAvgAggregation

NewMovAvgAggregation creates and initializes a new MovAvgAggregation.

Deprecated: The MovAvgAggregation has been deprecated in 6.4.0. Use the more generate MovFnAggregation instead.

func (*MovAvgAggregation) BucketsPath

func (a *MovAvgAggregation) BucketsPath(bucketsPaths ...string) *MovAvgAggregation

BucketsPath sets the paths to the buckets to use for this pipeline aggregator.

func (*MovAvgAggregation) Format

func (a *MovAvgAggregation) Format(format string) *MovAvgAggregation

Format to use on the output of this aggregation.

func (*MovAvgAggregation) GapInsertZeros

func (a *MovAvgAggregation) GapInsertZeros() *MovAvgAggregation

GapInsertZeros inserts zeros for gaps in the series.

func (*MovAvgAggregation) GapPolicy

func (a *MovAvgAggregation) GapPolicy(gapPolicy string) *MovAvgAggregation

GapPolicy defines what should be done when a gap in the series is discovered. Valid values include "insert_zeros" or "skip". Default is "insert_zeros".

func (*MovAvgAggregation) GapSkip

func (a *MovAvgAggregation) GapSkip() *MovAvgAggregation

GapSkip skips gaps in the series.

func (*MovAvgAggregation) Meta

func (a *MovAvgAggregation) Meta(metaData map[string]interface{}) *MovAvgAggregation

Meta sets the meta data to be included in the aggregation response.

func (*MovAvgAggregation) Minimize

func (a *MovAvgAggregation) Minimize(minimize bool) *MovAvgAggregation

Minimize determines if the model should be fit to the data using a cost minimizing algorithm.

func (*MovAvgAggregation) Model

Model is used to define what type of moving average you want to use in the series.

func (*MovAvgAggregation) Predict

func (a *MovAvgAggregation) Predict(numPredictions int) *MovAvgAggregation

Predict sets the number of predictions that should be returned. Each prediction will be spaced at the intervals in the histogram. E.g. a predict of 2 will return two new buckets at the end of the histogram with the predicted values.

func (*MovAvgAggregation) Source

func (a *MovAvgAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

func (*MovAvgAggregation) Window

func (a *MovAvgAggregation) Window(window int) *MovAvgAggregation

Window sets the window size for the moving average. This window will "slide" across the series, and the values inside that window will be used to calculate the moving avg value.

type MovAvgModel

type MovAvgModel interface {
	Name() string
	Settings() map[string]interface{}
}

MovAvgModel specifies the model to use with the MovAvgAggregation.

type MovFnAggregation

type MovFnAggregation struct {
	// contains filtered or unexported fields
}

MovFnAggregation, given an ordered series of data, will slice a window across the data and allow the user to specify a custom script that is executed for each window of data.

You must pass a script to process the values. There are a number of predefined script functions you can use as described here: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-movfn-aggregation.html#_pre_built_functions.

Example:

agg := elastic.NewMovFnAggregation(
  "the_sum", // bucket path
  elastic.NewScript("MovingFunctions.stdDev(values, MovingFunctions.unweightedAvg(values))"),
  10,        // window size
)

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-pipeline-movfn-aggregation.html.

func NewMovFnAggregation deprecated

func NewMovFnAggregation(bucketsPath string, script *Script, window int) *MovFnAggregation

NewMovFnAggregation creates and initializes a new MovFnAggregation.

Deprecated: The MovFnAggregation has been deprecated in 6.4.0. Use the more generate MovFnAggregation instead.

func (*MovFnAggregation) BucketsPath

func (a *MovFnAggregation) BucketsPath(bucketsPaths ...string) *MovFnAggregation

BucketsPath sets the paths to the buckets to use for this pipeline aggregator.

func (*MovFnAggregation) Format

func (a *MovFnAggregation) Format(format string) *MovFnAggregation

Format to use on the output of this aggregation.

func (*MovFnAggregation) GapInsertZeros

func (a *MovFnAggregation) GapInsertZeros() *MovFnAggregation

GapInsertZeros inserts zeros for gaps in the series.

func (*MovFnAggregation) GapPolicy

func (a *MovFnAggregation) GapPolicy(gapPolicy string) *MovFnAggregation

GapPolicy defines what should be done when a gap in the series is discovered. Valid values include "insert_zeros" or "skip". Default is "insert_zeros".

func (*MovFnAggregation) GapSkip

func (a *MovFnAggregation) GapSkip() *MovFnAggregation

GapSkip skips gaps in the series.

func (*MovFnAggregation) Meta

func (a *MovFnAggregation) Meta(metaData map[string]interface{}) *MovFnAggregation

Meta sets the meta data to be included in the aggregation response.

func (*MovFnAggregation) Script

func (a *MovFnAggregation) Script(script *Script) *MovFnAggregation

Script is the script to run.

func (*MovFnAggregation) Source

func (a *MovFnAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

func (*MovFnAggregation) Window

func (a *MovFnAggregation) Window(window int) *MovFnAggregation

Window sets the window size for this aggregation.

type MoveAllocationCommand

type MoveAllocationCommand struct {
	// contains filtered or unexported fields
}

MoveAllocationCommand moves a shard from a specific node to another node.

func NewMoveAllocationCommand

func NewMoveAllocationCommand(index string, shardId int, fromNode, toNode string) *MoveAllocationCommand

NewMoveAllocationCommand creates a new MoveAllocationCommand.

func (*MoveAllocationCommand) Name

func (cmd *MoveAllocationCommand) Name() string

Name of the command in a request to the Cluster Reroute API.

func (*MoveAllocationCommand) Source

func (cmd *MoveAllocationCommand) Source() (interface{}, error)

Source generates the (inner) JSON to be used when serializing the command.

type MultiGetItem

type MultiGetItem struct {
	// contains filtered or unexported fields
}

MultiGetItem is a single document to retrieve via the MgetService.

func NewMultiGetItem

func NewMultiGetItem() *MultiGetItem

NewMultiGetItem initializes a new, single item for a Multi GET request.

func (*MultiGetItem) FetchSource

func (item *MultiGetItem) FetchSource(fetchSourceContext *FetchSourceContext) *MultiGetItem

FetchSource allows to specify source filtering.

func (*MultiGetItem) Id

func (item *MultiGetItem) Id(id string) *MultiGetItem

Id specifies the identifier of the document.

func (*MultiGetItem) Index

func (item *MultiGetItem) Index(index string) *MultiGetItem

Index specifies the index name.

func (*MultiGetItem) Routing

func (item *MultiGetItem) Routing(routing string) *MultiGetItem

Routing is the specific routing value.

func (*MultiGetItem) Source

func (item *MultiGetItem) Source() (interface{}, error)

Source returns the serialized JSON to be sent to Elasticsearch as part of a MultiGet search.

func (*MultiGetItem) StoredFields

func (item *MultiGetItem) StoredFields(storedFields ...string) *MultiGetItem

StoredFields is a list of fields to return in the response.

func (*MultiGetItem) Type

func (item *MultiGetItem) Type(typ string) *MultiGetItem

Type specifies the type name.

func (*MultiGetItem) Version

func (item *MultiGetItem) Version(version int64) *MultiGetItem

Version can be MatchAny (-3), MatchAnyPre120 (0), NotFound (-1), or NotSet (-2). These are specified in org.elasticsearch.common.lucene.uid.Versions. The default in Elasticsearch is MatchAny (-3).

func (*MultiGetItem) VersionType

func (item *MultiGetItem) VersionType(versionType string) *MultiGetItem

VersionType can be "internal", "external", "external_gt", or "external_gte". See org.elasticsearch.index.VersionType in Elasticsearch source. It is "internal" by default.

type MultiMatchQuery

type MultiMatchQuery struct {
	// contains filtered or unexported fields
}

MultiMatchQuery builds on the MatchQuery to allow multi-field queries.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-multi-match-query.html

func NewMultiMatchQuery

func NewMultiMatchQuery(text interface{}, fields ...string) *MultiMatchQuery

MultiMatchQuery creates and initializes a new MultiMatchQuery.

func (*MultiMatchQuery) Analyzer

func (q *MultiMatchQuery) Analyzer(analyzer string) *MultiMatchQuery

Analyzer sets the analyzer to use explicitly. It defaults to use explicit mapping config for the field, or, if not set, the default search analyzer.

func (*MultiMatchQuery) Boost

func (q *MultiMatchQuery) Boost(boost float64) *MultiMatchQuery

Boost sets the boost for this query.

func (*MultiMatchQuery) CutoffFrequency

func (q *MultiMatchQuery) CutoffFrequency(cutoff float64) *MultiMatchQuery

CutoffFrequency sets a cutoff value in [0..1] (or absolute number >=1) representing the maximum threshold of a terms document frequency to be considered a low frequency term.

func (*MultiMatchQuery) Field

func (q *MultiMatchQuery) Field(field string) *MultiMatchQuery

Field adds a field to run the multi match against.

func (*MultiMatchQuery) FieldWithBoost

func (q *MultiMatchQuery) FieldWithBoost(field string, boost float64) *MultiMatchQuery

FieldWithBoost adds a field to run the multi match against with a specific boost.

func (*MultiMatchQuery) Fuzziness

func (q *MultiMatchQuery) Fuzziness(fuzziness string) *MultiMatchQuery

Fuzziness sets the fuzziness used when evaluated to a fuzzy query type. It defaults to "AUTO".

func (*MultiMatchQuery) FuzzyRewrite

func (q *MultiMatchQuery) FuzzyRewrite(fuzzyRewrite string) *MultiMatchQuery

func (*MultiMatchQuery) Lenient

func (q *MultiMatchQuery) Lenient(lenient bool) *MultiMatchQuery

Lenient indicates whether format based failures will be ignored.

func (*MultiMatchQuery) MaxExpansions

func (q *MultiMatchQuery) MaxExpansions(maxExpansions int) *MultiMatchQuery

MaxExpansions is the number of term expansions to use when using fuzzy or prefix type query. It defaults to unbounded so it's recommended to set it to a reasonable value for faster execution.

func (*MultiMatchQuery) MinimumShouldMatch

func (q *MultiMatchQuery) MinimumShouldMatch(minimumShouldMatch string) *MultiMatchQuery

MinimumShouldMatch represents the minimum number of optional should clauses to match.

func (*MultiMatchQuery) Operator

func (q *MultiMatchQuery) Operator(operator string) *MultiMatchQuery

Operator sets the operator to use when using boolean query. It can be either AND or OR (default).

func (*MultiMatchQuery) PrefixLength

func (q *MultiMatchQuery) PrefixLength(prefixLength int) *MultiMatchQuery

PrefixLength for the fuzzy process.

func (*MultiMatchQuery) QueryName

func (q *MultiMatchQuery) QueryName(queryName string) *MultiMatchQuery

QueryName sets the query name for the filter that can be used when searching for matched filters per hit.

func (*MultiMatchQuery) Rewrite

func (q *MultiMatchQuery) Rewrite(rewrite string) *MultiMatchQuery

func (*MultiMatchQuery) Slop

func (q *MultiMatchQuery) Slop(slop int) *MultiMatchQuery

Slop sets the phrase slop if evaluated to a phrase query type.

func (*MultiMatchQuery) Source

func (q *MultiMatchQuery) Source() (interface{}, error)

Source returns JSON for the query.

func (*MultiMatchQuery) TieBreaker

func (q *MultiMatchQuery) TieBreaker(tieBreaker float64) *MultiMatchQuery

TieBreaker for "best-match" disjunction queries (OR queries). The tie breaker capability allows documents that match more than one query clause (in this case on more than one field) to be scored better than documents that match only the best of the fields, without confusing this with the better case of two distinct matches in the multiple fields.

A tie-breaker value of 1.0 is interpreted as a signal to score queries as "most-match" queries where all matching query clauses are considered for scoring.

func (*MultiMatchQuery) Type

func (q *MultiMatchQuery) Type(typ string) *MultiMatchQuery

Type can be "best_fields", "boolean", "most_fields", "cross_fields", "phrase", "phrase_prefix" or "bool_prefix"

func (*MultiMatchQuery) ZeroTermsQuery

func (q *MultiMatchQuery) ZeroTermsQuery(zeroTermsQuery string) *MultiMatchQuery

ZeroTermsQuery can be "all" or "none".

type MultiSearchResult

type MultiSearchResult struct {
	TookInMillis int64           `json:"took,omitempty"` // search time in milliseconds
	Responses    []*SearchResult `json:"responses,omitempty"`
}

MultiSearchResult is the outcome of running a multi-search operation.

type MultiSearchService

type MultiSearchService struct {
	// contains filtered or unexported fields
}

MultiSearch executes one or more searches in one roundtrip.

func NewMultiSearchService

func NewMultiSearchService(client *Client) *MultiSearchService

func (*MultiSearchService) Add

func (s *MultiSearchService) Add(requests ...*SearchRequest) *MultiSearchService

func (*MultiSearchService) Do

func (*MultiSearchService) ErrorTrace added in v7.0.7

func (s *MultiSearchService) ErrorTrace(errorTrace bool) *MultiSearchService

ErrorTrace specifies whether to include the stack trace of returned errors.

func (*MultiSearchService) FilterPath added in v7.0.7

func (s *MultiSearchService) FilterPath(filterPath ...string) *MultiSearchService

FilterPath specifies a list of filters used to reduce the response.

func (*MultiSearchService) Header added in v7.0.7

func (s *MultiSearchService) Header(name string, value string) *MultiSearchService

Header adds a header to the request.

func (*MultiSearchService) Headers added in v7.0.7

func (s *MultiSearchService) Headers(headers http.Header) *MultiSearchService

Headers specifies the headers of the request.

func (*MultiSearchService) Human added in v7.0.7

func (s *MultiSearchService) Human(human bool) *MultiSearchService

Human specifies whether human readable values should be returned in the JSON response, e.g. "7.5mb".

func (*MultiSearchService) Index

func (s *MultiSearchService) Index(indices ...string) *MultiSearchService

func (*MultiSearchService) MaxConcurrentSearches

func (s *MultiSearchService) MaxConcurrentSearches(max int) *MultiSearchService

func (*MultiSearchService) PreFilterShardSize

func (s *MultiSearchService) PreFilterShardSize(size int) *MultiSearchService

func (*MultiSearchService) Pretty

func (s *MultiSearchService) Pretty(pretty bool) *MultiSearchService

Pretty tells Elasticsearch whether to return a formatted JSON response.

type MultiTerm added in v7.0.25

type MultiTerm struct {
	Field   string
	Missing interface{}
}

MultiTerm specifies a single term field for a multi terms aggregation.

func (*MultiTerm) Source added in v7.0.25

func (term *MultiTerm) Source() (interface{}, error)

Source returns serializable JSON of the MultiTerm.

type MultiTermsAggregation added in v7.0.25

type MultiTermsAggregation struct {
	// contains filtered or unexported fields
}

MultiTermsAggregation is a multi-bucket value source based aggregation where buckets are dynamically built - one per unique set of values. The multi terms aggregation is very similar to the terms aggregation, however in most cases it will be slower than the terms aggregation and will consume more memory. Therefore, if the same set of fields is constantly used, it would be more efficient to index a combined key for this fields as a separate field and use the terms aggregation on this field.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/search-aggregations-bucket-multi-terms-aggregation.html

func NewMultiTermsAggregation added in v7.0.25

func NewMultiTermsAggregation() *MultiTermsAggregation

NewMultiTermsAggregation initializes a new MultiTermsAggregation.

func (*MultiTermsAggregation) CollectionMode added in v7.0.25

func (a *MultiTermsAggregation) CollectionMode(collectionMode string) *MultiTermsAggregation

Collection mode can be depth_first or breadth_first as of 1.4.0.

func (*MultiTermsAggregation) Meta added in v7.0.25

func (a *MultiTermsAggregation) Meta(metaData map[string]interface{}) *MultiTermsAggregation

Meta sets the meta data to be included in the aggregation response.

func (*MultiTermsAggregation) MinDocCount added in v7.0.25

func (a *MultiTermsAggregation) MinDocCount(minDocCount int) *MultiTermsAggregation

func (*MultiTermsAggregation) MultiTerms added in v7.0.25

func (a *MultiTermsAggregation) MultiTerms(multiTerms ...MultiTerm) *MultiTermsAggregation

MultiTerms adds a slice of MultiTerm instances to return in the aggregation.

Notice that it appends to existing terms, so you can use MultiTerms more than once, and mix with Terms method.

func (*MultiTermsAggregation) Order added in v7.0.25

func (*MultiTermsAggregation) OrderByAggregation added in v7.0.25

func (a *MultiTermsAggregation) OrderByAggregation(aggName string, asc bool) *MultiTermsAggregation

OrderByAggregation creates a bucket ordering strategy which sorts buckets based on a single-valued calc get.

func (*MultiTermsAggregation) OrderByAggregationAndMetric added in v7.0.25

func (a *MultiTermsAggregation) OrderByAggregationAndMetric(aggName, metric string, asc bool) *MultiTermsAggregation

OrderByAggregationAndMetric creates a bucket ordering strategy which sorts buckets based on a multi-valued calc get.

func (*MultiTermsAggregation) OrderByCount added in v7.0.25

func (a *MultiTermsAggregation) OrderByCount(asc bool) *MultiTermsAggregation

func (*MultiTermsAggregation) OrderByCountAsc added in v7.0.25

func (a *MultiTermsAggregation) OrderByCountAsc() *MultiTermsAggregation

func (*MultiTermsAggregation) OrderByCountDesc added in v7.0.25

func (a *MultiTermsAggregation) OrderByCountDesc() *MultiTermsAggregation

func (*MultiTermsAggregation) OrderByKey added in v7.0.25

func (a *MultiTermsAggregation) OrderByKey(asc bool) *MultiTermsAggregation

func (*MultiTermsAggregation) OrderByKeyAsc added in v7.0.25

func (a *MultiTermsAggregation) OrderByKeyAsc() *MultiTermsAggregation

func (*MultiTermsAggregation) OrderByKeyDesc added in v7.0.25

func (a *MultiTermsAggregation) OrderByKeyDesc() *MultiTermsAggregation

func (*MultiTermsAggregation) ShardMinDocCount added in v7.0.25

func (a *MultiTermsAggregation) ShardMinDocCount(shardMinDocCount int) *MultiTermsAggregation

func (*MultiTermsAggregation) ShardSize added in v7.0.25

func (a *MultiTermsAggregation) ShardSize(shardSize int) *MultiTermsAggregation

func (*MultiTermsAggregation) ShowTermDocCountError added in v7.0.25

func (a *MultiTermsAggregation) ShowTermDocCountError(showTermDocCountError bool) *MultiTermsAggregation

func (*MultiTermsAggregation) Size added in v7.0.25

func (*MultiTermsAggregation) Source added in v7.0.25

func (a *MultiTermsAggregation) Source() (interface{}, error)

func (*MultiTermsAggregation) SubAggregation added in v7.0.25

func (a *MultiTermsAggregation) SubAggregation(name string, subAggregation Aggregation) *MultiTermsAggregation

func (*MultiTermsAggregation) Terms added in v7.0.25

func (a *MultiTermsAggregation) Terms(fields ...string) *MultiTermsAggregation

Terms adds a slice of field names to return in the aggregation.

Notice that it appends to existing terms, so you can use Terms more than once, and mix with MultiTerms method.

type MultiTermsOrder added in v7.0.25

type MultiTermsOrder struct {
	Field     string
	Ascending bool
}

MultiTermsOrder specifies a single order field for a multi terms aggregation.

func (*MultiTermsOrder) Source added in v7.0.25

func (order *MultiTermsOrder) Source() (interface{}, error)

Source returns serializable JSON of the MultiTermsOrder.

type MultiTermvectorItem

type MultiTermvectorItem struct {
	// contains filtered or unexported fields
}

MultiTermvectorItem is a single document to retrieve via MultiTermvectorService.

func NewMultiTermvectorItem

func NewMultiTermvectorItem() *MultiTermvectorItem

func (*MultiTermvectorItem) Doc

func (s *MultiTermvectorItem) Doc(doc interface{}) *MultiTermvectorItem

Doc is the document to analyze.

func (*MultiTermvectorItem) FieldStatistics