elastic

package module
v7.0.0-...-3a029cd Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: MIT Imports: 14 Imported by: 0

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/SSK-TBD/elastic/v7 (source doc) Use Go modules.
6.x                   6.0             github.com/SSK-TBD/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/SSK-TBD/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

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorReason

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 IsContextErr

func IsContextErr(err error) bool

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

Types

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

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

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

UnmarshalJSON decodes JSON data and initializes an AggregationBucketMultiKeyItem structure.

type AggregationBucketMultiKeyItems

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

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

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

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 AggregationTopMetricsItem

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

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.

func (Aggregations) AutoDateHistogram

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

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

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

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 AllocationId

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

type AutoDateHistogramAggregation

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

func NewAutoDateHistogramAggregation() *AutoDateHistogramAggregation

NewAutoDateHistogramAggregation creates a new AutoDateHistogramAggregation.

func (*AutoDateHistogramAggregation) Buckets

Buckets buckets num by which the aggregation gets processed.

func (*AutoDateHistogramAggregation) Field

Field on which the aggregation is processed.

func (*AutoDateHistogramAggregation) Format

Format sets the format to use for dates.

func (*AutoDateHistogramAggregation) Meta

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

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

func (*AutoDateHistogramAggregation) MinDocCount

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

func (*AutoDateHistogramAggregation) MinimumInterval

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

func (*AutoDateHistogramAggregation) Missing

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

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

func (*AutoDateHistogramAggregation) Script

Script on which th

func (*AutoDateHistogramAggregation) Source

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

Source source for AutoDateHistogramAggregation

func (*AutoDateHistogramAggregation) SubAggregation

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

SubAggregation sub aggregation

func (*AutoDateHistogramAggregation) TimeZone

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

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

BoundingBox bounding box

type BroadcastResponse

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

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

func NewClosePointInTimeService() *ClosePointInTimeService

NewClosePointInTimeService creates a new ClosePointInTimeService.

func (*ClosePointInTimeService) BodyJson

func (s *ClosePointInTimeService) BodyJson(body interface{}) *ClosePointInTimeService

BodyJson is the document as a serializable JSON interface.

func (*ClosePointInTimeService) BodyString

BodyString is the document encoded as a string.

func (*ClosePointInTimeService) ErrorTrace

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

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

func (*ClosePointInTimeService) FilterPath

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

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

func (*ClosePointInTimeService) Header

Header adds a header to the request.

func (*ClosePointInTimeService) Headers

Headers specifies the headers of the request.

func (*ClosePointInTimeService) Human

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

func (*ClosePointInTimeService) ID

ID to close.

func (*ClosePointInTimeService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*ClosePointInTimeService) Validate

func (s *ClosePointInTimeService) Validate() error

Validate checks if the operation is valid.

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

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

func NewCombinedFieldsQuery(text interface{}, fields ...string) *CombinedFieldsQuery

NewCombinedFieldsQuery creates and initializes a new CombinedFieldsQuery.

func (*CombinedFieldsQuery) AutoGenerateSynonymsPhraseQuery

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

Field adds a field to run the multi match against.

func (*CombinedFieldsQuery) FieldWithBoost

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

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

MinimumShouldMatch represents the minimum number of optional should clauses to match.

func (*CombinedFieldsQuery) Operator

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

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

Source returns JSON for the query.

func (*CombinedFieldsQuery) ZeroTermsQuery

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

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

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

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

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 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() *DeleteScriptService

NewDeleteScriptService creates a new DeleteScriptService.

func (*DeleteScriptService) ErrorTrace

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

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

func (*DeleteScriptService) FilterPath

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

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

func (*DeleteScriptService) Header

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

Header adds a header to the request.

func (*DeleteScriptService) Headers

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

Headers specifies the headers of the request.

func (*DeleteScriptService) Human

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.

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 DistanceFeatureQuery

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

func NewDistanceFeatureQuery(field string, origin interface{}, pivot string) *DistanceFeatureQuery

NewDistanceFeatureQuery creates and initializes a new script_score query.

func (*DistanceFeatureQuery) Boost

Boost sets the boost for this query.

func (*DistanceFeatureQuery) Field

Field to be used in the DistanceFeatureQuery.

func (*DistanceFeatureQuery) Origin

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

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

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

QueryName sets the query name for the filter.

func (*DistanceFeatureQuery) Source

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

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

func (a *FiltersAggregation) OtherBucket(otherBucket bool) *FiltersAggregation

OtherBucket indicates whether to include a bucket for documents not matching any filter.

func (*FiltersAggregation) OtherBucketKey

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

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

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

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

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

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

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

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

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

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

func NewGeoTileGridAggregation

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

Bounds The bounding box to filter the points in the bucket. Optional.

func (*GeoTileGridAggregation) Field

Field The name of the field indexed with GeoPoints. Mandatory.

func (*GeoTileGridAggregation) Meta

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

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

func (*GeoTileGridAggregation) Precision

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

func (a *GeoTileGridAggregation) ShardSize(shardSize int) *GeoTileGridAggregation

ShardSize The maximum number of buckets to return from each shard. Optional.

func (*GeoTileGridAggregation) Size

Size The maximum number of buckets to return in the result structure. Optional.

func (*GeoTileGridAggregation) Source

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

Source returns the a JSON-serializable interface.

func (*GeoTileGridAggregation) SubAggregation

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

SubAggregation Adds a sub-aggregation to this aggregation.

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() *GetScriptService

NewGetScriptService creates a new GetScriptService.

func (*GetScriptService) ErrorTrace

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

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

func (*GetScriptService) FilterPath

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

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

func (*GetScriptService) Header

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

Header adds a header to the request.

func (*GetScriptService) Headers

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

Headers specifies the headers of the request.

func (*GetScriptService) Human

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.

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

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

type IndexBoost struct {
	Index string
	Boost float64
}

IndexBoost specifies an index by some boost factor.

func (IndexBoost) Source

func (b IndexBoost) Source() (interface{}, error)

Source generates a JSON-serializable output for IndexBoost.

type IndexBoosts

type IndexBoosts []IndexBoost

IndexBoosts is a slice of IndexBoost entities.

func (IndexBoosts) Source

func (b IndexBoosts) Source() (interface{}, error)

Source generates a JSON-serializable output for IndexBoosts.

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

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

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

func NewIntervalQuery(field string, rule IntervalQueryRule) *IntervalQuery

NewIntervalQuery creates and initializes a new IntervalQuery.

func (*IntervalQuery) Source

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

Source returns JSON for the function score query.

type IntervalQueryFilter

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

func NewIntervalQueryFilter() *IntervalQueryFilter

NewIntervalQueryFilter initializes and creates a new IntervalQueryFilter.

func (*IntervalQueryFilter) After

After specifies the query to be used to return intervals that follow an interval from the filter rule.

func (*IntervalQueryFilter) Before

Before specifies the query to be used to return intervals that occur before an interval from the filter rule.

func (*IntervalQueryFilter) ContainedBy

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

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

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

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

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

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

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

func (r *IntervalQueryFilter) Source() (interface{}, error)

Source returns JSON for the function score query.

type IntervalQueryRule

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

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

func NewIntervalQueryRuleAllOf(intervals ...IntervalQueryRule) *IntervalQueryRuleAllOf

NewIntervalQueryRuleAllOf initializes and returns a new instance of IntervalQueryRuleAllOf.

func (*IntervalQueryRuleAllOf) Filter

Filter adds an additional interval filter.

func (*IntervalQueryRuleAllOf) MaxGaps

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

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

func (r *IntervalQueryRuleAllOf) Source() (interface{}, error)

Source returns JSON for the function score query.

type IntervalQueryRuleAnyOf

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

func NewIntervalQueryRuleAnyOf(intervals ...IntervalQueryRule) *IntervalQueryRuleAnyOf

NewIntervalQueryRuleAnyOf initializes and returns a new instance of IntervalQueryRuleAnyOf.

func (*IntervalQueryRuleAnyOf) Filter

Filter adds an additional interval filter.

func (*IntervalQueryRuleAnyOf) Source

func (r *IntervalQueryRuleAnyOf) Source() (interface{}, error)

Source returns JSON for the function score query.

type IntervalQueryRuleFuzzy

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

func NewIntervalQueryRuleFuzzy(term string) *IntervalQueryRuleFuzzy

NewIntervalQueryRuleFuzzy initializes and returns a new instance of IntervalQueryRuleFuzzy.

func (*IntervalQueryRuleFuzzy) Analyzer

func (r *IntervalQueryRuleFuzzy) Analyzer(analyzer string) *IntervalQueryRuleFuzzy

Analyzer specifies the analyzer used to analyze terms in the query.

func (*IntervalQueryRuleFuzzy) Fuzziness

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

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

func (r *IntervalQueryRuleFuzzy) Source() (interface{}, error)

Source returns JSON for the function score query.

func (*IntervalQueryRuleFuzzy) Transpositions

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

func (r *IntervalQueryRuleFuzzy) UseField(useField string) *IntervalQueryRuleFuzzy

UseField, if specified, matches the intervals from this field rather than the top-level field.

type IntervalQueryRuleMatch

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

func NewIntervalQueryRuleMatch(query string) *IntervalQueryRuleMatch

NewIntervalQueryRuleMatch initializes and returns a new instance of IntervalQueryRuleMatch.

func (*IntervalQueryRuleMatch) Analyzer

func (r *IntervalQueryRuleMatch) Analyzer(analyzer string) *IntervalQueryRuleMatch

Analyzer specifies the analyzer used to analyze terms in the query.

func (*IntervalQueryRuleMatch) Filter

Filter adds an additional interval filter.

func (*IntervalQueryRuleMatch) MaxGaps

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

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

func (r *IntervalQueryRuleMatch) Source() (interface{}, error)

Source returns JSON for the function score query.

func (*IntervalQueryRuleMatch) UseField

func (r *IntervalQueryRuleMatch) UseField(useField string) *IntervalQueryRuleMatch

UseField, if specified, matches the intervals from this field rather than the top-level field.

type IntervalQueryRulePrefix

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

func NewIntervalQueryRulePrefix(prefix string) *IntervalQueryRulePrefix

NewIntervalQueryRulePrefix initializes and returns a new instance of IntervalQueryRulePrefix.

func (*IntervalQueryRulePrefix) Analyzer

Analyzer specifies the analyzer used to analyze terms in the query.

func (*IntervalQueryRulePrefix) Source

func (r *IntervalQueryRulePrefix) Source() (interface{}, error)

Source returns JSON for the function score query.

func (*IntervalQueryRulePrefix) UseField

UseField, if specified, matches the intervals from this field rather than the top-level field.

type IntervalQueryRuleWildcard

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

func NewIntervalQueryRuleWildcard(pattern string) *IntervalQueryRuleWildcard

NewIntervalQueryRuleWildcard initializes and returns a new instance of IntervalQueryRuleWildcard.

func (*IntervalQueryRuleWildcard) Analyzer

Analyzer specifies the analyzer used to analyze terms in the query.

func (*IntervalQueryRuleWildcard) Source

func (r *IntervalQueryRuleWildcard) Source() (interface{}, error)

Source returns JSON for the function score query.

func (*IntervalQueryRuleWildcard) UseField

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

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

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

func NewMatchBoolPrefixQuery(name string, queryText interface{}) *MatchBoolPrefixQuery

NewMatchBoolPrefixQuery creates and initializes a new MatchBoolPrefixQuery.

func (*MatchBoolPrefixQuery) Analyzer

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

Boost sets the boost to apply to this query.

func (*MatchBoolPrefixQuery) Fuzziness

func (q *MatchBoolPrefixQuery) Fuzziness(fuzziness string) *MatchBoolPrefixQuery

Fuzziness sets the edit distance for fuzzy queries. Default is "AUTO".

func (*MatchBoolPrefixQuery) FuzzyRewrite

func (q *MatchBoolPrefixQuery) FuzzyRewrite(fuzzyRewrite string) *MatchBoolPrefixQuery

FuzzyRewrite sets the fuzzy_rewrite parameter controlling how the fuzzy query will get rewritten.

func (*MatchBoolPrefixQuery) FuzzyTranspositions

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

func (q *MatchBoolPrefixQuery) MaxExpansions(n int) *MatchBoolPrefixQuery

MaxExpansions sets the number of term expansions to use.

func (*MatchBoolPrefixQuery) MinimumShouldMatch

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

MinimumShouldMatch sets the optional minimumShouldMatch value to apply to the query.

func (*MatchBoolPrefixQuery) Operator

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

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

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

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

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

func NewMedianAbsoluteDeviationAggregation() *MedianAbsoluteDeviationAggregation

func (*MedianAbsoluteDeviationAggregation) Compression

func (*MedianAbsoluteDeviationAggregation) Field

func (*MedianAbsoluteDeviationAggregation) Format

func (*MedianAbsoluteDeviationAggregation) Meta

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

func (*MedianAbsoluteDeviationAggregation) Missing

func (*MedianAbsoluteDeviationAggregation) Script

func (*MedianAbsoluteDeviationAggregation) Source

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

func (*MedianAbsoluteDeviationAggregation) SubAggregation

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

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

MultiSearch executes one or more searches in one roundtrip.

func (*MultiSearchService) Add

func (s *MultiSearchService) Add(requests ...*SearchRequest) *MultiSearchService

func (*MultiSearchService) ErrorTrace

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

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

func (*MultiSearchService) FilterPath

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

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

func (*MultiSearchService) Header

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

Header adds a header to the request.

func (*MultiSearchService) Headers

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

Headers specifies the headers of the request.

func (*MultiSearchService) Human

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

type MultiTerm struct {
	Field   string
	Missing interface{}
}

MultiTerm specifies a single term field for a multi terms aggregation.

func (*MultiTerm) Source

func (term *MultiTerm) Source() (interface{}, error)

Source returns serializable JSON of the MultiTerm.

type MultiTermsAggregation

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

func NewMultiTermsAggregation() *MultiTermsAggregation

NewMultiTermsAggregation initializes a new MultiTermsAggregation.

func (*MultiTermsAggregation) CollectionMode

func (a *MultiTermsAggregation) CollectionMode(collectionMode string) *MultiTermsAggregation

Collection mode can be depth_first or breadth_first as of 1.4.0.

func (*MultiTermsAggregation) Meta

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

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

func (*MultiTermsAggregation) MinDocCount

func (a *MultiTermsAggregation) MinDocCount(minDocCount int) *MultiTermsAggregation

func (*MultiTermsAggregation) MultiTerms

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

func (*MultiTermsAggregation) OrderByAggregation

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

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

func (a *MultiTermsAggregation) OrderByCount(asc bool) *MultiTermsAggregation

func (*MultiTermsAggregation) OrderByCountAsc

func (a *MultiTermsAggregation) OrderByCountAsc() *MultiTermsAggregation

func (*MultiTermsAggregation) OrderByCountDesc

func (a *MultiTermsAggregation) OrderByCountDesc() *MultiTermsAggregation

func (*MultiTermsAggregation) OrderByKey

func (a *MultiTermsAggregation) OrderByKey(asc bool) *MultiTermsAggregation

func (*MultiTermsAggregation) OrderByKeyAsc

func (a *MultiTermsAggregation) OrderByKeyAsc() *MultiTermsAggregation

func (*MultiTermsAggregation) OrderByKeyDesc

func (a *MultiTermsAggregation) OrderByKeyDesc() *MultiTermsAggregation

func (*MultiTermsAggregation) ShardMinDocCount

func (a *MultiTermsAggregation) ShardMinDocCount(shardMinDocCount int) *MultiTermsAggregation

func (*MultiTermsAggregation) ShardSize

func (a *MultiTermsAggregation) ShardSize(shardSize int) *MultiTermsAggregation

func (*MultiTermsAggregation) ShowTermDocCountError

func (a *MultiTermsAggregation) ShowTermDocCountError(showTermDocCountError bool) *MultiTermsAggregation

func (*MultiTermsAggregation) Size

func (*MultiTermsAggregation) Source

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

func (*MultiTermsAggregation) SubAggregation

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

func (*MultiTermsAggregation) Terms

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

type MultiTermsOrder struct {
	Field     string
	Ascending bool
}

MultiTermsOrder specifies a single order field for a multi terms aggregation.

func (*MultiTermsOrder) Source

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

func (s *MultiTermvectorItem) FieldStatistics(fieldStatistics bool) *MultiTermvectorItem

FieldStatistics specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.

func (*MultiTermvectorItem) Fields

func (s *MultiTermvectorItem) Fields(fields ...string) *MultiTermvectorItem

Fields a list of fields to return.

func (*MultiTermvectorItem) Id

func (*MultiTermvectorItem) Index

func (*MultiTermvectorItem) Offsets

func (s *MultiTermvectorItem) Offsets(offsets bool) *MultiTermvectorItem

Offsets specifies if term offsets should be returned.

func (*MultiTermvectorItem) Parent

func (s *MultiTermvectorItem) Parent(parent string) *MultiTermvectorItem

Parent id of documents.

func (*MultiTermvectorItem) Payloads

func (s *MultiTermvectorItem) Payloads(payloads bool) *MultiTermvectorItem

Payloads specifies if term payloads should be returned.

func (*MultiTermvectorItem) PerFieldAnalyzer

func (s *MultiTermvectorItem) PerFieldAnalyzer(perFieldAnalyzer map[string]string) *MultiTermvectorItem

PerFieldAnalyzer allows to specify a different analyzer than the one at the field.

func (*MultiTermvectorItem) Positions

func (s *MultiTermvectorItem) Positions(positions bool) *MultiTermvectorItem

Positions specifies if term positions should be returned.

func (*MultiTermvectorItem) Preference

func (s *MultiTermvectorItem) Preference(preference string) *MultiTermvectorItem

Preference specify the node or shard the operation should be performed on (default: random).

func (*MultiTermvectorItem) Realtime

func (s *MultiTermvectorItem) Realtime(realtime bool) *MultiTermvectorItem

Realtime specifies if request is real-time as opposed to near-real-time (default: true).

func (*MultiTermvectorItem) Routing

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

Routing is a specific routing value.

func (*MultiTermvectorItem) Source

func (s *MultiTermvectorItem) Source() interface{}

Source returns the serialized JSON to be sent to Elasticsearch as part of a MultiTermvector.

func (*MultiTermvectorItem) TermStatistics

func (s *MultiTermvectorItem) TermStatistics(termStatistics bool) *MultiTermvectorItem

TermStatistics specifies if total term frequency and document frequency should be returned.

func (*MultiTermvectorItem) Type

type MultiTermvectorResponse

type MultiTermvectorResponse struct {
	Docs []*TermvectorsResponse `json:"docs"`
}

MultiTermvectorResponse is the response of MultiTermvectorService.Do.

type MultiTermvectorService

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

MultiTermvectorService returns information and statistics on terms in the fields of a particular document. The document could be stored in the index or artificially provided by the user.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-multi-termvectors.html for documentation.

func NewMultiTermvectorService

func NewMultiTermvectorService() *MultiTermvectorService

NewMultiTermvectorService creates a new MultiTermvectorService.

func (*MultiTermvectorService) Add

Add adds documents to MultiTermvectors service.

func (*MultiTermvectorService) BodyJson

func (s *MultiTermvectorService) BodyJson(body interface{}) *MultiTermvectorService

BodyJson is documented as: Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation..

func (*MultiTermvectorService) BodyString

BodyString is documented as: Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation..

func (*MultiTermvectorService) ErrorTrace

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

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

func (*MultiTermvectorService) FieldStatistics

func (s *MultiTermvectorService) FieldStatistics(fieldStatistics bool) *MultiTermvectorService

FieldStatistics specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".

func (*MultiTermvectorService) Fields

Fields is a comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body "params" or "docs".

func (*MultiTermvectorService) FilterPath

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

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

func (*MultiTermvectorService) Header

Header adds a header to the request.

func (*MultiTermvectorService) Headers

Headers specifies the headers of the request.

func (*MultiTermvectorService) Human

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

func (*MultiTermvectorService) Ids

Ids is a comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body.

func (*MultiTermvectorService) Index

Index in which the document resides.

func (*MultiTermvectorService) Offsets

func (s *MultiTermvectorService) Offsets(offsets bool) *MultiTermvectorService

Offsets specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".

func (*MultiTermvectorService) Parent

Parent id of documents. Applies to all returned documents unless otherwise specified in body "params" or "docs".

func (*MultiTermvectorService) Payloads

func (s *MultiTermvectorService) Payloads(payloads bool) *MultiTermvectorService

Payloads specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".

func (*MultiTermvectorService) Positions

func (s *MultiTermvectorService) Positions(positions bool) *MultiTermvectorService

Positions specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".

func (*MultiTermvectorService) Preference

func (s *MultiTermvectorService) Preference(preference string) *MultiTermvectorService

Preference specifies the node or shard the operation should be performed on (default: random). Applies to all returned documents unless otherwise specified in body "params" or "docs".

func (*MultiTermvectorService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*MultiTermvectorService) Realtime

func (s *MultiTermvectorService) Realtime(realtime bool) *MultiTermvectorService

Realtime specifies if requests are real-time as opposed to near-real-time (default: true).

func (*MultiTermvectorService) Routing

Routing specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs".

func (*MultiTermvectorService) Source

func (s *MultiTermvectorService) Source() interface{}

func (*MultiTermvectorService) TermStatistics

func (s *MultiTermvectorService) TermStatistics(termStatistics bool) *MultiTermvectorService

TermStatistics specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".

func (*MultiTermvectorService) Type

Type of the document.

func (*MultiTermvectorService) Validate

func (s *MultiTermvectorService) Validate() error

Validate checks if the operation is valid.

func (*MultiTermvectorService) Version

func (s *MultiTermvectorService) Version(version interface{}) *MultiTermvectorService

Version is explicit version number for concurrency control.

func (*MultiTermvectorService) VersionType

func (s *MultiTermvectorService) VersionType(versionType string) *MultiTermvectorService

VersionType is specific version type.

type MultiValuesSourceFieldConfig

type MultiValuesSourceFieldConfig struct {
	FieldName string
	Missing   interface{}
	Script    *Script
	TimeZone  string
}

MultiValuesSourceFieldConfig represents a field configuration used e.g. in WeightedAvgAggregation.

func (*MultiValuesSourceFieldConfig) Source

func (f *MultiValuesSourceFieldConfig) Source() (interface{}, error)

type MutualInformationSignificanceHeuristic

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

MutualInformationSignificanceHeuristic implements Mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1.

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

func NewMutualInformationSignificanceHeuristic

func NewMutualInformationSignificanceHeuristic() *MutualInformationSignificanceHeuristic

NewMutualInformationSignificanceHeuristic initializes a new instance of MutualInformationSignificanceHeuristic.

func (*MutualInformationSignificanceHeuristic) BackgroundIsSuperset

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

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

func (*MutualInformationSignificanceHeuristic) IncludeNegatives

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

func (*MutualInformationSignificanceHeuristic) Name

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

func (*MutualInformationSignificanceHeuristic) Source

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

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

type NestedAggregation

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

NestedAggregation is a special single bucket aggregation that enables aggregating nested documents. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-nested-aggregation.html

func NewNestedAggregation

func NewNestedAggregation() *NestedAggregation

func (*NestedAggregation) Meta

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

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

func (*NestedAggregation) Path

func (*NestedAggregation) Source

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

func (*NestedAggregation) SubAggregation

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

type NestedHit

type NestedHit struct {
	Field  string     `json:"field"`
	Offset int        `json:"offset,omitempty"`
	Child  *NestedHit `json:"_nested,omitempty"`
}

NestedHit is a nested innerhit

type NestedQuery

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

NestedQuery allows to query nested objects / docs. The query is executed against the nested objects / docs as if they were indexed as separate docs (they are, internally) and resulting in the root parent doc (or parent nested mapping).

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-nested-query.html

func NewNestedQuery

func NewNestedQuery(path string, query Query) *NestedQuery

NewNestedQuery creates and initializes a new NestedQuery.

func (*NestedQuery) Boost

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

Boost sets the boost for this query.

func (*NestedQuery) IgnoreUnmapped

func (q *NestedQuery) IgnoreUnmapped(value bool) *NestedQuery

IgnoreUnmapped sets the ignore_unmapped option for the filter that ignores unmapped nested fields

func (*NestedQuery) InnerHit

func (q *NestedQuery) InnerHit(innerHit *InnerHit) *NestedQuery

InnerHit sets the inner hit definition in the scope of this nested query and reusing the defined path and query.

func (*NestedQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit

func (*NestedQuery) ScoreMode

func (q *NestedQuery) ScoreMode(scoreMode string) *NestedQuery

ScoreMode specifies the score mode.

func (*NestedQuery) Source

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

Source returns JSON for the query.

type NestedSort

type NestedSort struct {
	Sorter
	// contains filtered or unexported fields
}

NestedSort is used for fields that are inside a nested object. It takes a "path" argument and an optional nested filter that the nested objects should match with in order to be taken into account for sorting.

NestedSort is available from 6.1 and replaces nestedFilter and nestedPath in the other sorters.

func NewNestedSort

func NewNestedSort(path string) *NestedSort

NewNestedSort creates a new NestedSort.

func (*NestedSort) Filter

func (s *NestedSort) Filter(filter Query) *NestedSort

Filter sets the filter.

func (*NestedSort) NestedSort

func (s *NestedSort) NestedSort(nestedSort *NestedSort) *NestedSort

NestedSort embeds another level of nested sorting.

func (*NestedSort) Source

func (s *NestedSort) Source() (interface{}, error)

Source returns the JSON-serializable data.

type NumberDecoder

type NumberDecoder struct{}

NumberDecoder uses json.NewDecoder, with UseNumber() enabled, from the Go standard library to decode JSON data.

func (*NumberDecoder) Decode

func (u *NumberDecoder) Decode(data []byte, v interface{}) error

Decode decodes with json.Unmarshal from the Go standard library.

type OpenPointInTimeService

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

OpenPointInTimeService opens a point in time that can be used in subsequent searches.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.x/point-in-time-api.html for details.

func NewOpenPointInTimeService

func NewOpenPointInTimeService() *OpenPointInTimeService

NewOpenPointInTimeService creates a new OpenPointInTimeService.

func (*OpenPointInTimeService) BodyJson

func (s *OpenPointInTimeService) BodyJson(body interface{}) *OpenPointInTimeService

BodyJson is the document as a serializable JSON interface.

func (*OpenPointInTimeService) BodyString

BodyString is the document encoded as a string.

func (*OpenPointInTimeService) ErrorTrace

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

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

func (*OpenPointInTimeService) ExpandWildcards

func (s *OpenPointInTimeService) ExpandWildcards(expandWildcards string) *OpenPointInTimeService

ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.

func (*OpenPointInTimeService) FilterPath

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

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

func (*OpenPointInTimeService) Header

Header adds a header to the request.

func (*OpenPointInTimeService) Headers

Headers specifies the headers of the request.

func (*OpenPointInTimeService) Human

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

func (*OpenPointInTimeService) IgnoreUnavailable

func (s *OpenPointInTimeService) IgnoreUnavailable(ignoreUnavailable bool) *OpenPointInTimeService

IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).

func (*OpenPointInTimeService) Index

Index is the name of the index (or indices).

func (*OpenPointInTimeService) KeepAlive

func (s *OpenPointInTimeService) KeepAlive(keepAlive string) *OpenPointInTimeService

KeepAlive indicates the specific time to live for the point in time.

func (*OpenPointInTimeService) Preference

func (s *OpenPointInTimeService) Preference(preference string) *OpenPointInTimeService

Preference specifies the node or shard the operation should be performed on.

func (*OpenPointInTimeService) Pretty

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*OpenPointInTimeService) Routing

Routing is a specific routing value.

func (*OpenPointInTimeService) Validate

func (s *OpenPointInTimeService) Validate() error

Validate checks if the operation is valid.

type ParentIdQuery

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

ParentIdQuery can be used to find child documents which belong to a particular parent. Given the following mapping definition.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-parent-id-query.html

func NewParentIdQuery

func NewParentIdQuery(typ, id string) *ParentIdQuery

NewParentIdQuery creates and initializes a new parent_id query.

func (*ParentIdQuery) Boost

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

Boost sets the boost for this query.

func (*ParentIdQuery) Id

func (q *ParentIdQuery) Id(id string) *ParentIdQuery

Id sets the id.

func (*ParentIdQuery) IgnoreUnmapped

func (q *ParentIdQuery) IgnoreUnmapped(ignore bool) *ParentIdQuery

IgnoreUnmapped specifies whether unmapped types should be ignored. If set to false, the query failes when an unmapped type is found.

func (*ParentIdQuery) InnerHit

func (q *ParentIdQuery) InnerHit(innerHit *InnerHit) *ParentIdQuery

InnerHit sets the inner hit definition in the scope of this query and reusing the defined type and query.

func (*ParentIdQuery) QueryName

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

QueryName specifies the query name for the filter that can be used when searching for matched filters per hit.

func (*ParentIdQuery) Source

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

Source returns JSON for the parent_id query.

func (*ParentIdQuery) Type

func (q *ParentIdQuery) Type(typ string) *ParentIdQuery

Type sets the parent type.

type PercentageScoreSignificanceHeuristic

type PercentageScoreSignificanceHeuristic struct{}

PercentageScoreSignificanceHeuristic implements the algorithm described in https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-significantterms-aggregation.html#_percentage.

func NewPercentageScoreSignificanceHeuristic

func NewPercentageScoreSignificanceHeuristic() *PercentageScoreSignificanceHeuristic

NewPercentageScoreSignificanceHeuristic initializes a new instance of PercentageScoreSignificanceHeuristic.

func (*PercentageScoreSignificanceHeuristic) Name

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

func (*PercentageScoreSignificanceHeuristic) Source

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

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

type PercentileRanksAggregation

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

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

func NewPercentileRanksAggregation

func NewPercentileRanksAggregation() *PercentileRanksAggregation

func (*PercentileRanksAggregation) Compression

func (a *PercentileRanksAggregation) Compression(compression float64) *PercentileRanksAggregation

func (*PercentileRanksAggregation) Estimator

func (*PercentileRanksAggregation) Field

func (*PercentileRanksAggregation) Format

func (*PercentileRanksAggregation) Meta

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

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

func (*PercentileRanksAggregation) Missing

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

func (*PercentileRanksAggregation) Script

func (*PercentileRanksAggregation) Source

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

func (*PercentileRanksAggregation) SubAggregation

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

func (*PercentileRanksAggregation) Values

type PercentilesAggregation

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

PercentilesAggregation is a multi-value metrics aggregation that calculates one or more percentiles 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-percentile-aggregation.html

func NewPercentilesAggregation

func NewPercentilesAggregation() *PercentilesAggregation

func (*PercentilesAggregation) Compression

func (a *PercentilesAggregation) Compression(compression float64) *PercentilesAggregation

func (*PercentilesAggregation) Estimator

func (a *PercentilesAggregation) Estimator(estimator string) *PercentilesAggregation

func (*PercentilesAggregation) Field

func (*PercentilesAggregation) Format

func (*PercentilesAggregation) Meta

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

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

func (*PercentilesAggregation) Method

Method is the percentiles method, which can be "tdigest" (default) or "hdr".

func (*PercentilesAggregation) Missing

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

func (*PercentilesAggregation) NumberOfSignificantValueDigits

func (a *PercentilesAggregation) NumberOfSignificantValueDigits(digits int) *PercentilesAggregation

func (*PercentilesAggregation) Percentiles

func (a *PercentilesAggregation) Percentiles(percentiles ...float64) *PercentilesAggregation

func (*PercentilesAggregation) Script

func (*PercentilesAggregation) Source

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

func (*PercentilesAggregation) SubAggregation

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

type PercentilesBucketAggregation

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

PercentilesBucketAggregation is a sibling pipeline aggregation which calculates percentiles 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.

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

func NewPercentilesBucketAggregation

func NewPercentilesBucketAggregation() *PercentilesBucketAggregation

NewPercentilesBucketAggregation creates and initializes a new PercentilesBucketAggregation.

func (*PercentilesBucketAggregation) BucketsPath

func (p *PercentilesBucketAggregation) BucketsPath(bucketsPaths ...string) *PercentilesBucketAggregation

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

func (*PercentilesBucketAggregation) Format

Format to apply the output value of this aggregation.

func (*PercentilesBucketAggregation) GapInsertZeros

GapInsertZeros inserts zeros for gaps in the series.

func (*PercentilesBucketAggregation) 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 (*PercentilesBucketAggregation) GapSkip

GapSkip skips gaps in the series.

func (*PercentilesBucketAggregation) Meta

func (p *PercentilesBucketAggregation) Meta(metaData map[string]interface{}) *PercentilesBucketAggregation

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

func (*PercentilesBucketAggregation) Percents

Percents to calculate percentiles for in this aggregation.

func (*PercentilesBucketAggregation) Source

func (p *PercentilesBucketAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

type PercolatorQuery

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

PercolatorQuery can be used to match queries stored in an index.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-percolate-query.html

func NewPercolatorQuery

func NewPercolatorQuery() *PercolatorQuery

NewPercolatorQuery creates and initializes a new Percolator query.

func (*PercolatorQuery) Document

func (q *PercolatorQuery) Document(docs ...interface{}) *PercolatorQuery

func (*PercolatorQuery) DocumentType deprecated

func (q *PercolatorQuery) DocumentType(typ string) *PercolatorQuery

Deprecated: DocumentType is deprecated as of 6.0.

func (*PercolatorQuery) Field

func (q *PercolatorQuery) Field(field string) *PercolatorQuery

func (*PercolatorQuery) IndexedDocumentId

func (q *PercolatorQuery) IndexedDocumentId(id string) *PercolatorQuery

func (*PercolatorQuery) IndexedDocumentIndex

func (q *PercolatorQuery) IndexedDocumentIndex(index string) *PercolatorQuery

func (*PercolatorQuery) IndexedDocumentPreference

func (q *PercolatorQuery) IndexedDocumentPreference(preference string) *PercolatorQuery

func (*PercolatorQuery) IndexedDocumentRouting

func (q *PercolatorQuery) IndexedDocumentRouting(routing string) *PercolatorQuery

func (*PercolatorQuery) IndexedDocumentType

func (q *PercolatorQuery) IndexedDocumentType(typ string) *PercolatorQuery

func (*PercolatorQuery) IndexedDocumentVersion

func (q *PercolatorQuery) IndexedDocumentVersion(version int64) *PercolatorQuery

func (*PercolatorQuery) Name

func (q *PercolatorQuery) Name(name string) *PercolatorQuery

Name used for identification purposes in "_percolator_document_slot" response field when multiple percolate queries have been specified in the main query.

func (*PercolatorQuery) Source

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

Source returns JSON for the percolate query.

type PhraseSuggester

type PhraseSuggester struct {
	Suggester
	// contains filtered or unexported fields
}

PhraseSuggester provides an API to access word alternatives on a per token basis within a certain string distance. For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-suggesters-phrase.html.

func NewPhraseSuggester

func NewPhraseSuggester(name string) *PhraseSuggester

NewPhraseSuggester creates a new PhraseSuggester.

func (*PhraseSuggester) Analyzer

func (q *PhraseSuggester) Analyzer(analyzer string) *PhraseSuggester

func (*PhraseSuggester) CandidateGenerator

func (q *PhraseSuggester) CandidateGenerator(generator CandidateGenerator) *PhraseSuggester

func (*PhraseSuggester) CandidateGenerators

func (q *PhraseSuggester) CandidateGenerators(generators ...CandidateGenerator) *PhraseSuggester

func (*PhraseSuggester) ClearCandidateGenerator

func (q *PhraseSuggester) ClearCandidateGenerator() *PhraseSuggester

func (*PhraseSuggester) CollateParams

func (q *PhraseSuggester) CollateParams(collateParams map[string]interface{}) *PhraseSuggester

func (*PhraseSuggester) CollatePreference

func (q *PhraseSuggester) CollatePreference(collatePreference string) *PhraseSuggester

func (*PhraseSuggester) CollatePrune

func (q *PhraseSuggester) CollatePrune(collatePrune bool) *PhraseSuggester

func (*PhraseSuggester) CollateQuery

func (q *PhraseSuggester) CollateQuery(collateQuery *Script) *PhraseSuggester

func (*PhraseSuggester) Confidence

func (q *PhraseSuggester) Confidence(confidence float64) *PhraseSuggester

func (*PhraseSuggester) ContextQueries

func (q *PhraseSuggester) ContextQueries(queries ...SuggesterContextQuery) *PhraseSuggester

func (*PhraseSuggester) ContextQuery

func (q *PhraseSuggester) ContextQuery(query SuggesterContextQuery) *PhraseSuggester

func (*PhraseSuggester) Field

func (q *PhraseSuggester) Field(field string) *PhraseSuggester

func (*PhraseSuggester) ForceUnigrams

func (q *PhraseSuggester) ForceUnigrams(forceUnigrams bool) *PhraseSuggester

func (*PhraseSuggester) GramSize

func (q *PhraseSuggester) GramSize(gramSize int) *PhraseSuggester

func (*PhraseSuggester) Highlight

func (q *PhraseSuggester) Highlight(preTag, postTag string) *PhraseSuggester

func (*PhraseSuggester) MaxErrors

func (q *PhraseSuggester) MaxErrors(maxErrors float64) *PhraseSuggester

func (*PhraseSuggester) Name

func (q *PhraseSuggester) Name() string

func (*PhraseSuggester) RealWordErrorLikelihood

func (q *PhraseSuggester) RealWordErrorLikelihood(realWordErrorLikelihood float64) *PhraseSuggester

func (*PhraseSuggester) Separator

func (q *PhraseSuggester) Separator(separator string) *PhraseSuggester

func (*PhraseSuggester) ShardSize

func (q *PhraseSuggester) ShardSize(shardSize int) *PhraseSuggester

func (*PhraseSuggester) Size

func (q *PhraseSuggester) Size(size int) *PhraseSuggester

func (*PhraseSuggester) SmoothingModel

func (q *PhraseSuggester) SmoothingModel(smoothingModel SmoothingModel) *PhraseSuggester

func (*PhraseSuggester) Source

func (q *PhraseSuggester) Source(includeName bool) (interface{}, error)

Source generates the source for the phrase suggester.

func (*PhraseSuggester) Text

func (q *PhraseSuggester) Text(text string) *PhraseSuggester

func (*PhraseSuggester) TokenLimit

func (q *PhraseSuggester) TokenLimit(tokenLimit int) *PhraseSuggester

type PinnedQuery

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

PinnedQuery is a query that promotes selected documents to rank higher than those matching a given query.

For more details, see: https://www.elastic.co/guide/en/elasticsearch/reference/7.8/query-dsl-pinned-query.html

func NewPinnedQuery

func NewPinnedQuery() *PinnedQuery

NewPinnedQuery creates and initializes a new pinned query.

func (*PinnedQuery) Ids

func (q *PinnedQuery) Ids(ids ...string) *PinnedQuery

Ids sets an array of document IDs listed in the order they are to appear in results.

func (*PinnedQuery) Organic

func (q *PinnedQuery) Organic(query Query) *PinnedQuery

Organic sets a choice of query used to rank documents which will be ranked below the "pinned" document ids.

func (*PinnedQuery) Source

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

Source returns the JSON serializable content for this query.

type PointInTime

type PointInTime struct {
	// Id that uniquely identifies the point in time, as created with the
	// OpenPointInTime API.
	Id string `json:"id,omitempty"`
	// KeepAlive is the time for which this specific PointInTime will be
	// kept alive by Elasticsearch.
	KeepAlive string `json:"keep_alive,omitempty"`
}

PointInTime is a lightweight view into the state of the data that existed when initiated. It can be created with OpenPointInTime API and be used when searching, e.g. in Search API or with SearchSource.

func NewPointInTime

func NewPointInTime(id string) *PointInTime

NewPointInTime creates a new PointInTime.

func NewPointInTimeWithKeepAlive

func NewPointInTimeWithKeepAlive(id, keepAlive string) *PointInTime

NewPointInTimeWithKeepAlive creates a new PointInTime with the given time to keep alive.

func (*PointInTime) Source

func (pit *PointInTime) Source() (interface{}, error)

Source generates the JSON serializable fragment for the PointInTime.

type PrefixQuery

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

PrefixQuery matches documents that have fields containing terms with a specified prefix (not analyzed).

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-prefix-query.html

func NewPrefixQuery

func NewPrefixQuery(name string, prefix string) *PrefixQuery

NewPrefixQuery creates and initializes a new PrefixQuery.

func (*PrefixQuery) Boost

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

Boost sets the boost for this query.

func (*PrefixQuery) CaseInsensitive

func (q *PrefixQuery) CaseInsensitive(caseInsensitive bool) *PrefixQuery

func (*PrefixQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit.

func (*PrefixQuery) Rewrite

func (q *PrefixQuery) Rewrite(rewrite string) *PrefixQuery

func (*PrefixQuery) Source

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

Source returns JSON for the query.

type ProfileResult

type ProfileResult struct {
	Type          string                 `json:"type"`
	Description   string                 `json:"description,omitempty"`
	NodeTime      string                 `json:"time,omitempty"`
	NodeTimeNanos int64                  `json:"time_in_nanos,omitempty"`
	Breakdown     map[string]int64       `json:"breakdown,omitempty"`
	Children      []ProfileResult        `json:"children,omitempty"`
	Debug         map[string]interface{} `json:"debug,omitempty"`
}

ProfileResult is the internal representation of a profiled query, corresponding to a single node in the query tree.

type PutScriptService

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

PutScriptService adds or updates a stored script in Elasticsearch.

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

func NewPutScriptService

func NewPutScriptService() *PutScriptService

NewPutScriptService creates a new PutScriptService.

func (*PutScriptService) BodyJson

func (s *PutScriptService) BodyJson(body interface{}) *PutScriptService

BodyJson is the document as a serializable JSON interface.

func (*PutScriptService) BodyString

func (s *PutScriptService) BodyString(body string) *PutScriptService

BodyString is the document encoded as a string.

func (*PutScriptService) Context

func (s *PutScriptService) Context(context string) *PutScriptService

Context specifies the script context (optional).

func (*PutScriptService) ErrorTrace

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

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

func (*PutScriptService) FilterPath

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

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

func (*PutScriptService) Header

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

Header adds a header to the request.

func (*PutScriptService) Headers

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

Headers specifies the headers of the request.

func (*PutScriptService) Human

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

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

func (*PutScriptService) Id

Id is the script ID.

func (*PutScriptService) MasterTimeout

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

MasterTimeout is the timeout for connecting to master.

func (*PutScriptService) Pretty

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

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*PutScriptService) Timeout

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

Timeout is an explicit operation timeout.

type Query

type Query interface {
	// Source returns the JSON-serializable query request.
	Source() (interface{}, error)
}

Query represents the generic query interface. A query's sole purpose is to return the source of the query as a JSON-serializable object. Returning map[string]interface{} is the norm for queries.

type QueryProfileShardResult

type QueryProfileShardResult struct {
	Query       []ProfileResult `json:"query,omitempty"`
	RewriteTime int64           `json:"rewrite_time,omitempty"`
	Collector   []interface{}   `json:"collector,omitempty"`
}

QueryProfileShardResult is a container class to hold the profile results for a single shard in the request. It comtains a list of query profiles, a collector tree and a total rewrite tree.

type QueryRescorer

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

func NewQueryRescorer

func NewQueryRescorer(query Query) *QueryRescorer

func (*QueryRescorer) Name

func (r *QueryRescorer) Name() string

func (*QueryRescorer) QueryWeight

func (r *QueryRescorer) QueryWeight(queryWeight float64) *QueryRescorer

func (*QueryRescorer) RescoreQueryWeight

func (r *QueryRescorer) RescoreQueryWeight(rescoreQueryWeight float64) *QueryRescorer

func (*QueryRescorer) ScoreMode

func (r *QueryRescorer) ScoreMode(scoreMode string) *QueryRescorer

func (*QueryRescorer) Source

func (r *QueryRescorer) Source() (interface{}, error)

type QueryStringQuery

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

QueryStringQuery uses the query parser in order to parse its content.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-query-string-query.html

func NewQueryStringQuery

func NewQueryStringQuery(queryString string) *QueryStringQuery

NewQueryStringQuery creates and initializes a new QueryStringQuery.

func (*QueryStringQuery) AllowLeadingWildcard

func (q *QueryStringQuery) AllowLeadingWildcard(allowLeadingWildcard bool) *QueryStringQuery

AllowLeadingWildcard specifies whether leading wildcards should be allowed or not (defaults to true).

func (*QueryStringQuery) AnalyzeWildcard

func (q *QueryStringQuery) AnalyzeWildcard(analyzeWildcard bool) *QueryStringQuery

AnalyzeWildcard indicates whether to enabled analysis on wildcard and prefix queries.

func (*QueryStringQuery) Analyzer

func (q *QueryStringQuery) Analyzer(analyzer string) *QueryStringQuery

Analyzer is an optional analyzer used to analyze the query string. Note, if a field has search analyzer defined for it, then it will be used automatically. Defaults to the smart search analyzer.

func (*QueryStringQuery) Boost

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

Boost sets the boost for this query.

func (*QueryStringQuery) DefaultField

func (q *QueryStringQuery) DefaultField(defaultField string) *QueryStringQuery

DefaultField specifies the field to run against when no prefix field is specified. Only relevant when not explicitly adding fields the query string will run against.

func (*QueryStringQuery) DefaultOperator

func (q *QueryStringQuery) DefaultOperator(operator string) *QueryStringQuery

DefaultOperator sets the boolean operator of the query parser used to parse the query string.

In default mode (OR) terms without any modifiers are considered optional, e.g. "capital of Hungary" is equal to "capital OR of OR Hungary".

In AND mode, terms are considered to be in conjunction. The above mentioned query is then parsed as "capital AND of AND Hungary".

func (*QueryStringQuery) EnablePositionIncrements

func (q *QueryStringQuery) EnablePositionIncrements(enablePositionIncrements bool) *QueryStringQuery

EnablePositionIncrements indicates whether to enable position increments in result query. Defaults to true.

When set, result phrase and multi-phrase queries will be aware of position increments. Useful when e.g. a StopFilter increases the position increment of the token that follows an omitted token.

func (*QueryStringQuery) Escape

func (q *QueryStringQuery) Escape(escape bool) *QueryStringQuery

Escape performs escaping of the query string.

func (*QueryStringQuery) Field

func (q *QueryStringQuery) Field(field string) *QueryStringQuery

Field adds a field to run the query string against.

func (*QueryStringQuery) FieldWithBoost

func (q *QueryStringQuery) FieldWithBoost(field string, boost float64) *QueryStringQuery

FieldWithBoost adds a field to run the query string against with a specific boost.

func (*QueryStringQuery) Fuzziness

func (q *QueryStringQuery) Fuzziness(fuzziness string) *QueryStringQuery

Fuzziness sets the edit distance for fuzzy queries. Default is "AUTO".

func (*QueryStringQuery) FuzzyMaxExpansions

func (q *QueryStringQuery) FuzzyMaxExpansions(fuzzyMaxExpansions int) *QueryStringQuery

func (*QueryStringQuery) FuzzyPrefixLength

func (q *QueryStringQuery) FuzzyPrefixLength(fuzzyPrefixLength int) *QueryStringQuery

FuzzyPrefixLength sets the minimum prefix length for fuzzy queries. Default is 1.

func (*QueryStringQuery) FuzzyRewrite

func (q *QueryStringQuery) FuzzyRewrite(fuzzyRewrite string) *QueryStringQuery

func (*QueryStringQuery) Lenient

func (q *QueryStringQuery) Lenient(lenient bool) *QueryStringQuery

Lenient indicates whether the query string parser should be lenient when parsing field values. It defaults to the index setting and if not set, defaults to false.

func (*QueryStringQuery) Locale deprecated

func (q *QueryStringQuery) Locale(locale string) *QueryStringQuery

Locale specifies the locale to be used for string conversions.

Deprecated: Decision is now made by the analyzer.

func (*QueryStringQuery) LowercaseExpandedTerms deprecated

func (q *QueryStringQuery) LowercaseExpandedTerms(lowercaseExpandedTerms bool) *QueryStringQuery

LowercaseExpandedTerms indicates whether terms of wildcard, prefix, fuzzy and range queries are automatically lower-cased or not. Default is true.

Deprecated: Decision is now made by the analyzer.

func (*QueryStringQuery) MaxDeterminizedState

func (q *QueryStringQuery) MaxDeterminizedState(maxDeterminizedStates int) *QueryStringQuery

MaxDeterminizedState protects against too-difficult regular expression queries.

func (*QueryStringQuery) MinimumShouldMatch

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

func (*QueryStringQuery) PhraseSlop

func (q *QueryStringQuery) PhraseSlop(phraseSlop int) *QueryStringQuery

PhraseSlop sets the default slop for phrases. If zero, then exact matches are required. Default value is zero.

func (*QueryStringQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit.

func (*QueryStringQuery) QuoteAnalyzer

func (q *QueryStringQuery) QuoteAnalyzer(quoteAnalyzer string) *QueryStringQuery

QuoteAnalyzer is an optional analyzer to be used to analyze the query string for phrase searches. Note, if a field has search analyzer defined for it, then it will be used automatically. Defaults to the smart search analyzer.

func (*QueryStringQuery) QuoteFieldSuffix

func (q *QueryStringQuery) QuoteFieldSuffix(quoteFieldSuffix string) *QueryStringQuery

QuoteFieldSuffix is an optional field name suffix to automatically try and add to the field searched when using quoted text.

func (*QueryStringQuery) Rewrite

func (q *QueryStringQuery) Rewrite(rewrite string) *QueryStringQuery

func (*QueryStringQuery) Source

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

Source returns JSON for the query.

func (*QueryStringQuery) TieBreaker

func (q *QueryStringQuery) TieBreaker(tieBreaker float64) *QueryStringQuery

TieBreaker is used when more than one field is used with the query string, and combined queries are using dismax.

func (*QueryStringQuery) TimeZone

func (q *QueryStringQuery) TimeZone(timeZone string) *QueryStringQuery

TimeZone can be used to automatically adjust to/from fields using a timezone. Only used with date fields, of course.

func (*QueryStringQuery) Type

Type sets how multiple fields should be combined to build textual part queries, e.g. "best_fields".

type RandomFunction

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

RandomFunction builds a random score function. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-function-score-query.html#_random for details.

func NewRandomFunction

func NewRandomFunction() *RandomFunction

NewRandomFunction initializes and returns a new RandomFunction.

func (*RandomFunction) Field

func (fn *RandomFunction) Field(field string) *RandomFunction

Field is the field to be used for random number generation. This parameter is compulsory when a Seed is set and ignored otherwise. Note that documents that have the same value for a field will get the same score.

func (*RandomFunction) GetWeight

func (fn *RandomFunction) GetWeight() *float64

GetWeight returns the adjusted score. It is part of the ScoreFunction interface. Returns nil if weight is not specified.

func (*RandomFunction) Name

func (fn *RandomFunction) Name() string

Name represents the JSON field name under which the output of Source needs to be serialized by FunctionScoreQuery (see FunctionScoreQuery.Source).

func (*RandomFunction) Seed

func (fn *RandomFunction) Seed(seed interface{}) *RandomFunction

Seed sets the seed based on which the random number will be generated. Using the same seed is guaranteed to generate the same random number for a specific doc. Seed must be an integer, e.g. int or int64. It is specified as an interface{} here for compatibility with older versions (which also accepted strings).

func (*RandomFunction) Source

func (fn *RandomFunction) Source() (interface{}, error)

Source returns the serializable JSON data of this score function.

func (*RandomFunction) Weight

func (fn *RandomFunction) Weight(weight float64) *RandomFunction

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 RangeAggregation

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

RangeAggregation is a multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. During the aggregation process, the values extracted from each document will be checked against each bucket range and "bucket" the relevant/matching document. 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-range-aggregation.html

func NewRangeAggregation

func NewRangeAggregation() *RangeAggregation

func (*RangeAggregation) AddRange

func (a *RangeAggregation) AddRange(from, to interface{}) *RangeAggregation

func (*RangeAggregation) AddRangeWithKey

func (a *RangeAggregation) AddRangeWithKey(key string, from, to interface{}) *RangeAggregation

func (*RangeAggregation) AddUnboundedFrom

func (a *RangeAggregation) AddUnboundedFrom(to interface{}) *RangeAggregation

func (*RangeAggregation) AddUnboundedFromWithKey

func (a *RangeAggregation) AddUnboundedFromWithKey(key string, to interface{}) *RangeAggregation

func (*RangeAggregation) AddUnboundedTo

func (a *RangeAggregation) AddUnboundedTo(from interface{}) *RangeAggregation

func (*RangeAggregation) AddUnboundedToWithKey

func (a *RangeAggregation) AddUnboundedToWithKey(key string, from interface{}) *RangeAggregation

func (*RangeAggregation) Between

func (a *RangeAggregation) Between(from, to interface{}) *RangeAggregation

func (*RangeAggregation) BetweenWithKey

func (a *RangeAggregation) BetweenWithKey(key string, from, to interface{}) *RangeAggregation

func (*RangeAggregation) Field

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

func (*RangeAggregation) Gt

func (a *RangeAggregation) Gt(from interface{}) *RangeAggregation

func (*RangeAggregation) GtWithKey

func (a *RangeAggregation) GtWithKey(key string, from interface{}) *RangeAggregation

func (*RangeAggregation) Keyed

func (a *RangeAggregation) Keyed(keyed bool) *RangeAggregation

func (*RangeAggregation) Lt

func (a *RangeAggregation) Lt(to interface{}) *RangeAggregation

func (*RangeAggregation) LtWithKey

func (a *RangeAggregation) LtWithKey(key string, to interface{}) *RangeAggregation

func (*RangeAggregation) Meta

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

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

func (*RangeAggregation) Missing

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

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

func (*RangeAggregation) Script

func (a *RangeAggregation) Script(script *Script) *RangeAggregation

func (*RangeAggregation) Source

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

func (*RangeAggregation) SubAggregation

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

func (*RangeAggregation) Unmapped

func (a *RangeAggregation) Unmapped(unmapped bool) *RangeAggregation

type RangeQuery

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

RangeQuery matches documents with fields that have terms within a certain range.

For details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-range-query.html

func NewRangeQuery

func NewRangeQuery(name string) *RangeQuery

NewRangeQuery creates and initializes a new RangeQuery.

func (*RangeQuery) Boost

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

Boost sets the boost for this query.

func (*RangeQuery) Format

func (q *RangeQuery) Format(format string) *RangeQuery

Format is used for date fields. In that case, we can set the format to be used instead of the mapper format.

func (*RangeQuery) From

func (q *RangeQuery) From(from interface{}) *RangeQuery

From indicates the from part of the RangeQuery. Use nil to indicate an unbounded from part.

func (*RangeQuery) Gt

func (q *RangeQuery) Gt(from interface{}) *RangeQuery

Gt indicates a greater-than value for the from part. Use nil to indicate an unbounded from part.

func (*RangeQuery) Gte

func (q *RangeQuery) Gte(from interface{}) *RangeQuery

Gte indicates a greater-than-or-equal value for the from part. Use nil to indicate an unbounded from part.

func (*RangeQuery) IncludeLower

func (q *RangeQuery) IncludeLower(includeLower bool) *RangeQuery

IncludeLower indicates whether the lower bound should be included or not. Defaults to true.

func (*RangeQuery) IncludeUpper

func (q *RangeQuery) IncludeUpper(includeUpper bool) *RangeQuery

IncludeUpper indicates whether the upper bound should be included or not. Defaults to true.

func (*RangeQuery) Lt

func (q *RangeQuery) Lt(to interface{}) *RangeQuery

Lt indicates a less-than value for the to part. Use nil to indicate an unbounded to part.

func (*RangeQuery) Lte

func (q *RangeQuery) Lte(to interface{}) *RangeQuery

Lte indicates a less-than-or-equal value for the to part. Use nil to indicate an unbounded to part.

func (*RangeQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit.

func (*RangeQuery) Relation

func (q *RangeQuery) Relation(relation string) *RangeQuery

Relation is used for range fields. which can be one of "within", "contains", "intersects" (default) and "disjoint".

func (*RangeQuery) Source

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

Source returns JSON for the query.

func (*RangeQuery) TimeZone

func (q *RangeQuery) TimeZone(timeZone string) *RangeQuery

TimeZone is used for date fields. In that case, we can adjust the from/to fields using a timezone.

func (*RangeQuery) To

func (q *RangeQuery) To(to interface{}) *RangeQuery

To indicates the to part of the RangeQuery. Use nil to indicate an unbounded to part.

type RankFeatureLinearScoreFunction

type RankFeatureLinearScoreFunction struct {
}

RankFeatureLinearScoreFunction represents a Linear score function for a RankFeatureQuery.

See here for details: https://www.elastic.co/guide/en/elasticsearch/reference/7.14/query-dsl-rank-feature-query.html#rank-feature-query-linear

func NewRankFeatureLinearScoreFunction

func NewRankFeatureLinearScoreFunction() *RankFeatureLinearScoreFunction

NewRankFeatureLinearScoreFunction initializes a new RankFeatureLinearScoreFunction.

func (*RankFeatureLinearScoreFunction) Name

Name of the score function.

func (*RankFeatureLinearScoreFunction) Source

func (f *RankFeatureLinearScoreFunction) Source() (interface{}, error)

Source returns a serializable JSON object for building the query.

type RankFeatureLogScoreFunction

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

RankFeatureLogScoreFunction represents a Logarithmic score function for a RankFeatureQuery.

See here for details: https://www.elastic.co/guide/en/elasticsearch/reference/7.14/query-dsl-rank-feature-query.html#rank-feature-query-logarithm

func NewRankFeatureLogScoreFunction

func NewRankFeatureLogScoreFunction(scalingFactor float64) *RankFeatureLogScoreFunction

NewRankFeatureLogScoreFunction returns a new RankFeatureLogScoreFunction with the given scaling factor.

func (*RankFeatureLogScoreFunction) Name

Name of the score function.

func (*RankFeatureLogScoreFunction) Source

func (f *RankFeatureLogScoreFunction) Source() (interface{}, error)

Source returns a serializable JSON object for building the query.

type RankFeatureQuery

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

RankFeatureQuery boosts the relevance score of documents based on the numeric value of a rank_feature or rank_features field.

The RankFeatureQuery is typically used in the should clause of a BoolQuery so its relevance scores are added to other scores from the BoolQuery.

For more details, see: https://www.elastic.co/guide/en/elasticsearch/reference/7.14/query-dsl-rank-feature-query.html

func NewRankFeatureQuery

func NewRankFeatureQuery(field string) *RankFeatureQuery

NewRankFeatureQuery creates and initializes a new RankFeatureQuery.

func (*RankFeatureQuery) Boost

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

Boost sets the boost for this query.

func (*RankFeatureQuery) Field

func (q *RankFeatureQuery) Field(field string) *RankFeatureQuery

Field name.

func (*RankFeatureQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit.

func (*RankFeatureQuery) ScoreFunction

ScoreFunction specifies the score function for the RankFeatureQuery.

func (*RankFeatureQuery) Source

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

Source returns the JSON serializable content for this query.

type RankFeatureSaturationScoreFunction

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

RankFeatureSaturationScoreFunction represents a Log score function for a RankFeatureQuery.

See here for details: https://www.elastic.co/guide/en/elasticsearch/reference/7.14/query-dsl-rank-feature-query.html#rank-feature-query-saturation

func NewRankFeatureSaturationScoreFunction

func NewRankFeatureSaturationScoreFunction() *RankFeatureSaturationScoreFunction

NewRankFeatureSaturationScoreFunction initializes a new RankFeatureSaturationScoreFunction.

func (*RankFeatureSaturationScoreFunction) Name

Name of the score function.

func (*RankFeatureSaturationScoreFunction) Pivot

Pivot specifies the pivot to use.

func (*RankFeatureSaturationScoreFunction) Source

func (f *RankFeatureSaturationScoreFunction) Source() (interface{}, error)

Source returns a serializable JSON object for building the query.

type RankFeatureScoreFunction

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

RankFeatureScoreFunction specifies the interface for score functions in the context of a RankFeatureQuery.

type RankFeatureSigmoidScoreFunction

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

RankFeatureSigmoidScoreFunction represents a Sigmoid score function for a RankFeatureQuery.

See here for details: https://www.elastic.co/guide/en/elasticsearch/reference/7.14/query-dsl-rank-feature-query.html#rank-feature-query-sigmoid

func NewRankFeatureSigmoidScoreFunction

func NewRankFeatureSigmoidScoreFunction(pivot, exponent float64) *RankFeatureSigmoidScoreFunction

NewRankFeatureSigmoidScoreFunction returns a new RankFeatureSigmoidScoreFunction with the given scaling factor.

func (*RankFeatureSigmoidScoreFunction) Name

Name of the score function.

func (*RankFeatureSigmoidScoreFunction) Source

func (f *RankFeatureSigmoidScoreFunction) Source() (interface{}, error)

Source returns a serializable JSON object for building the query.

type RareTermsAggregation

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

RareTermsAggregation is a multi-bucket value source based aggregation which finds "rare" terms — terms that are at the long-tail of the distribution and are not frequent. Conceptually, this is like a terms aggregation that is sorted by _count ascending.

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

func NewRareTermsAggregation

func NewRareTermsAggregation() *RareTermsAggregation

func (*RareTermsAggregation) Exclude

func (a *RareTermsAggregation) Exclude(regexp string) *RareTermsAggregation

func (*RareTermsAggregation) ExcludeValues

func (a *RareTermsAggregation) ExcludeValues(values ...interface{}) *RareTermsAggregation

func (*RareTermsAggregation) Field

func (*RareTermsAggregation) Include

func (a *RareTermsAggregation) Include(regexp string) *RareTermsAggregation

func (*RareTermsAggregation) IncludeExclude

func (a *RareTermsAggregation) IncludeExclude(includeExclude *TermsAggregationIncludeExclude) *RareTermsAggregation

func (*RareTermsAggregation) IncludeValues

func (a *RareTermsAggregation) IncludeValues(values ...interface{}) *RareTermsAggregation

func (*RareTermsAggregation) MaxDocCount

func (a *RareTermsAggregation) MaxDocCount(maxDocCount int) *RareTermsAggregation

func (*RareTermsAggregation) Meta

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

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

func (*RareTermsAggregation) Missing

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

func (*RareTermsAggregation) Precision

func (a *RareTermsAggregation) Precision(precision float64) *RareTermsAggregation

func (*RareTermsAggregation) Source

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

func (*RareTermsAggregation) SubAggregation

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

type RawStringQuery

type RawStringQuery string

RawStringQuery can be used to treat a string representation of an ES query as a Query. Example usage:

q := RawStringQuery("{\"match_all\":{}}")
db.Search().Query(q).From(1).Size(100).Do()

func NewRawStringQuery

func NewRawStringQuery(q string) RawStringQuery

NewRawStringQuery ininitializes a new RawStringQuery. It is the same as RawStringQuery(q).

func (RawStringQuery) Source

func (q RawStringQuery) Source() (interface{}, error)

Source returns the JSON encoded body

type RecoverySource

type RecoverySource struct {
	Type string `json:"type"`
}

type RegexCompletionSuggesterOptions

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

RegexCompletionSuggesterOptions represents the options for regex completion suggester.

func NewRegexCompletionSuggesterOptions

func NewRegexCompletionSuggesterOptions() *RegexCompletionSuggesterOptions

NewRegexCompletionSuggesterOptions initializes a new RegexCompletionSuggesterOptions instance.

func (*RegexCompletionSuggesterOptions) Flags

Flags represents internal regex flags. Possible flags are ALL (default), ANYSTRING, COMPLEMENT, EMPTY, INTERSECTION, INTERVAL, or NONE.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-suggesters-completion.html#regex for details.

func (*RegexCompletionSuggesterOptions) MaxDeterminizedStates

MaxDeterminizedStates represents the maximum automaton states allowed for regex expansion.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-suggesters-completion.html#regex for details.

func (*RegexCompletionSuggesterOptions) Source

func (o *RegexCompletionSuggesterOptions) Source() (interface{}, error)

Source creates the JSON data.

type RegexpQuery

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

RegexpQuery allows you to use regular expression term queries.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-regexp-query.html

func NewRegexpQuery

func NewRegexpQuery(name string, regexp string) *RegexpQuery

NewRegexpQuery creates and initializes a new RegexpQuery.

func (*RegexpQuery) Boost

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

Boost sets the boost for this query.

func (*RegexpQuery) CaseInsensitive

func (q *RegexpQuery) CaseInsensitive(caseInsensitive bool) *RegexpQuery

func (*RegexpQuery) Flags

func (q *RegexpQuery) Flags(flags string) *RegexpQuery

Flags sets the regexp flags.

func (*RegexpQuery) MaxDeterminizedStates

func (q *RegexpQuery) MaxDeterminizedStates(maxDeterminizedStates int) *RegexpQuery

MaxDeterminizedStates protects against complex regular expressions.

func (*RegexpQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit

func (*RegexpQuery) Rewrite

func (q *RegexpQuery) Rewrite(rewrite string) *RegexpQuery

func (*RegexpQuery) Source

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

Source returns the JSON-serializable query data.

type Request

type Request http.Request

Elasticsearch-specific HTTP request

func NewRequest

func NewRequest(method, url string) (*Request, error)

NewRequest is a http.Request and adds features such as encoding the body.

func (*Request) SetBasicAuth

func (r *Request) SetBasicAuth(username, password string)

SetBasicAuth wraps http.Request's SetBasicAuth.

func (*Request) SetBody

func (r *Request) SetBody(body interface{}, gzipCompress bool) error

SetBody encodes the body in the request. You may pass a flag to compress the request via gzip.

type Rescore

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

func NewRescore

func NewRescore() *Rescore

func (*Rescore) IsEmpty

func (r *Rescore) IsEmpty() bool

func (*Rescore) Rescorer

func (r *Rescore) Rescorer(rescorer Rescorer) *Rescore

func (*Rescore) Source

func (r *Rescore) Source() (interface{}, error)

func (*Rescore) WindowSize

func (r *Rescore) WindowSize(windowSize int) *Rescore

type Rescorer

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

type ReverseNestedAggregation

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

ReverseNestedAggregation defines a special single bucket aggregation that enables aggregating on parent docs from nested documents. Effectively this aggregation can break out of the nested block structure and link to other nested structures or the root document, which allows nesting other aggregations that aren’t part of the nested object in a nested aggregation.

See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-reverse-nested-aggregation.html

func NewReverseNestedAggregation

func NewReverseNestedAggregation() *ReverseNestedAggregation

NewReverseNestedAggregation initializes a new ReverseNestedAggregation bucket aggregation.

func (*ReverseNestedAggregation) Meta

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

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

func (*ReverseNestedAggregation) Path

Path set the path to use for this nested aggregation. The path must match the path to a nested object in the mappings. If it is not specified then this aggregation will go back to the root document.

func (*ReverseNestedAggregation) Source

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

func (*ReverseNestedAggregation) SubAggregation

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

type RuntimeMappings

type RuntimeMappings map[string]interface{}

RuntimeMappings specify fields that are evaluated at query time.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.14/runtime.html for details.

func (*RuntimeMappings) Source

func (m *RuntimeMappings) Source() (interface{}, error)

Source deserializes the runtime mappings.

type SamplerAggregation

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

SamplerAggregation is a filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. Optionally, diversity settings can be used 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-sampler-aggregation.html

func NewSamplerAggregation

func NewSamplerAggregation() *SamplerAggregation

func (*SamplerAggregation) Meta

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

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

func (*SamplerAggregation) ShardSize

func (a *SamplerAggregation) ShardSize(shardSize int) *SamplerAggregation

ShardSize sets the maximum number of docs returned from each shard.

func (*SamplerAggregation) Source

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

func (*SamplerAggregation) SubAggregation

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

type ScoreFunction

type ScoreFunction interface {
	Name() string
	GetWeight() *float64 // returns the weight which must be serialized at the level of FunctionScoreQuery
	Source() (interface{}, error)
}

ScoreFunction is used in combination with the Function Score Query.

type ScoreSort

type ScoreSort struct {
	Sorter
	// contains filtered or unexported fields
}

ScoreSort sorts by relevancy score.

func NewScoreSort

func NewScoreSort() *ScoreSort

NewScoreSort creates a new ScoreSort.

func (*ScoreSort) Asc

func (s *ScoreSort) Asc() *ScoreSort

Asc sets ascending sort order.

func (*ScoreSort) Desc

func (s *ScoreSort) Desc() *ScoreSort

Desc sets descending sort order.

func (*ScoreSort) Order

func (s *ScoreSort) Order(ascending bool) *ScoreSort

Order defines whether sorting ascending (default) or descending.

func (*ScoreSort) Source

func (s *ScoreSort) Source() (interface{}, error)

Source returns the JSON-serializable data.

type Script

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

Script holds all the parameters necessary to compile or find in cache and then execute a script.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/modules-scripting.html for details of scripting.

func NewScript

func NewScript(script string) *Script

NewScript creates and initializes a new Script. By default, it is of type "inline". Use NewScriptStored for a stored script (where type is "id").

func NewScriptInline

func NewScriptInline(script string) *Script

NewScriptInline creates and initializes a new inline script, i.e. code.

func NewScriptStored

func NewScriptStored(script string) *Script

NewScriptStored creates and initializes a new stored script.

func (*Script) Lang

func (s *Script) Lang(lang string) *Script

Lang sets the language of the script. The default scripting language is Painless ("painless"). See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/modules-scripting.html for details.

func (*Script) Param

func (s *Script) Param(name string, value interface{}) *Script

Param adds a key/value pair to the parameters that this script will be executed with.

func (*Script) Params

func (s *Script) Params(params map[string]interface{}) *Script

Params sets the map of parameters this script will be executed with.

func (*Script) Script

func (s *Script) Script(script string) *Script

Script is either the cache key of the script to be compiled/executed or the actual script source code for inline scripts. For indexed scripts this is the id used in the request. For file scripts this is the file name.

func (*Script) Source

func (s *Script) Source() (interface{}, error)

Source returns the JSON serializable data for this Script.

func (*Script) Type

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

Type sets the type of script: "inline" or "id".

type ScriptErrorPosition

type ScriptErrorPosition struct {
	Offset int `json:"offset"`
	Start  int `json:"start"`
	End    int `json:"end"`
}

ScriptErrorPosition specifies the position of the error in a script. It is used in ErrorDetails for scripting errors.

type ScriptField

type ScriptField struct {
	FieldName string // name of the field
	// contains filtered or unexported fields
}

ScriptField is a single script field.

func NewScriptField

func NewScriptField(fieldName string, script *Script) *ScriptField

NewScriptField creates and initializes a new ScriptField.

func (*ScriptField) IgnoreFailure

func (f *ScriptField) IgnoreFailure(ignore bool) *ScriptField

IgnoreFailure indicates whether to ignore failures. It is used in e.g. ScriptSource.

func (*ScriptField) Source

func (f *ScriptField) Source() (interface{}, error)

Source returns the serializable JSON for the ScriptField.

type ScriptFunction

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

ScriptFunction builds a script score function. It uses a script to compute or influence the score of documents that match with the inner query or filter.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-function-score-query.html#_script_score for details.

func NewScriptFunction

func NewScriptFunction(script *Script) *ScriptFunction

NewScriptFunction initializes and returns a new ScriptFunction.

func (*ScriptFunction) GetWeight

func (fn *ScriptFunction) GetWeight() *float64

GetWeight returns the adjusted score. It is part of the ScoreFunction interface. Returns nil if weight is not specified.

func (*ScriptFunction) Name

func (fn *ScriptFunction) Name() string

Name represents the JSON field name under which the output of Source needs to be serialized by FunctionScoreQuery (see FunctionScoreQuery.Source).

func (*ScriptFunction) Script

func (fn *ScriptFunction) Script(script *Script) *ScriptFunction

Script specifies the script to be executed.

func (*ScriptFunction) Source

func (fn *ScriptFunction) Source() (interface{}, error)

Source returns the serializable JSON data of this score function.

func (*ScriptFunction) Weight

func (fn *ScriptFunction) Weight(weight float64) *ScriptFunction

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 ScriptQuery

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

ScriptQuery allows to define scripts as filters.

For details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-script-query.html

func NewScriptQuery

func NewScriptQuery(script *Script) *ScriptQuery

NewScriptQuery creates and initializes a new ScriptQuery.

func (*ScriptQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit

func (*ScriptQuery) Source

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

Source returns JSON for the query.

type ScriptScoreQuery

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

ScriptScoreQuery uses a script to provide a custom score for returned documents.

A ScriptScoreQuery 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-script-score-query.html

func NewScriptScoreQuery

func NewScriptScoreQuery(query Query, script *Script) *ScriptScoreQuery

NewScriptScoreQuery creates and initializes a new script_score query.

func (*ScriptScoreQuery) Boost

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

Boost sets the boost for this query.

func (*ScriptScoreQuery) MinScore

func (q *ScriptScoreQuery) MinScore(minScore float64) *ScriptScoreQuery

MinScore sets the minimum score.

func (*ScriptScoreQuery) Query

func (q *ScriptScoreQuery) Query(query Query) *ScriptScoreQuery

Query to be used in the ScriptScoreQuery.

func (*ScriptScoreQuery) QueryName

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

QueryName sets the query name for the filter.

func (*ScriptScoreQuery) Script

func (q *ScriptScoreQuery) Script(script *Script) *ScriptScoreQuery

Script to calculate the score.

func (*ScriptScoreQuery) Source

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

Source returns JSON for the function score query.

type ScriptSignificanceHeuristic

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

ScriptSignificanceHeuristic implements a scripted significance heuristic. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-significantterms-aggregation.html#_scripted for details.

func NewScriptSignificanceHeuristic

func NewScriptSignificanceHeuristic() *ScriptSignificanceHeuristic

NewScriptSignificanceHeuristic initializes a new instance of ScriptSignificanceHeuristic.

func (*ScriptSignificanceHeuristic) Name

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

func (*ScriptSignificanceHeuristic) Script

Script specifies the script to use to get custom scores. The following parameters are available in the script: `_subset_freq`, `_superset_freq`, `_subset_size`, and `_superset_size`.

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

func (*ScriptSignificanceHeuristic) Source

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

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

type ScriptSort

type ScriptSort struct {
	Sorter
	// contains filtered or unexported fields
}

ScriptSort sorts by a custom script. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/modules-scripting.html#modules-scripting for details about scripting.

func NewScriptSort

func NewScriptSort(script *Script, typ string) *ScriptSort

NewScriptSort creates and initializes a new ScriptSort. You must provide a script and a type, e.g. "string" or "number".

func (*ScriptSort) Asc

func (s *ScriptSort) Asc() *ScriptSort

Asc sets ascending sort order.

func (*ScriptSort) Desc

func (s *ScriptSort) Desc() *ScriptSort

Desc sets descending sort order.

func (*ScriptSort) NestedFilter

func (s *ScriptSort) NestedFilter(nestedFilter Query) *ScriptSort

NestedFilter sets a filter that nested objects should match with in order to be taken into account for sorting.

func (*ScriptSort) NestedPath

func (s *ScriptSort) NestedPath(nestedPath string) *ScriptSort

NestedPath is used if sorting occurs on a field that is inside a nested object.

func (*ScriptSort) NestedSort

func (s *ScriptSort) NestedSort(nestedSort *NestedSort) *ScriptSort

NestedSort is available starting with 6.1 and will replace NestedFilter and NestedPath.

func (*ScriptSort) Order

func (s *ScriptSort) Order(ascending bool) *ScriptSort

Order defines whether sorting ascending (default) or descending.

func (*ScriptSort) SortMode

func (s *ScriptSort) SortMode(sortMode string) *ScriptSort

SortMode specifies what values to pick in case a document contains multiple values for the targeted sort field. Possible values are: min or max.

func (*ScriptSort) Source

func (s *ScriptSort) Source() (interface{}, error)

Source returns the JSON-serializable data.

func (*ScriptSort) Type

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

Type sets the script type, which can be either "string" or "number".

type ScriptedMetricAggregation

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

ScriptedMetricAggregation is a a metric aggregation that executes using scripts to provide a metric output.

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

func NewScriptedMetricAggregation

func NewScriptedMetricAggregation() *ScriptedMetricAggregation

func (*ScriptedMetricAggregation) CombineScript

func (a *ScriptedMetricAggregation) CombineScript(script *Script) *ScriptedMetricAggregation

func (*ScriptedMetricAggregation) InitScript

func (*ScriptedMetricAggregation) MapScript

func (*ScriptedMetricAggregation) Meta

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

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

func (*ScriptedMetricAggregation) Params

func (a *ScriptedMetricAggregation) Params(params map[string]interface{}) *ScriptedMetricAggregation

func (*ScriptedMetricAggregation) ReduceScript

func (*ScriptedMetricAggregation) Source

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

type SearchExplanation

type SearchExplanation struct {
	Value       float64             `json:"value"`             // e.g. 1.0
	Description string              `json:"description"`       // e.g. "boost" or "ConstantScore(*:*), product of:"
	Details     []SearchExplanation `json:"details,omitempty"` // recursive details
}

SearchExplanation explains how the score for a hit was computed. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-explain.html.

type SearchHit

type SearchHit struct {
	Score          *float64                       `json:"_score,omitempty"`   // computed score
	Index          string                         `json:"_index,omitempty"`   // index name
	Type           string                         `json:"_type,omitempty"`    // type meta field
	Id             string                         `json:"_id,omitempty"`      // external or internal
	Uid            string                         `json:"_uid,omitempty"`     // uid meta field (see MapperService.java for all meta fields)
	Routing        string                         `json:"_routing,omitempty"` // routing meta field
	Parent         string                         `json:"_parent,omitempty"`  // parent meta field
	Version        *int64                         `json:"_version,omitempty"` // version number, when Version is set to true in SearchService
	SeqNo          *int64                         `json:"_seq_no"`
	PrimaryTerm    *int64                         `json:"_primary_term"`
	Sort           []interface{}                  `json:"sort,omitempty"`            // sort information
	Highlight      SearchHitHighlight             `json:"highlight,omitempty"`       // highlighter information
	Source         json.RawMessage                `json:"_source,omitempty"`         // stored document source
	Fields         SearchHitFields                `json:"fields,omitempty"`          // returned (stored) fields
	Explanation    *SearchExplanation             `json:"_explanation,omitempty"`    // explains how the score was computed
	MatchedQueries []string                       `json:"matched_queries,omitempty"` // matched queries
	InnerHits      map[string]*SearchHitInnerHits `json:"inner_hits,omitempty"`      // inner hits with ES >= 1.5.0
	Nested         *NestedHit                     `json:"_nested,omitempty"`         // for nested inner hits
	Shard          string                         `json:"_shard,omitempty"`          // used e.g. in Search Explain
	Node           string                         `json:"_node,omitempty"`           // used e.g. in Search Explain
}

SearchHit is a single hit.

type SearchHitFields

type SearchHitFields map[string]interface{}

SearchHitFields helps to simplify resolving slices of specific types.

func (SearchHitFields) Float64s

func (f SearchHitFields) Float64s(fieldName string) ([]float64, bool)

Float64s returns a slice of float64's for the given field, if there is any such field in the hit. The method ignores elements that are not of type float64.

func (SearchHitFields) Strings

func (f SearchHitFields) Strings(fieldName string) ([]string, bool)

Strings returns a slice of strings for the given field, if there is any such field in the hit. The method ignores elements that are not of type string.

type SearchHitHighlight

type SearchHitHighlight map[string][]string

SearchHitHighlight is the highlight information of a search hit. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-highlighting.html for a general discussion of highlighting.

type SearchHitInnerHits

type SearchHitInnerHits struct {
	Hits *SearchHits `json:"hits,omitempty"`
}

SearchHitInnerHits is used for inner hits.

type SearchHits

type SearchHits struct {
	TotalHits *TotalHits   `json:"total,omitempty"`     // total number of hits found
	MaxScore  *float64     `json:"max_score,omitempty"` // maximum score of all hits
	Hits      []*SearchHit `json:"hits,omitempty"`      // the actual hits returned
}

SearchHits specifies the list of search hits.

type SearchProfile

type SearchProfile struct {
	Shards []SearchProfileShardResult `json:"shards"`
}

SearchProfile is a list of shard profiling data collected during query execution in the "profile" section of a SearchResult

type SearchProfileShardResult

type SearchProfileShardResult struct {
	ID           string                    `json:"id"`
	Searches     []QueryProfileShardResult `json:"searches"`
	Aggregations []ProfileResult           `json:"aggregations"`
	Fetch        *ProfileResult            `json:"fetch"`
}

SearchProfileShardResult returns the profiling data for a single shard accessed during the search query or aggregation.

type SearchRequest

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

SearchRequest combines a search request and its query details (see SearchSource). It is used in combination with MultiSearch.

func NewSearchRequest

func NewSearchRequest() *SearchRequest

NewSearchRequest creates a new search request.

func (*SearchRequest) Aggregation

func (r *SearchRequest) Aggregation(name string, aggregation Aggregation) *SearchRequest

Aggregation adds an aggreation to perform as part of the search.

func (*SearchRequest) AllowNoIndices

func (s *SearchRequest) AllowNoIndices(allowNoIndices bool) *SearchRequest

AllowNoIndices indicates whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).

func (*SearchRequest) AllowPartialSearchResults

func (r *SearchRequest) AllowPartialSearchResults(allow bool) *SearchRequest

AllowPartialSearchResults indicates if this request should allow partial results. (If method is not called, will default to the cluster level setting).

func (*SearchRequest) BatchedReduceSize

func (r *SearchRequest) BatchedReduceSize(size int) *SearchRequest

BatchedReduceSize specifies the number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.

func (*SearchRequest) Body

func (r *SearchRequest) Body() (string, error)

Body allows to access the search body of the request, as generated by the DSL. Notice that Body is read-only. You must not change the request body.

Body is used e.g. by MultiSearch to get information about the search body of one SearchRequest. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-multi-search.html

func (*SearchRequest) ClearRescorers

func (r *SearchRequest) ClearRescorers() *SearchRequest

ClearRescorers removes all rescorers from the search.

func (*SearchRequest) Collapse

func (r *SearchRequest) Collapse(collapse *CollapseBuilder) *SearchRequest

Collapse adds field collapsing.

func (*SearchRequest) DocValueField

func (r *SearchRequest) DocValueField(field string) *SearchRequest

DocValueField adds a docvalue based field to load and return. The field does not have to be stored, but it's recommended to use non analyzed or numeric fields.

func (*SearchRequest) DocValueFieldWithFormat

func (r *SearchRequest) DocValueFieldWithFormat(field DocvalueField) *SearchRequest

DocValueFieldWithFormat adds a docvalue based field to load and return. The field does not have to be stored, but it's recommended to use non analyzed or numeric fields.

func (*SearchRequest) DocValueFields

func (r *SearchRequest) DocValueFields(fields ...string) *SearchRequest

DocValueFields adds one or more docvalue based field to load and return. The fields do not have to be stored, but it's recommended to use non analyzed or numeric fields.

func (*SearchRequest) DocValueFieldsWithFormat

func (r *SearchRequest) DocValueFieldsWithFormat(fields ...DocvalueField) *SearchRequest

DocValueFieldsWithFormat adds one or more docvalue based field to load and return. The fields do not have to be stored, but it's recommended to use non analyzed or numeric fields.

func (*SearchRequest) ExpandWildcards

func (s *SearchRequest) ExpandWildcards(expandWildcards string) *SearchRequest

ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.

func (*SearchRequest) Explain

func (r *SearchRequest) Explain(explain bool) *SearchRequest

Explain indicates whether to return an explanation for each hit.

func (*SearchRequest) FetchSource

func (r *SearchRequest) FetchSource(fetchSource bool) *SearchRequest

FetchSource indicates whether the response should contain the stored _source for every hit.

func (*SearchRequest) FetchSourceContext

func (r *SearchRequest) FetchSourceContext(fsc *FetchSourceContext) *SearchRequest

FetchSourceContext indicates how the _source should be fetched.

func (*SearchRequest) FetchSourceIncludeExclude

func (r *SearchRequest) FetchSourceIncludeExclude(include, exclude []string) *SearchRequest

FetchSourceIncludeExclude specifies that _source should be returned with each hit, where "include" and "exclude" serve as a simple wildcard matcher that gets applied to its fields (e.g. include := []string{"obj1.*","obj2.*"}, exclude := []string{"description.*"}).

func (*SearchRequest) From

func (r *SearchRequest) From(from int) *SearchRequest

From index to start search from (default is 0).

func (*SearchRequest) HasIndices

func (r *SearchRequest) HasIndices() bool

HasIndices returns true if there are indices used, false otherwise.

func (*SearchRequest) Highlight

func (r *SearchRequest) Highlight(highlight *Highlight) *SearchRequest

Highlight adds highlighting to the search.

func (*SearchRequest) IgnoreUnavailable

func (s *SearchRequest) IgnoreUnavailable(ignoreUnavailable bool) *SearchRequest

IgnoreUnavailable indicates whether specified concrete indices should be ignored when unavailable (missing or closed).

func (*SearchRequest) Index

func (r *SearchRequest) Index(indices ...string) *SearchRequest

Index specifies the indices to use in the request.

func (*SearchRequest) IndexBoost

func (r *SearchRequest) IndexBoost(index string, boost float64) *SearchRequest

IndexBoost sets a boost a specific index will receive when the query is executed against it.

func (*SearchRequest) MaxConcurrentShardRequests

func (r *SearchRequest) MaxConcurrentShardRequests(size int) *SearchRequest

MaxConcurrentShardRequests sets the number of shard requests that should be executed concurrently. This value should be used as a protection mechanism to reduce the number of shard requests fired per high level search request. Searches that hit the entire cluster can be throttled with this number to reduce the cluster load. The default grows with the number of nodes in the cluster but is at most 256.

func (*SearchRequest) MinScore

func (r *SearchRequest) MinScore(minScore float64) *SearchRequest

MinScore below which documents are filtered out.

func (*SearchRequest) NoStoredFields

func (r *SearchRequest) NoStoredFields() *SearchRequest

NoStoredFields indicates that no fields should be loaded, resulting in only id and type to be returned per field.

func (*SearchRequest) PointInTime

func (s *SearchRequest) PointInTime(pointInTime *PointInTime) *SearchRequest

PointInTime specifies an optional PointInTime to be used in the context of this search.

func (*SearchRequest) PostFilter

func (r *SearchRequest) PostFilter(filter Query) *SearchRequest

PostFilter is a filter that will be executed after the query has been executed and only has affect on the search hits (not aggregations). This filter is always executed as last filtering mechanism.

func (*SearchRequest) PreFilterShardSize

func (r *SearchRequest) PreFilterShardSize(size int) *SearchRequest

PreFilterShardSize sets a threshold that enforces a pre-filter roundtrip to pre-filter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. The default is 128.

func (*SearchRequest) Preference

func (r *SearchRequest) Preference(preference string) *SearchRequest

Preference to execute the search. Defaults to randomize across shards. Can be set to "_local" to prefer local shards, "_primary" to execute only on primary shards, or a custom value, which guarantees that the same order will be used across different requests.

func (*SearchRequest) Profile

func (r *SearchRequest) Profile(profile bool) *SearchRequest

Profile specifies that this search source should activate the Profile API for queries made on it.

func (*SearchRequest) Query

func (r *SearchRequest) Query(query Query) *SearchRequest

Query for the search.

func (*SearchRequest) RequestCache

func (r *SearchRequest) RequestCache(requestCache bool) *SearchRequest

RequestCache specifies if this request should use the request cache or not, assuming that it can. By default, will default to the index level setting if request cache is enabled or not.

func (*SearchRequest) Rescorer

func (r *SearchRequest) Rescorer(rescore *Rescore) *SearchRequest

Rescorer adds a rescorer to the search.

func (*SearchRequest) Routing

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

Routing specifies the routing parameter. It is a comma-separated list.

func (*SearchRequest) Routings

func (r *SearchRequest) Routings(routings ...string) *SearchRequest

Routings to be used in the request.

func (*SearchRequest) ScriptField

func (r *SearchRequest) ScriptField(field *ScriptField) *SearchRequest

ScriptField adds a script based field to load and return. The field does not have to be stored, but it's recommended to use non analyzed or numeric fields.

func (*SearchRequest) ScriptFields

func (r *SearchRequest) ScriptFields(fields ...*ScriptField) *SearchRequest

ScriptFields adds one or more script based field to load and return. The fields do not have to be stored, but it's recommended to use non analyzed or numeric fields.

func (*SearchRequest) Scroll

func (r *SearchRequest) Scroll(scroll string) *SearchRequest

Scroll, if set, will enable scrolling of the search request. Pass a timeout value, e.g. "2m" or "30s" as a value.

func (*SearchRequest) SearchAfter

func (r *SearchRequest) SearchAfter(sortValues ...interface{}) *SearchRequest

SearchAfter sets the sort values that indicates which docs this request should "search after".

func (*SearchRequest) SearchSource

func (r *SearchRequest) SearchSource(searchSource *SearchSource) *SearchRequest

SearchSource allows passing your own SearchSource, overriding all values set on the request (except Source).

func (*SearchRequest) SearchType

func (r *SearchRequest) SearchType(searchType string) *SearchRequest

SearchType must be one of "dfs_query_then_fetch", "dfs_query_and_fetch", "query_then_fetch", or "query_and_fetch".

func (*SearchRequest) SearchTypeDfsQueryThenFetch

func (r *SearchRequest) SearchTypeDfsQueryThenFetch() *SearchRequest

SearchTypeDfsQueryThenFetch sets search type to "dfs_query_then_fetch".

func (*SearchRequest) SearchTypeQueryThenFetch

func (r *SearchRequest) SearchTypeQueryThenFetch() *SearchRequest

SearchTypeQueryThenFetch sets search type to "query_then_fetch".

func (*SearchRequest) Size

func (r *SearchRequest) Size(size int) *SearchRequest

Size is the number of search hits to return (default is 10).

func (*SearchRequest) Slice

func (r *SearchRequest) Slice(sliceQuery Query) *SearchRequest

Slice allows partitioning the documents in multiple slices. It is e.g. used to slice a scroll operation, supported in Elasticsearch 5.0 or later. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-scroll.html#sliced-scroll for details.

func (*SearchRequest) Sort

func (r *SearchRequest) Sort(field string, ascending bool) *SearchRequest

Sort adds a sort order.

func (*SearchRequest) SortBy

func (r *SearchRequest) SortBy(sorter ...Sorter) *SearchRequest

SortBy adds a sort order.

func (*SearchRequest) SortWithInfo

func (r *SearchRequest) SortWithInfo(info SortInfo) *SearchRequest

SortWithInfo adds a sort order.

func (*SearchRequest) Source

func (r *SearchRequest) Source(source interface{}) *SearchRequest

Source allows passing your own request body. It will have preference over all other properties set on the request.

func (*SearchRequest) Stats

func (r *SearchRequest) Stats(statsGroup ...string) *SearchRequest

Stats groups that this request will be aggregated under.

func (*SearchRequest) StoredField

func (r *SearchRequest) StoredField(field string) *SearchRequest

StoredField adds a stored field to load and return (note, it must be stored) as part of the search request.

func (*SearchRequest) StoredFields

func (r *SearchRequest) StoredFields(fields ...string) *SearchRequest

StoredFields adds one or more stored field to load and return (note, they must be stored) as part of the search request.

func (*SearchRequest) Suggester

func (r *SearchRequest) Suggester(suggester Suggester) *SearchRequest

Suggester adds a suggester to the search.

func (*SearchRequest) TerminateAfter

func (r *SearchRequest) TerminateAfter(docs int) *SearchRequest

TerminateAfter, when set, specifies an optional document count, upon collecting which the search query will terminate early.

func (*SearchRequest) Timeout

func (r *SearchRequest) Timeout(timeout string) *SearchRequest

Timeout value for the request, e.g. "30s" or "2m".

func (*SearchRequest) TrackScores

func (r *SearchRequest) TrackScores(trackScores bool) *SearchRequest

TrackScores is applied when sorting and controls if scores will be tracked as well. Defaults to false.

func (*SearchRequest) TrackTotalHits

func (r *SearchRequest) TrackTotalHits(trackTotalHits interface{}) *SearchRequest

TrackTotalHits indicates if the total hit count for the query should be tracked. Defaults to true.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-track-total-hits.html for details.

func (*SearchRequest) Type deprecated

func (r *SearchRequest) Type(types ...string) *SearchRequest

Type specifies one or more types to be used.

Deprecated: Types are in the process of being removed. Instead of using a type, prefer to filter on a field on the document.

func (*SearchRequest) Version

func (r *SearchRequest) Version(version bool) *SearchRequest

Version indicates whether each hit should be returned with its version.

type SearchResult

type SearchResult struct {
	Header          http.Header          `json:"-"`
	TookInMillis    int64                `json:"took,omitempty"`             // search time in milliseconds
	TerminatedEarly bool                 `json:"terminated_early,omitempty"` // request terminated early
	NumReducePhases int                  `json:"num_reduce_phases,omitempty"`
	Clusters        *SearchResultCluster `json:"_clusters,omitempty"`    // 6.1.0+
	ScrollId        string               `json:"_scroll_id,omitempty"`   // only used with Scroll and Scan operations
	Hits            *SearchHits          `json:"hits,omitempty"`         // the actual search hits
	Suggest         SearchSuggest        `json:"suggest,omitempty"`      // results from suggesters
	Aggregations    Aggregations         `json:"aggregations,omitempty"` // results from aggregations
	TimedOut        bool                 `json:"timed_out,omitempty"`    // true if the search timed out
	Error           *ErrorDetails        `json:"error,omitempty"`        // only used in MultiGet
	Profile         *SearchProfile       `json:"profile,omitempty"`      // profiling results, if optional Profile API was active for this search
	Shards          *ShardsInfo          `json:"_shards,omitempty"`      // shard information
	Status          int                  `json:"status,omitempty"`       // used in MultiSearch
	PitId           string               `json:"pit_id,omitempty"`       // Point In Time ID
}

SearchResult is the result of a search in Elasticsearch. FIXME: Is this up-to-date?

func (*SearchResult) Each

func (r *SearchResult) Each(typ reflect.Type) []interface{}

Each is a utility function to iterate over all hits. It saves you from checking for nil values. Notice that Each will ignore errors in serializing JSON and hits with empty/nil _source will get an empty value

func (*SearchResult) TotalHits

func (r *SearchResult) TotalHits() int64

TotalHits is a convenience function to return the number of hits for a search result. The return value might not be accurate, unless track_total_hits parameter has set to true.

type SearchResultCluster

type SearchResultCluster struct {
	Successful int `json:"successful,omitempty"`
	Total      int `json:"total,omitempty"`
	Skipped    int `json:"skipped,omitempty"`
}

SearchResultCluster holds information about a search response from a cluster.

type SearchService

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

Search for documents in Elasticsearch.

func NewSearchService

func NewSearchService() *SearchService

NewSearchService creates a new service for searching in Elasticsearch.

func (*SearchService) Aggregation

func (s *SearchService) Aggregation(name string, aggregation Aggregation) *SearchService

Aggregation adds an aggreation to perform as part of the search.

func (*SearchService) Collapse

func (s *SearchService) Collapse(collapse *CollapseBuilder) *SearchService

Collapse adds field collapsing.

func (*SearchService) DefaultRescoreWindowSize

func (s *SearchService) DefaultRescoreWindowSize(defaultRescoreWindowSize int) *SearchService

DefaultRescoreWindowSize sets the rescore window size for rescores that don't specify their window.

func (*SearchService) DocvalueField

func (s *SearchService) DocvalueField(docvalueField string) *SearchService

DocvalueField adds a single field to load from the field data cache and return as part of the search.

func (*SearchService) DocvalueFieldWithFormat

func (s *SearchService) DocvalueFieldWithFormat(docvalueField DocvalueField) *SearchService

DocvalueFieldWithFormat adds a single field to load from the field data cache and return as part of the search.

func (*SearchService) DocvalueFields

func (s *SearchService) DocvalueFields(docvalueFields ...string) *SearchService

DocvalueFields adds one or more fields to load from the field data cache and return as part of the search.

func (*SearchService) DocvalueFieldsWithFormat

func (s *SearchService) DocvalueFieldsWithFormat(docvalueFields ...DocvalueField) *SearchService

DocvalueFieldsWithFormat adds one or more fields to load from the field data cache and return as part of the search.

func (*SearchService) Explain

func (s *SearchService) Explain(explain bool) *SearchService

Explain indicates whether each search hit should be returned with an explanation of the hit (ranking).

func (*SearchService) FetchSource

func (s *SearchService) FetchSource(fetchSource bool) *SearchService

FetchSource indicates whether the response should contain the stored _source for every hit.

func (*SearchService) FetchSourceContext

func (s *SearchService) FetchSourceContext(fetchSourceContext *FetchSourceContext) *SearchService

FetchSourceContext indicates how the _source should be fetched.

func (*SearchService) From

func (s *SearchService) From(from int) *SearchService

From index to start the search from. Defaults to 0.

func (*SearchService) GlobalSuggestText

func (s *SearchService) GlobalSuggestText(globalText string) *SearchService

GlobalSuggestText defines the global text to use with all suggesters. This avoids repetition.

func (*SearchService) Highlight

func (s *SearchService) Highlight(highlight *Highlight) *SearchService

Highlight adds highlighting to the search.

func (*SearchService) MinScore

func (s *SearchService) MinScore(minScore float64) *SearchService

MinScore sets the minimum score below which docs will be filtered out.

func (*SearchService) NoStoredFields

func (s *SearchService) NoStoredFields() *SearchService

NoStoredFields indicates that no stored fields should be loaded, resulting in only id and type to be returned per field.

func (*SearchService) PointInTime

func (s *SearchService) PointInTime(pointInTime *PointInTime) *SearchService

PointInTime specifies an optional PointInTime to be used in the context of this search.

func (*SearchService) PostFilter

func (s *SearchService) PostFilter(postFilter Query) *SearchService

PostFilter will be executed after the query has been executed and only affects the search hits, not the aggregations. This filter is always executed as the last filtering mechanism.

func (*SearchService) Profile

func (s *SearchService) Profile(profile bool) *SearchService

Profile sets the Profile API flag on the search source. When enabled, a search executed by this service will return query profiling data.

func (*SearchService) Query

func (s *SearchService) Query(query Query) *SearchService

Query sets the query to perform, e.g. MatchAllQuery.

func (*SearchService) Rescorer

func (s *SearchService) Rescorer(rescore *Rescore) *SearchService

Rescorer adds a rescorer to the search.

func (*SearchService) RuntimeMappings

func (s *SearchService) RuntimeMappings(runtimeMappings RuntimeMappings) *SearchService

RuntimeMappings specifies optional runtime mappings.

func (*SearchService) SearchAfter

func (s *SearchService) SearchAfter(sortValues ...interface{}) *SearchService

SearchAfter allows a different form of pagination by using a live cursor, using the results of the previous page to help the retrieval of the next.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-search-after.html

func (*SearchService) SearchSource

func (s *SearchService) SearchSource(searchSource *SearchSource) *SearchService

SearchSource sets the search source builder to use with this service.

func (*SearchService) Size

func (s *SearchService) Size(size int) *SearchService

Size is the number of search hits to return. Defaults to 10.

func (*SearchService) Sort

func (s *SearchService) Sort(field string, ascending bool) *SearchService

Sort adds a sort order.

func (*SearchService) SortBy

func (s *SearchService) SortBy(sorter ...Sorter) *SearchService

SortBy adds a sort order.

func (*SearchService) SortWithInfo

func (s *SearchService) SortWithInfo(info SortInfo) *SearchService

SortWithInfo adds a sort order.

func (*SearchService) Source

func (s *SearchService) Source(source interface{}) *SearchService

Source allows the user to set the request body manually without using any of the structs and interfaces in Elastic.

func (*SearchService) StoredField

func (s *SearchService) StoredField(fieldName string) *SearchService

StoredField adds a single field to load and return (note, must be stored) as part of the search request. If none are specified, the source of the document will be returned.

func (*SearchService) StoredFields

func (s *SearchService) StoredFields(fields ...string) *SearchService

StoredFields sets the fields to load and return as part of the search request. If none are specified, the source of the document will be returned.

func (*SearchService) Suggester

func (s *SearchService) Suggester(suggester Suggester) *SearchService

Suggester adds a suggester to the search.

func (*SearchService) TerminateAfter

func (s *SearchService) TerminateAfter(terminateAfter int) *SearchService

TerminateAfter specifies the maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.

func (*SearchService) Timeout

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

Timeout sets the timeout to use, e.g. "1s" or "1000ms".

func (*SearchService) TimeoutInMillis

func (s *SearchService) TimeoutInMillis(timeoutInMillis int) *SearchService

TimeoutInMillis sets the timeout in milliseconds.

func (*SearchService) TrackScores

func (s *SearchService) TrackScores(trackScores bool) *SearchService

TrackScores is applied when sorting and controls if scores will be tracked as well. Defaults to false.

func (*SearchService) TrackTotalHits

func (s *SearchService) TrackTotalHits(trackTotalHits interface{}) *SearchService

TrackTotalHits controls if the total hit count for the query should be tracked.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.1/search-request-track-total-hits.html for details.

func (*SearchService) Version

func (s *SearchService) Version(version bool) *SearchService

Version indicates whether each search hit should be returned with a version associated to it.

type SearchShardsService

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

SearchShardsService returns the indices and shards that a search request would be executed against. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-shards.html

func (*SearchShardsService) AllowNoIndices

func (s *SearchShardsService) AllowNoIndices(allowNoIndices bool) *SearchShardsService

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 (*SearchShardsService) ErrorTrace

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

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

func (*SearchShardsService) ExpandWildcards

func (s *SearchShardsService) ExpandWildcards(expandWildcards string) *SearchShardsService

ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.

func (*SearchShardsService) FilterPath

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

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

func (*SearchShardsService) Header

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

Header adds a header to the request.

func (*SearchShardsService) Headers

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

Headers specifies the headers of the request.

func (*SearchShardsService) Human

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

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

func (*SearchShardsService) IgnoreUnavailable

func (s *SearchShardsService) IgnoreUnavailable(ignoreUnavailable bool) *SearchShardsService

IgnoreUnavailable indicates whether the specified concrete indices should be ignored when unavailable (missing or closed).

func (*SearchShardsService) Index

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

Index sets the names of the indices to restrict the results.

func (*SearchShardsService) Local

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

A boolean value whether to read the cluster state locally in order to determine where shards are allocated instead of using the Master node’s cluster state.

func (*SearchShardsService) Preference

func (s *SearchShardsService) Preference(preference string) *SearchShardsService

Preference specifies the node or shard the operation should be performed on (default: random).

func (*SearchShardsService) Pretty

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

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*SearchShardsService) Routing

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

Routing sets a specific routing value.

type SearchSource

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

SearchSource enables users to build the search source. It resembles the SearchSourceBuilder in Elasticsearch.

func NewSearchSource

func NewSearchSource() *SearchSource

NewSearchSource initializes a new SearchSource.

func (*SearchSource) Aggregation

func (s *SearchSource) Aggregation(name string, aggregation Aggregation) *SearchSource

Aggregation adds an aggreation to perform as part of the search.

func (*SearchSource) ClearRescorers

func (s *SearchSource) ClearRescorers() *SearchSource

ClearRescorers removes all rescorers from the search.

func (*SearchSource) Collapse

func (s *SearchSource) Collapse(collapse *CollapseBuilder) *SearchSource

Collapse adds field collapsing.

func (*SearchSource) DefaultRescoreWindowSize

func (s *SearchSource) DefaultRescoreWindowSize(defaultRescoreWindowSize int) *SearchSource

DefaultRescoreWindowSize sets the rescore window size for rescores that don't specify their window.

func (*SearchSource) DocvalueField

func (s *SearchSource) DocvalueField(fieldDataField string) *SearchSource

DocvalueField adds a single field to load from the field data cache and return as part of the search request.

func (*SearchSource) DocvalueFieldWithFormat

func (s *SearchSource) DocvalueFieldWithFormat(fieldDataFieldWithFormat DocvalueField) *SearchSource

DocvalueField adds a single docvalue field to load from the field data cache and return as part of the search request.

func (*SearchSource) DocvalueFields

func (s *SearchSource) DocvalueFields(docvalueFields ...string) *SearchSource

DocvalueFields adds one or more fields to load from the field data cache and return as part of the search request.

func (*SearchSource) DocvalueFieldsWithFormat

func (s *SearchSource) DocvalueFieldsWithFormat(docvalueFields ...DocvalueField) *SearchSource

DocvalueFields adds one or more docvalue fields to load from the field data cache and return as part of the search request.

func (*SearchSource) Explain

func (s *SearchSource) Explain(explain bool) *SearchSource

Explain indicates whether each search hit should be returned with an explanation of the hit (ranking).

func (*SearchSource) FetchSource

func (s *SearchSource) FetchSource(fetchSource bool) *SearchSource

FetchSource indicates whether the response should contain the stored _source for every hit.

func (*SearchSource) FetchSourceContext

func (s *SearchSource) FetchSourceContext(fetchSourceContext *FetchSourceContext) *SearchSource

FetchSourceContext indicates how the _source should be fetched.

func (*SearchSource) FetchSourceIncludeExclude

func (s *SearchSource) FetchSourceIncludeExclude(include, exclude []string) *SearchSource

FetchSourceIncludeExclude specifies that _source should be returned with each hit, where "include" and "exclude" serve as a simple wildcard matcher that gets applied to its fields (e.g. include := []string{"obj1.*","obj2.*"}, exclude := []string{"description.*"}).

func (*SearchSource) From

func (s *SearchSource) From(from int) *SearchSource

From index to start the search from. Defaults to 0.

func (*SearchSource) GlobalSuggestText

func (s *SearchSource) GlobalSuggestText(text string) *SearchSource

GlobalSuggestText defines the global text to use with all suggesters. This avoids repetition.

func (*SearchSource) Highlight

func (s *SearchSource) Highlight(highlight *Highlight) *SearchSource

Highlight adds highlighting to the search.

func (*SearchSource) Highlighter

func (s *SearchSource) Highlighter() *Highlight

Highlighter returns the highlighter.

func (*SearchSource) IndexBoost

func (s *SearchSource) IndexBoost(index string, boost float64) *SearchSource

IndexBoost sets the boost that a specific index will receive when the query is executed against it.

func (*SearchSource) IndexBoosts

func (s *SearchSource) IndexBoosts(boosts ...IndexBoost) *SearchSource

IndexBoosts sets the boosts for specific indices.

func (*SearchSource) InnerHit

func (s *SearchSource) InnerHit(name string, innerHit *InnerHit) *SearchSource

InnerHit adds an inner hit to return with the result.

func (*SearchSource) MarshalJSON

func (q *SearchSource) MarshalJSON() ([]byte, error)

MarshalJSON enables serializing the type as JSON.

func (*SearchSource) MinScore

func (s *SearchSource) MinScore(minScore float64) *SearchSource

MinScore sets the minimum score below which docs will be filtered out.

func (*SearchSource) NoStoredFields

func (s *SearchSource) NoStoredFields() *SearchSource

NoStoredFields indicates that no fields should be loaded, resulting in only id and type to be returned per field.

func (*SearchSource) PointInTime

func (s *SearchSource) PointInTime(pointInTime *PointInTime) *SearchSource

PointInTime specifies an optional PointInTime to be used in the context of this search.

func (*SearchSource) PostFilter

func (s *SearchSource) PostFilter(postFilter Query) *SearchSource

PostFilter will be executed after the query has been executed and only affects the search hits, not the aggregations. This filter is always executed as the last filtering mechanism.

func (*SearchSource) Profile

func (s *SearchSource) Profile(profile bool) *SearchSource

Profile specifies that this search source should activate the Profile API for queries made on it.

func (*SearchSource) Query

func (s *SearchSource) Query(query Query) *SearchSource

Query sets the query to use with this search source.

func (*SearchSource) Rescorer

func (s *SearchSource) Rescorer(rescore *Rescore) *SearchSource

Rescorer adds a rescorer to the search.

func (*SearchSource) RuntimeMappings

func (s *SearchSource) RuntimeMappings(runtimeMappings RuntimeMappings) *SearchSource

RuntimeMappings specifies optional runtime mappings.

func (*SearchSource) ScriptField

func (s *SearchSource) ScriptField(scriptField *ScriptField) *SearchSource

ScriptField adds a single script field with the provided script.

func (*SearchSource) ScriptFields

func (s *SearchSource) ScriptFields(scriptFields ...*ScriptField) *SearchSource

ScriptFields adds one or more script fields with the provided scripts.

func (*SearchSource) SearchAfter

func (s *SearchSource) SearchAfter(sortValues ...interface{}) *SearchSource

SearchAfter allows a different form of pagination by using a live cursor, using the results of the previous page to help the retrieval of the next.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-search-after.html

func (*SearchSource) SeqNoAndPrimaryTerm

func (s *SearchSource) SeqNoAndPrimaryTerm(enabled bool) *SearchSource

SeqNoAndPrimaryTerm indicates whether SearchHits should be returned with the sequence number and primary term of the last modification of the document.

func (*SearchSource) Size

func (s *SearchSource) Size(size int) *SearchSource

Size is the number of search hits to return. Defaults to 10.

func (*SearchSource) Slice

func (s *SearchSource) Slice(sliceQuery Query) *SearchSource

Slice allows partitioning the documents in multiple slices. It is e.g. used to slice a scroll operation, supported in Elasticsearch 5.0 or later. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-scroll.html#sliced-scroll for details.

func (*SearchSource) Sort

func (s *SearchSource) Sort(field string, ascending bool) *SearchSource

Sort adds a sort order.

func (*SearchSource) SortBy

func (s *SearchSource) SortBy(sorter ...Sorter) *SearchSource

SortBy adds a sort order.

func (*SearchSource) SortWithInfo

func (s *SearchSource) SortWithInfo(info SortInfo) *SearchSource

SortWithInfo adds a sort order.

func (*SearchSource) Source

func (s *SearchSource) Source() (interface{}, error)

Source returns the serializable JSON for the source builder.

func (*SearchSource) Stats

func (s *SearchSource) Stats(statsGroup ...string) *SearchSource

Stats group this request will be aggregated under.

func (*SearchSource) StoredField

func (s *SearchSource) StoredField(storedFieldName string) *SearchSource

StoredField adds a single field to load and return (note, must be stored) as part of the search request. If none are specified, the source of the document will be returned.

func (*SearchSource) StoredFields

func (s *SearchSource) StoredFields(storedFieldNames ...string) *SearchSource

StoredFields sets the fields to load and return as part of the search request. If none are specified, the source of the document will be returned.

func (*SearchSource) Suggester

func (s *SearchSource) Suggester(suggester Suggester) *SearchSource

Suggester adds a suggester to the search.

func (*SearchSource) TerminateAfter

func (s *SearchSource) TerminateAfter(terminateAfter int) *SearchSource

TerminateAfter specifies the maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.

func (*SearchSource) Timeout

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

Timeout controls how long a search is allowed to take, e.g. "1s" or "500ms".

func (*SearchSource) TimeoutInMillis

func (s *SearchSource) TimeoutInMillis(timeoutInMillis int) *SearchSource

TimeoutInMillis controls how many milliseconds a search is allowed to take before it is canceled.

func (*SearchSource) TrackScores

func (s *SearchSource) TrackScores(trackScores bool) *SearchSource

TrackScores is applied when sorting and controls if scores will be tracked as well. Defaults to false.

func (*SearchSource) TrackTotalHits

func (s *SearchSource) TrackTotalHits(trackTotalHits interface{}) *SearchSource

TrackTotalHits controls how the total number of hits should be tracked. Defaults to 10000 which will count the total hit accurately up to 10,000 hits.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-track-total-hits.html for details.

func (*SearchSource) Version

func (s *SearchSource) Version(version bool) *SearchSource

Version indicates whether each search hit should be returned with a version associated to it.

type SearchSuggest

type SearchSuggest map[string][]SearchSuggestion

SearchSuggest is a map of suggestions. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-suggesters.html.

type SearchSuggestion

type SearchSuggestion struct {
	Text    string                   `json:"text"`
	Offset  int                      `json:"offset"`
	Length  int                      `json:"length"`
	Options []SearchSuggestionOption `json:"options"`
}

SearchSuggestion is a single search suggestion. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-suggesters.html.

type SearchSuggestionOption

type SearchSuggestionOption struct {
	Text            string              `json:"text"`
	Index           string              `json:"_index"`
	Type            string              `json:"_type"`
	Id              string              `json:"_id"`
	Score           float64             `json:"score"`  // term and phrase suggesters uses "score" as of 6.2.4
	ScoreUnderscore float64             `json:"_score"` // completion and context suggesters uses "_score" as of 6.2.4
	Highlighted     string              `json:"highlighted"`
	CollateMatch    bool                `json:"collate_match"`
	Freq            int                 `json:"freq"` // from TermSuggestion.Option in Java API
	Source          json.RawMessage     `json:"_source"`
	Contexts        map[string][]string `json:"contexts,omitempty"`
}

SearchSuggestionOption is an option of a SearchSuggestion. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-suggesters.html.

type SerialDiffAggregation

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

SerialDiffAggregation implements serial differencing. Serial differencing is a technique where values in a time series are subtracted from itself at different time lags or periods.

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

func NewSerialDiffAggregation

func NewSerialDiffAggregation() *SerialDiffAggregation

NewSerialDiffAggregation creates and initializes a new SerialDiffAggregation.

func (*SerialDiffAggregation) BucketsPath

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

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

func (*SerialDiffAggregation) Format

Format to use on the output of this aggregation.

func (*SerialDiffAggregation) GapInsertZeros

func (a *SerialDiffAggregation) GapInsertZeros() *SerialDiffAggregation

GapInsertZeros inserts zeros for gaps in the series.

func (*SerialDiffAggregation) GapPolicy

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

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 (*SerialDiffAggregation) GapSkip

GapSkip skips gaps in the series.

func (*SerialDiffAggregation) Lag

Lag specifies the historical bucket to subtract from the current value. E.g. a lag of 7 will subtract the current value from the value 7 buckets ago. Lag must be a positive, non-zero integer.

func (*SerialDiffAggregation) Meta

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

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

func (*SerialDiffAggregation) Source

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

Source returns the a JSON-serializable interface.

type ShardOperationFailedException

type ShardOperationFailedException struct {
	Shard  int                    `json:"shard,omitempty"`
	Index  string                 `json:"index,omitempty"`
	Status string                 `json:"status,omitempty"`
	Reason map[string]interface{} `json:"reason,omitempty"`

	// TODO(oe) Do we still have those?
	Node string `json:"_node,omitempty"`
	// TODO(oe) Do we still have those?
	Primary bool `json:"primary,omitempty"`
}

type ShardsInfo

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

ShardsInfo represents information from a shard.

type SignificanceHeuristic

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

type SignificantTermsAggregation

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

SignificantTermsAggregation is an aggregation that returns interesting or unusual occurrences of terms in a set. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-significantterms-aggregation.html

func NewSignificantTermsAggregation

func NewSignificantTermsAggregation() *SignificantTermsAggregation

func (*SignificantTermsAggregation) BackgroundFilter

func (a *SignificantTermsAggregation) BackgroundFilter(filter Query) *SignificantTermsAggregation

func (*SignificantTermsAggregation) Exclude

func (*SignificantTermsAggregation) ExcludeValues

func (a *SignificantTermsAggregation) ExcludeValues(values ...interface{}) *SignificantTermsAggregation

func (*SignificantTermsAggregation) ExecutionHint

func (*SignificantTermsAggregation) Field

func (*SignificantTermsAggregation) Include

func (*SignificantTermsAggregation) IncludeExclude

func (*SignificantTermsAggregation) IncludeValues

func (a *SignificantTermsAggregation) IncludeValues(values ...interface{}) *SignificantTermsAggregation

func (*SignificantTermsAggregation) Meta

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

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

func (*SignificantTermsAggregation) MinDocCount

func (a *SignificantTermsAggregation) MinDocCount(minDocCount int) *SignificantTermsAggregation

func (*SignificantTermsAggregation) NumPartitions

func (*SignificantTermsAggregation) Partition

func (*SignificantTermsAggregation) RequiredSize

func (a *SignificantTermsAggregation) RequiredSize(requiredSize int) *SignificantTermsAggregation

func (*SignificantTermsAggregation) ShardMinDocCount

func (a *SignificantTermsAggregation) ShardMinDocCount(shardMinDocCount int) *SignificantTermsAggregation

func (*SignificantTermsAggregation) ShardSize

func (*SignificantTermsAggregation) SignificanceHeuristic

func (*SignificantTermsAggregation) Source

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

func (*SignificantTermsAggregation) SubAggregation

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

type SignificantTextAggregation

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

SignificantTextAggregation returns interesting or unusual occurrences of free-text terms in a set. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-significanttext-aggregation.html

func NewSignificantTextAggregation

func NewSignificantTextAggregation() *SignificantTextAggregation

func (*SignificantTextAggregation) BackgroundFilter

func (a *SignificantTextAggregation) BackgroundFilter(filter Query) *SignificantTextAggregation

func (*SignificantTextAggregation) Exclude

func (*SignificantTextAggregation) ExcludeValues

func (a *SignificantTextAggregation) ExcludeValues(values ...interface{}) *SignificantTextAggregation

func (*SignificantTextAggregation) Field

func (*SignificantTextAggregation) FilterDuplicateText

func (a *SignificantTextAggregation) FilterDuplicateText(filter bool) *SignificantTextAggregation

func (*SignificantTextAggregation) Include

func (*SignificantTextAggregation) IncludeExclude

func (*SignificantTextAggregation) IncludeValues

func (a *SignificantTextAggregation) IncludeValues(values ...interface{}) *SignificantTextAggregation

func (*SignificantTextAggregation) Meta

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

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

func (*SignificantTextAggregation) MinDocCount

func (a *SignificantTextAggregation) MinDocCount(minDocCount int64) *SignificantTextAggregation

func (*SignificantTextAggregation) NumPartitions

func (*SignificantTextAggregation) Partition

func (*SignificantTextAggregation) ShardMinDocCount

func (a *SignificantTextAggregation) ShardMinDocCount(shardMinDocCount int64) *SignificantTextAggregation

func (*SignificantTextAggregation) ShardSize

func (*SignificantTextAggregation) SignificanceHeuristic

func (*SignificantTextAggregation) Size

func (*SignificantTextAggregation) Source

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

func (*SignificantTextAggregation) SourceFieldNames

func (a *SignificantTextAggregation) SourceFieldNames(names ...string) *SignificantTextAggregation

func (*SignificantTextAggregation) SubAggregation

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

type SimpleMovAvgModel

type SimpleMovAvgModel struct {
}

SimpleMovAvgModel calculates a simple unweighted (arithmetic) moving average.

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

func NewSimpleMovAvgModel

func NewSimpleMovAvgModel() *SimpleMovAvgModel

NewSimpleMovAvgModel creates and initializes a new SimpleMovAvgModel.

func (*SimpleMovAvgModel) Name

func (m *SimpleMovAvgModel) Name() string

Name of the model.

func (*SimpleMovAvgModel) Settings

func (m *SimpleMovAvgModel) Settings() map[string]interface{}

Settings of the model.

type SimpleQueryStringQuery

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

SimpleQueryStringQuery is a query that uses the SimpleQueryParser to parse its context. Unlike the regular query_string query, the simple_query_string query will never throw an exception, and discards invalid parts of the query.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-simple-query-string-query.html

func NewSimpleQueryStringQuery

func NewSimpleQueryStringQuery(text string) *SimpleQueryStringQuery

NewSimpleQueryStringQuery creates and initializes a new SimpleQueryStringQuery.

func (*SimpleQueryStringQuery) AnalyzeWildcard

func (q *SimpleQueryStringQuery) AnalyzeWildcard(analyzeWildcard bool) *SimpleQueryStringQuery

AnalyzeWildcard indicates whether to enabled analysis on wildcard and prefix queries.

func (*SimpleQueryStringQuery) Analyzer

func (q *SimpleQueryStringQuery) Analyzer(analyzer string) *SimpleQueryStringQuery

Analyzer specifies the analyzer to use for the query.

func (*SimpleQueryStringQuery) AutoGenerateSynonymsPhraseQuery

func (q *SimpleQueryStringQuery) AutoGenerateSynonymsPhraseQuery(enable bool) *SimpleQueryStringQuery

AutoGenerateSynonymsPhraseQuery indicates whether phrase queries should be automatically generated for multi terms synonyms. Defaults to true.

func (*SimpleQueryStringQuery) Boost

Boost sets the boost for this query.

func (*SimpleQueryStringQuery) DefaultOperator

func (q *SimpleQueryStringQuery) DefaultOperator(defaultOperator string) *SimpleQueryStringQuery

DefaultOperator specifies the default operator for the query.

func (*SimpleQueryStringQuery) Field

Field adds a field to run the query against.

func (*SimpleQueryStringQuery) FieldWithBoost

func (q *SimpleQueryStringQuery) FieldWithBoost(field string, boost float64) *SimpleQueryStringQuery

Field adds a field to run the query against with a specific boost.

func (*SimpleQueryStringQuery) Flags

Flags sets the flags for the query.

func (*SimpleQueryStringQuery) FuzzyMaxExpansions

func (q *SimpleQueryStringQuery) FuzzyMaxExpansions(fuzzyMaxExpansions int) *SimpleQueryStringQuery

FuzzyMaxExpansions defines the number of terms fuzzy queries will expand to.

func (*SimpleQueryStringQuery) FuzzyPrefixLength

func (q *SimpleQueryStringQuery) FuzzyPrefixLength(fuzzyPrefixLength int) *SimpleQueryStringQuery

FuzzyPrefixLength defines the prefix length in fuzzy queries.

func (*SimpleQueryStringQuery) FuzzyTranspositions

func (q *SimpleQueryStringQuery) FuzzyTranspositions(fuzzyTranspositions bool) *SimpleQueryStringQuery

FuzzyTranspositions defines whether to use transpositions in fuzzy queries.

func (*SimpleQueryStringQuery) Lenient

func (q *SimpleQueryStringQuery) Lenient(lenient bool) *SimpleQueryStringQuery

Lenient indicates whether the query string parser should be lenient when parsing field values. It defaults to the index setting and if not set, defaults to false.

func (*SimpleQueryStringQuery) Locale deprecated

Locale to be used in the query.

Deprecated: Decision is now made by the analyzer.

func (*SimpleQueryStringQuery) LowercaseExpandedTerms deprecated

func (q *SimpleQueryStringQuery) LowercaseExpandedTerms(lowercaseExpandedTerms bool) *SimpleQueryStringQuery

LowercaseExpandedTerms indicates whether terms of wildcard, prefix, fuzzy and range queries are automatically lower-cased or not. Default is true.

Deprecated: Decision is now made by the analyzer.

func (*SimpleQueryStringQuery) MinimumShouldMatch

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

MinimumShouldMatch specifies the minimumShouldMatch to apply to the resulting query should that be a Boolean query.

func (*SimpleQueryStringQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit.

func (*SimpleQueryStringQuery) QuoteFieldSuffix

func (q *SimpleQueryStringQuery) QuoteFieldSuffix(quoteFieldSuffix string) *SimpleQueryStringQuery

QuoteFieldSuffix is an optional field name suffix to automatically try and add to the field searched when using quoted text.

func (*SimpleQueryStringQuery) Source

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

Source returns JSON for the query.

type SliceQuery

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

SliceQuery allows to partition the documents into several slices. It is used e.g. to slice scroll operations in Elasticsearch 5.0 or later. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-scroll.html#sliced-scroll for details.

func NewSliceQuery

func NewSliceQuery() *SliceQuery

NewSliceQuery creates a new SliceQuery.

func (*SliceQuery) Field

func (s *SliceQuery) Field(field string) *SliceQuery

Field is the name of the field to slice against (_uid by default).

func (*SliceQuery) Id

func (s *SliceQuery) Id(id int) *SliceQuery

Id is the id of the slice.

func (*SliceQuery) Max

func (s *SliceQuery) Max(max int) *SliceQuery

Max is the maximum number of slices.

func (*SliceQuery) Source

func (s *SliceQuery) Source() (interface{}, error)

Source returns the JSON body.

type SmoothingModel

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

type SortByDoc

type SortByDoc struct {
	Sorter
}

SortByDoc sorts by the "_doc" field, as described in https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-scroll.html.

Example:

ss := elastic.NewSearchSource()
ss = ss.SortBy(elastic.SortByDoc{})

func (SortByDoc) Source

func (s SortByDoc) Source() (interface{}, error)

Source returns the JSON-serializable data.

type SortInfo

type SortInfo struct {
	Sorter
	Field          string
	Ascending      bool
	Missing        interface{}
	IgnoreUnmapped *bool
	UnmappedType   string
	SortMode       string
	NestedFilter   Query // deprecated in 6.1 and replaced by Filter
	Filter         Query
	NestedPath     string // deprecated in 6.1 and replaced by Path
	Path           string
	NestedSort     *NestedSort // deprecated in 6.1 and replaced by Nested
	Nested         *NestedSort
}

SortInfo contains information about sorting a field.

func (SortInfo) Source

func (info SortInfo) Source() (interface{}, error)

type Sorter

type Sorter interface {
	Source() (interface{}, error)
}

Sorter is an interface for sorting strategies, e.g. ScoreSort or FieldSort. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-sort.html.

type SpanFirstQuery

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

SpanFirstQuery spans near the beginning of a field. The span first query maps to Lucene SpanFirstQuery

See https://www.elastic.co/guide/en/elasticsearch/reference/7.7/query-dsl-span-first-query.html for details.

func NewSpanFirstQuery

func NewSpanFirstQuery(query Query, end int) *SpanFirstQuery

NewSpanFirstQuery creates a new SpanFirstQuery.

func (*SpanFirstQuery) Boost

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

Boost sets the boost for this query.

func (*SpanFirstQuery) End

func (q *SpanFirstQuery) End(end int) *SpanFirstQuery

End specifies the maximum end position of the match, which needs to be positive.

func (*SpanFirstQuery) Match

func (q *SpanFirstQuery) Match(query Query) *SpanFirstQuery

Match sets the query, e.g. a SpanTermQuery.

func (*SpanFirstQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit.

func (*SpanFirstQuery) Source

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

Source returns the JSON body.

type SpanNearQuery

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

SpanNearQuery matches spans which are near one another. One can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order. The span near query maps to Lucene SpanNearQuery.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.7/query-dsl-span-near-query.html for details.

func NewSpanNearQuery

func NewSpanNearQuery(clauses ...Query) *SpanNearQuery

NewSpanNearQuery creates a new SpanNearQuery.

func (*SpanNearQuery) Add

func (q *SpanNearQuery) Add(clauses ...Query) *SpanNearQuery

Add clauses to use in the query.

func (*SpanNearQuery) Boost

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

Boost sets the boost for this query.

func (*SpanNearQuery) Clauses

func (q *SpanNearQuery) Clauses(clauses ...Query) *SpanNearQuery

Clauses to use in the query.

func (*SpanNearQuery) InOrder

func (q *SpanNearQuery) InOrder(inOrder bool) *SpanNearQuery

InOrder, when true, the spans from each clause must be in the same order as in Clauses and must be non-overlapping. Defaults to true.

func (*SpanNearQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit.

func (*SpanNearQuery) Slop

func (q *SpanNearQuery) Slop(slop int) *SpanNearQuery

Slop controls the maximum number of intervening unmatched positions permitted.

func (*SpanNearQuery) Source

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

Source returns the JSON body.

type SpanTermQuery

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

SpanTermQuery matches spans containing a term. The span term query maps to Lucene SpanTermQuery.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.7/query-dsl-span-term-query.html for details.

func NewSpanTermQuery

func NewSpanTermQuery(field string, value ...interface{}) *SpanTermQuery

NewSpanTermQuery creates a new SpanTermQuery. When passing values, the first one is used to initialize the value.

func (*SpanTermQuery) Boost

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

Boost sets the boost for this query.

func (*SpanTermQuery) Field

func (q *SpanTermQuery) Field(field string) *SpanTermQuery

Field name to match the term against.

func (*SpanTermQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit.

func (*SpanTermQuery) Source

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

Source returns the JSON body.

func (*SpanTermQuery) Value

func (q *SpanTermQuery) Value(value interface{}) *SpanTermQuery

Value of the term.

type StatsAggregation

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

StatsAggregation 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-stats-aggregation.html

func NewStatsAggregation

func NewStatsAggregation() *StatsAggregation

func (*StatsAggregation) Field

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

func (*StatsAggregation) Format

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

func (*StatsAggregation) Meta

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

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

func (*StatsAggregation) Missing

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

func (*StatsAggregation) Script

func (a *StatsAggregation) Script(script *Script) *StatsAggregation

func (*StatsAggregation) Source

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

func (*StatsAggregation) SubAggregation

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

type StatsBucketAggregation

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

StatsBucketAggregation 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.

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

func NewStatsBucketAggregation

func NewStatsBucketAggregation() *StatsBucketAggregation

NewStatsBucketAggregation creates and initializes a new StatsBucketAggregation.

func (*StatsBucketAggregation) BucketsPath

func (s *StatsBucketAggregation) BucketsPath(bucketsPaths ...string) *StatsBucketAggregation

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

func (*StatsBucketAggregation) Format

Format to use on the output of this aggregation.

func (*StatsBucketAggregation) GapInsertZeros

func (s *StatsBucketAggregation) GapInsertZeros() *StatsBucketAggregation

GapInsertZeros inserts zeros for gaps in the series.

func (*StatsBucketAggregation) GapPolicy

func (s *StatsBucketAggregation) GapPolicy(gapPolicy string) *StatsBucketAggregation

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 (*StatsBucketAggregation) GapSkip

GapSkip skips gaps in the series.

func (*StatsBucketAggregation) Meta

func (s *StatsBucketAggregation) Meta(metaData map[string]interface{}) *StatsBucketAggregation

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

func (*StatsBucketAggregation) Source

func (s *StatsBucketAggregation) Source() (interface{}, error)

Source returns the a JSON-serializable interface.

type StupidBackoffSmoothingModel

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

StupidBackoffSmoothingModel implements a stupid backoff 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 NewStupidBackoffSmoothingModel

func NewStupidBackoffSmoothingModel(discount float64) *StupidBackoffSmoothingModel

func (*StupidBackoffSmoothingModel) Source

func (sm *StupidBackoffSmoothingModel) Source() (interface{}, error)

func (*StupidBackoffSmoothingModel) Type

type SuggestField

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

SuggestField can be used by the caller to specify a suggest field at index time. For a detailed example, see e.g. https://www.elastic.co/blog/you-complete-me.

func NewSuggestField

func NewSuggestField(input ...string) *SuggestField

func (*SuggestField) ContextQuery

func (f *SuggestField) ContextQuery(queries ...SuggesterContextQuery) *SuggestField

func (*SuggestField) Input

func (f *SuggestField) Input(input ...string) *SuggestField

func (*SuggestField) MarshalJSON

func (f *SuggestField) MarshalJSON() ([]byte, error)

MarshalJSON encodes SuggestField into JSON.

func (*SuggestField) Weight

func (f *SuggestField) Weight(weight int) *SuggestField

type Suggester

type Suggester interface {
	Name() string
	Source(includeName bool) (interface{}, error)
}

Represents the generic suggester interface. A suggester's only purpose is to return the source of the query as a JSON-serializable object. Returning a map[string]interface{} will do.

type SuggesterCategoryIndex

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

func NewSuggesterCategoryIndex

func NewSuggesterCategoryIndex(name string, values ...string) *SuggesterCategoryIndex

NewSuggesterCategoryIndex creates a new SuggesterCategoryIndex.

func (*SuggesterCategoryIndex) Source

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

Source returns a map that will be used to serialize the context query as JSON.

func (*SuggesterCategoryIndex) Values

type SuggesterCategoryMapping

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

SuggesterCategoryMapping provides a mapping for a category context in a suggester. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/suggester-context.html#_category_mapping.

func NewSuggesterCategoryMapping

func NewSuggesterCategoryMapping(name string) *SuggesterCategoryMapping

NewSuggesterCategoryMapping creates a new SuggesterCategoryMapping.

func (*SuggesterCategoryMapping) DefaultValues

func (q *SuggesterCategoryMapping) DefaultValues(values ...string) *SuggesterCategoryMapping

func (*SuggesterCategoryMapping) FieldName

func (q *SuggesterCategoryMapping) FieldName(fieldName string) *SuggesterCategoryMapping

func (*SuggesterCategoryMapping) Source

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

Source returns a map that will be used to serialize the context query as JSON.

type SuggesterCategoryQuery

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

SuggesterCategoryQuery provides querying a category context in a suggester. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/suggester-context.html#_category_query.

func NewSuggesterCategoryQuery

func NewSuggesterCategoryQuery(name string, values ...string) *SuggesterCategoryQuery

NewSuggesterCategoryQuery creates a new SuggesterCategoryQuery.

func (*SuggesterCategoryQuery) Source

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

Source returns a map that will be used to serialize the context query as JSON.

func (*SuggesterCategoryQuery) Value

func (*SuggesterCategoryQuery) ValueWithBoost

func (q *SuggesterCategoryQuery) ValueWithBoost(val string, boost int) *SuggesterCategoryQuery

func (*SuggesterCategoryQuery) Values

type SuggesterContextQuery

type SuggesterContextQuery interface {
	Source() (interface{}, error)
}

SuggesterContextQuery is used to define context information within a suggestion request.

type SuggesterGeoIndex

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

func NewSuggesterGeoIndex

func NewSuggesterGeoIndex(name string) *SuggesterGeoIndex

NewSuggesterGeoQuery creates a new SuggesterGeoQuery.

func (*SuggesterGeoIndex) Locations

func (q *SuggesterGeoIndex) Locations(locations ...*GeoPoint) *SuggesterGeoIndex

func (*SuggesterGeoIndex) Source

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

Source returns a map that will be used to serialize the context query as JSON.

type SuggesterGeoMapping

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

SuggesterGeoMapping provides a mapping for a geolocation context in a suggester. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/suggester-context.html#_geo_location_mapping.

func NewSuggesterGeoMapping

func NewSuggesterGeoMapping(name string) *SuggesterGeoMapping

NewSuggesterGeoMapping creates a new SuggesterGeoMapping.

func (*SuggesterGeoMapping) DefaultLocations

func (q *SuggesterGeoMapping) DefaultLocations(locations ...*GeoPoint) *SuggesterGeoMapping

func (*SuggesterGeoMapping) FieldName

func (q *SuggesterGeoMapping) FieldName(fieldName string) *SuggesterGeoMapping

func (*SuggesterGeoMapping) Neighbors

func (q *SuggesterGeoMapping) Neighbors(neighbors bool) *SuggesterGeoMapping

func (*SuggesterGeoMapping) Precision

func (q *SuggesterGeoMapping) Precision(precision ...string) *SuggesterGeoMapping

func (*SuggesterGeoMapping) Source

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

Source returns a map that will be used to serialize the context query as JSON.

type SuggesterGeoQuery

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

SuggesterGeoQuery provides querying a geolocation context in a suggester. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/suggester-context.html#_geo_location_query

func NewSuggesterGeoQuery

func NewSuggesterGeoQuery(name string, location *GeoPoint) *SuggesterGeoQuery

NewSuggesterGeoQuery creates a new SuggesterGeoQuery.

func (*SuggesterGeoQuery) Boost

func (q *SuggesterGeoQuery) Boost(boost int) *SuggesterGeoQuery

func (*SuggesterGeoQuery) Neighbours

func (q *SuggesterGeoQuery) Neighbours(neighbours ...string) *SuggesterGeoQuery

func (*SuggesterGeoQuery) Precision

func (q *SuggesterGeoQuery) Precision(precision string) *SuggesterGeoQuery

func (*SuggesterGeoQuery) Source

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

Source returns a map that will be used to serialize the context query as JSON.

type SumAggregation

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

SumAggregation is a single-value metrics aggregation that sums up 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-sum-aggregation.html

func NewSumAggregation

func NewSumAggregation() *SumAggregation

func (*SumAggregation) Field

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

func (*SumAggregation) Format

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

func (*SumAggregation) Meta

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

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

func (*SumAggregation) Missing

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

func (*SumAggregation) Script

func (a *SumAggregation) Script(script *Script) *SumAggregation

func (*SumAggregation) Source

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

func (*SumAggregation) SubAggregation

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

type SumBucketAggregation

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

SumBucketAggregation is a sibling pipeline aggregation which calculates the sum across all buckets 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-sum-bucket-aggregation.html

func NewSumBucketAggregation

func NewSumBucketAggregation() *SumBucketAggregation

NewSumBucketAggregation creates and initializes a new SumBucketAggregation.

func (*SumBucketAggregation) BucketsPath

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

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

func (*SumBucketAggregation) Format

Format to use on the output of this aggregation.

func (*SumBucketAggregation) GapInsertZeros

func (a *SumBucketAggregation) GapInsertZeros() *SumBucketAggregation

GapInsertZeros inserts zeros for gaps in the series.

func (*SumBucketAggregation) GapPolicy

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

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 (*SumBucketAggregation) GapSkip

GapSkip skips gaps in the series.

func (*SumBucketAggregation) Meta

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

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

func (*SumBucketAggregation) Source

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

Source returns the a JSON-serializable interface.

type TermQuery

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

TermQuery finds documents that contain the exact term specified in the inverted index.

For details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-term-query.html

func NewTermQuery

func NewTermQuery(name string, value interface{}) *TermQuery

NewTermQuery creates and initializes a new TermQuery.

func (*TermQuery) Boost

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

Boost sets the boost for this query.

func (*TermQuery) CaseInsensitive

func (q *TermQuery) CaseInsensitive(caseInsensitive bool) *TermQuery

func (*TermQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit

func (*TermQuery) Source

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

Source returns JSON for the query.

type TermSuggester

type TermSuggester struct {
	Suggester
	// contains filtered or unexported fields
}

TermSuggester suggests terms based on edit distance. For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-suggesters-term.html.

func NewTermSuggester

func NewTermSuggester(name string) *TermSuggester

NewTermSuggester creates a new TermSuggester.

func (*TermSuggester) Accuracy

func (q *TermSuggester) Accuracy(accuracy float64) *TermSuggester

func (*TermSuggester) Analyzer

func (q *TermSuggester) Analyzer(analyzer string) *TermSuggester

func (*TermSuggester) ContextQueries

func (q *TermSuggester) ContextQueries(queries ...SuggesterContextQuery) *TermSuggester

func (*TermSuggester) ContextQuery

func (q *TermSuggester) ContextQuery(query SuggesterContextQuery) *TermSuggester

func (*TermSuggester) Field

func (q *TermSuggester) Field(field string) *TermSuggester

func (*TermSuggester) MaxEdits

func (q *TermSuggester) MaxEdits(maxEdits int) *TermSuggester

func (*TermSuggester) MaxInspections

func (q *TermSuggester) MaxInspections(maxInspections int) *TermSuggester

func (*TermSuggester) MaxTermFreq

func (q *TermSuggester) MaxTermFreq(maxTermFreq float64) *TermSuggester

func (*TermSuggester) MinDocFreq

func (q *TermSuggester) MinDocFreq(minDocFreq float64) *TermSuggester

func (*TermSuggester) MinWordLength

func (q *TermSuggester) MinWordLength(minWordLength int) *TermSuggester

func (*TermSuggester) Name

func (q *TermSuggester) Name() string

func (*TermSuggester) PrefixLength

func (q *TermSuggester) PrefixLength(prefixLength int) *TermSuggester

func (*TermSuggester) ShardSize

func (q *TermSuggester) ShardSize(shardSize int) *TermSuggester

func (*TermSuggester) Size

func (q *TermSuggester) Size(size int) *TermSuggester

func (*TermSuggester) Sort

func (q *TermSuggester) Sort(sort string) *TermSuggester

func (*TermSuggester) Source

func (q *TermSuggester) Source(includeName bool) (interface{}, error)

Source generates the source for the term suggester.

func (*TermSuggester) StringDistance

func (q *TermSuggester) StringDistance(stringDistance string) *TermSuggester

func (*TermSuggester) SuggestMode

func (q *TermSuggester) SuggestMode(suggestMode string) *TermSuggester

func (*TermSuggester) Text

func (q *TermSuggester) Text(text string) *TermSuggester

type TermVectorsFieldInfo

type TermVectorsFieldInfo struct {
	FieldStatistics FieldStatistics      `json:"field_statistics"`
	Terms           map[string]TermsInfo `json:"terms"`
}

type TermsAggregation

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

TermsAggregation is a multi-bucket value source based aggregation where buckets are dynamically built - one per unique value.

See: http://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-terms-aggregation.html

func NewTermsAggregation

func NewTermsAggregation() *TermsAggregation

func (*TermsAggregation) CollectionMode

func (a *TermsAggregation) CollectionMode(collectionMode string) *TermsAggregation

Collection mode can be depth_first or breadth_first as of 1.4.0.

func (*TermsAggregation) Exclude

func (a *TermsAggregation) Exclude(regexp string) *TermsAggregation

func (*TermsAggregation) ExcludeValues

func (a *TermsAggregation) ExcludeValues(values ...interface{}) *TermsAggregation

func (*TermsAggregation) ExecutionHint

func (a *TermsAggregation) ExecutionHint(hint string) *TermsAggregation

func (*TermsAggregation) Field

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

func (*TermsAggregation) Include

func (a *TermsAggregation) Include(regexp string) *TermsAggregation

func (*TermsAggregation) IncludeExclude

func (a *TermsAggregation) IncludeExclude(includeExclude *TermsAggregationIncludeExclude) *TermsAggregation

func (*TermsAggregation) IncludeValues

func (a *TermsAggregation) IncludeValues(values ...interface{}) *TermsAggregation

func (*TermsAggregation) Meta

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

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

func (*TermsAggregation) MinDocCount

func (a *TermsAggregation) MinDocCount(minDocCount int) *TermsAggregation

func (*TermsAggregation) Missing

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

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

func (*TermsAggregation) NumPartitions

func (a *TermsAggregation) NumPartitions(n int) *TermsAggregation

func (*TermsAggregation) Order

func (a *TermsAggregation) Order(order string, asc bool) *TermsAggregation

func (*TermsAggregation) OrderByAggregation

func (a *TermsAggregation) OrderByAggregation(aggName string, asc bool) *TermsAggregation

OrderByAggregation creates a bucket ordering strategy which sorts buckets based on a single-valued calc get.

func (*TermsAggregation) OrderByAggregationAndMetric

func (a *TermsAggregation) OrderByAggregationAndMetric(aggName, metric string, asc bool) *TermsAggregation

OrderByAggregationAndMetric creates a bucket ordering strategy which sorts buckets based on a multi-valued calc get.

func (*TermsAggregation) OrderByCount

func (a *TermsAggregation) OrderByCount(asc bool) *TermsAggregation

func (*TermsAggregation) OrderByCountAsc

func (a *TermsAggregation) OrderByCountAsc() *TermsAggregation

func (*TermsAggregation) OrderByCountDesc

func (a *TermsAggregation) OrderByCountDesc() *TermsAggregation

func (*TermsAggregation) OrderByKey

func (a *TermsAggregation) OrderByKey(asc bool) *TermsAggregation

func (*TermsAggregation) OrderByKeyAsc

func (a *TermsAggregation) OrderByKeyAsc() *TermsAggregation

func (*TermsAggregation) OrderByKeyDesc

func (a *TermsAggregation) OrderByKeyDesc() *TermsAggregation

func (*TermsAggregation) OrderByTerm deprecated

func (a *TermsAggregation) OrderByTerm(asc bool) *TermsAggregation

Deprecated: Use OrderByKey instead.

func (*TermsAggregation) OrderByTermAsc deprecated

func (a *TermsAggregation) OrderByTermAsc() *TermsAggregation

Deprecated: Use OrderByKeyAsc instead.

func (*TermsAggregation) OrderByTermDesc deprecated

func (a *TermsAggregation) OrderByTermDesc() *TermsAggregation

Deprecated: Use OrderByKeyDesc instead.

func (*TermsAggregation) Partition

func (a *TermsAggregation) Partition(p int) *TermsAggregation

func (*TermsAggregation) RequiredSize

func (a *TermsAggregation) RequiredSize(requiredSize int) *TermsAggregation

func (*TermsAggregation) Script

func (a *TermsAggregation) Script(script *Script) *TermsAggregation

func (*TermsAggregation) ShardMinDocCount

func (a *TermsAggregation) ShardMinDocCount(shardMinDocCount int) *TermsAggregation

func (*TermsAggregation) ShardSize

func (a *TermsAggregation) ShardSize(shardSize int) *TermsAggregation

func (*TermsAggregation) ShowTermDocCountError

func (a *TermsAggregation) ShowTermDocCountError(showTermDocCountError bool) *TermsAggregation

func (*TermsAggregation) Size

func (a *TermsAggregation) Size(size int) *TermsAggregation

func (*TermsAggregation) Source

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

func (*TermsAggregation) SubAggregation

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

func (*TermsAggregation) ValueType

func (a *TermsAggregation) ValueType(valueType string) *TermsAggregation

ValueType can be string, long, or double.

type TermsAggregationIncludeExclude

type TermsAggregationIncludeExclude struct {
	Include       string
	Exclude       string
	IncludeValues []interface{}
	ExcludeValues []interface{}
	Partition     int
	NumPartitions int
}

TermsAggregationIncludeExclude allows for include/exclude in a TermsAggregation.

func (*TermsAggregationIncludeExclude) MergeInto

func (ie *TermsAggregationIncludeExclude) MergeInto(source map[string]interface{}) error

MergeInto merges the values of the include/exclude options into source.

func (*TermsAggregationIncludeExclude) Source

func (ie *TermsAggregationIncludeExclude) Source() (interface{}, error)

Source returns a JSON serializable struct.

type TermsInfo

type TermsInfo struct {
	DocFreq  int64       `json:"doc_freq"`
	Score    float64     `json:"score"`
	TermFreq int64       `json:"term_freq"`
	Ttf      int64       `json:"ttf"`
	Tokens   []TokenInfo `json:"tokens"`
}

type TermsLookup

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

TermsLookup encapsulates the parameters needed to fetch terms.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-terms-query.html#query-dsl-terms-lookup.

func NewTermsLookup

func NewTermsLookup() *TermsLookup

NewTermsLookup creates and initializes a new TermsLookup.

func (*TermsLookup) Id

func (t *TermsLookup) Id(id string) *TermsLookup

Id to look up.

func (*TermsLookup) Index

func (t *TermsLookup) Index(index string) *TermsLookup

Index name.

func (*TermsLookup) Path

func (t *TermsLookup) Path(path string) *TermsLookup

Path to use for lookup.

func (*TermsLookup) Routing

func (t *TermsLookup) Routing(routing string) *TermsLookup

Routing value.

func (*TermsLookup) Source

func (t *TermsLookup) Source() (interface{}, error)

Source creates the JSON source of the builder.

func (*TermsLookup) Type deprecated

func (t *TermsLookup) Type(typ string) *TermsLookup

Type name.

Deprecated: Types are in the process of being removed.

type TermsOrder

type TermsOrder struct {
	Field     string
	Ascending bool
}

TermsOrder specifies a single order field for a terms aggregation.

func (*TermsOrder) Source

func (order *TermsOrder) Source() (interface{}, error)

Source returns serializable JSON of the TermsOrder.

type TermsQuery

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

TermsQuery filters documents that have fields that match any of the provided terms (not analyzed).

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-terms-query.html

func NewTermsQuery

func NewTermsQuery(name string, values ...interface{}) *TermsQuery

NewTermsQuery creates and initializes a new TermsQuery.

func NewTermsQueryFromStrings

func NewTermsQueryFromStrings(name string, values ...string) *TermsQuery

NewTermsQueryFromStrings creates and initializes a new TermsQuery from strings.

func (*TermsQuery) Boost

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

Boost sets the boost for this query.

func (*TermsQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit

func (*TermsQuery) Source

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

Creates the query source for the term query.

func (*TermsQuery) TermsLookup

func (q *TermsQuery) TermsLookup(lookup *TermsLookup) *TermsQuery

TermsLookup adds terms lookup details to the query.

type TermsSetQuery

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

TermsSetQuery returns any documents that match with at least one or more of the provided terms. The terms are not analyzed and thus must match exactly. The number of terms that must match varies per document and is either controlled by a minimum should match field or computed per document in a minimum should match script.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-terms-set-query.html

func NewTermsSetQuery

func NewTermsSetQuery(name string, values ...interface{}) *TermsSetQuery

NewTermsSetQuery creates and initializes a new TermsSetQuery.

func (*TermsSetQuery) Boost

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

Boost sets the boost for this query.

func (*TermsSetQuery) MinimumShouldMatchField

func (q *TermsSetQuery) MinimumShouldMatchField(minimumShouldMatchField string) *TermsSetQuery

MinimumShouldMatchField specifies the field to match.

func (*TermsSetQuery) MinimumShouldMatchScript

func (q *TermsSetQuery) MinimumShouldMatchScript(minimumShouldMatchScript *Script) *TermsSetQuery

MinimumShouldMatchScript specifies the script to match.

func (*TermsSetQuery) QueryName

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

QueryName sets the query name for the filter that can be used when searching for matched_filters per hit

func (*TermsSetQuery) Source

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

Source creates the query source for the term query.

type TermvectorsFilterSettings

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

TermvectorsFilterSettings adds additional filters to a Termsvector request. It allows to filter terms based on their tf-idf scores. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-termvectors.html#_terms_filtering for more information.

func NewTermvectorsFilterSettings

func NewTermvectorsFilterSettings() *TermvectorsFilterSettings

NewTermvectorsFilterSettings creates and initializes a new TermvectorsFilterSettings struct.

func (*TermvectorsFilterSettings) MaxDocFreq

MaxDocFreq ignores terms which occur in more than this many docs.

func (*TermvectorsFilterSettings) MaxNumTerms

MaxNumTerms specifies the maximum number of terms the must be returned per field.

func (*TermvectorsFilterSettings) MaxTermFreq

MaxTermFreq ignores words with more than this frequency in the source doc.

func (*TermvectorsFilterSettings) MaxWordLength

func (fs *TermvectorsFilterSettings) MaxWordLength(value int64) *TermvectorsFilterSettings

MaxWordLength specifies the maximum word length above which words will be ignored.

func (*TermvectorsFilterSettings) MinDocFreq

MinDocFreq ignores terms which do not occur in at least this many docs.

func (*TermvectorsFilterSettings) MinTermFreq

MinTermFreq ignores words with less than this frequency in the source doc.

func (*TermvectorsFilterSettings) MinWordLength

func (fs *TermvectorsFilterSettings) MinWordLength(value int64) *TermvectorsFilterSettings

MinWordLength specifies the minimum word length below which words will be ignored.

func (*TermvectorsFilterSettings) Source

func (fs *TermvectorsFilterSettings) Source() (interface{}, error)

Source returns JSON for the query.

type TermvectorsResponse

type TermvectorsResponse struct {
	Index       string                          `json:"_index"`
	Type        string                          `json:"_type"`
	Id          string                          `json:"_id,omitempty"`
	Version     int                             `json:"_version"`
	Found       bool                            `json:"found"`
	Took        int64                           `json:"took"`
	TermVectors map[string]TermVectorsFieldInfo `json:"term_vectors"`
}

TermvectorsResponse is the response of TermvectorsService.Do.

type TermvectorsService

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

TermvectorsService returns information and statistics on terms in the fields of a particular document. The document could be stored in the index or artificially provided by the user.

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

func (*TermvectorsService) BodyJson

func (s *TermvectorsService) BodyJson(body interface{}) *TermvectorsService

BodyJson defines the body parameters. See documentation.

func (*TermvectorsService) BodyString

func (s *TermvectorsService) BodyString(body string) *TermvectorsService

BodyString defines the body parameters as a string. See documentation.

func (*TermvectorsService) Dfs

Dfs specifies if distributed frequencies should be returned instead shard frequencies.

func (*TermvectorsService) Doc

func (s *TermvectorsService) Doc(doc interface{}) *TermvectorsService

Doc is the document to analyze.

func (*TermvectorsService) ErrorTrace

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

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

func (*TermvectorsService) FieldStatistics

func (s *TermvectorsService) FieldStatistics(fieldStatistics bool) *TermvectorsService

FieldStatistics specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.

func (*TermvectorsService) Fields

func (s *TermvectorsService) Fields(fields ...string) *TermvectorsService

Fields a list of fields to return.

func (*TermvectorsService) Filter

Filter adds terms filter settings.

func (*TermvectorsService) FilterPath

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

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

func (*TermvectorsService) Header

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

Header adds a header to the request.

func (*TermvectorsService) Headers

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

Headers specifies the headers of the request.

func (*TermvectorsService) Human

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

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

func (*TermvectorsService) Id

Id of the document.

func (*TermvectorsService) Index

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

Index in which the document resides.

func (*TermvectorsService) Offsets

func (s *TermvectorsService) Offsets(offsets bool) *TermvectorsService

Offsets specifies if term offsets should be returned.

func (*TermvectorsService) Parent

func (s *TermvectorsService) Parent(parent string) *TermvectorsService

Parent id of documents.

func (*TermvectorsService) Payloads

func (s *TermvectorsService) Payloads(payloads bool) *TermvectorsService

Payloads specifies if term payloads should be returned.

func (*TermvectorsService) PerFieldAnalyzer

func (s *TermvectorsService) PerFieldAnalyzer(perFieldAnalyzer map[string]string) *TermvectorsService

PerFieldAnalyzer allows to specify a different analyzer than the one at the field.

func (*TermvectorsService) Positions

func (s *TermvectorsService) Positions(positions bool) *TermvectorsService

Positions specifies if term positions should be returned.

func (*TermvectorsService) Preference

func (s *TermvectorsService) Preference(preference string) *TermvectorsService

Preference specify the node or shard the operation should be performed on (default: random).

func (*TermvectorsService) Pretty

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

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*TermvectorsService) Realtime

func (s *TermvectorsService) Realtime(realtime bool) *TermvectorsService

Realtime specifies if request is real-time as opposed to near-real-time (default: true).

func (*TermvectorsService) Routing

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

Routing is a specific routing value.

func (*TermvectorsService) TermStatistics

func (s *TermvectorsService) TermStatistics(termStatistics bool) *TermvectorsService

TermStatistics specifies if total term frequency and document frequency should be returned.

func (*TermvectorsService) Type deprecated

Type of the document.

Deprecated: Types are in the process of being removed.

func (*TermvectorsService) Version

func (s *TermvectorsService) Version(version interface{}) *TermvectorsService

Version an explicit version number for concurrency control.

func (*TermvectorsService) VersionType

func (s *TermvectorsService) VersionType(versionType string) *TermvectorsService

VersionType specifies a version type ("internal", "external", or "external_gte").

type TokenInfo

type TokenInfo struct {
	StartOffset int64  `json:"start_offset"`
	EndOffset   int64  `json:"end_offset"`
	Position    int64  `json:"position"`
	Payload     string `json:"payload"`
}

type TopHitsAggregation

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

TopHitsAggregation keeps track of the most relevant document being aggregated. This aggregator is intended to be used as a sub aggregator, so that the top matching documents can be aggregated per bucket.

It can effectively be used to group result sets by certain fields via a bucket aggregator. One or more bucket aggregators determines by which properties a result set get sliced into.

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

func NewTopHitsAggregation

func NewTopHitsAggregation() *TopHitsAggregation

func (*TopHitsAggregation) DocvalueField

func (a *TopHitsAggregation) DocvalueField(docvalueField string) *TopHitsAggregation

func (*TopHitsAggregation) DocvalueFieldWithFormat

func (a *TopHitsAggregation) DocvalueFieldWithFormat(docvalueField DocvalueField) *TopHitsAggregation

func (*TopHitsAggregation) DocvalueFields

func (a *TopHitsAggregation) DocvalueFields(docvalueFields ...string) *TopHitsAggregation

func (*TopHitsAggregation) DocvalueFieldsWithFormat

func (a *TopHitsAggregation) DocvalueFieldsWithFormat(docvalueFields ...DocvalueField) *TopHitsAggregation

func (*TopHitsAggregation) Explain

func (a *TopHitsAggregation) Explain(explain bool) *TopHitsAggregation

func (*TopHitsAggregation) FetchSource

func (a *TopHitsAggregation) FetchSource(fetchSource bool) *TopHitsAggregation

func (*TopHitsAggregation) FetchSourceContext

func (a *TopHitsAggregation) FetchSourceContext(fetchSourceContext *FetchSourceContext) *TopHitsAggregation

func (*TopHitsAggregation) From

func (a *TopHitsAggregation) From(from int) *TopHitsAggregation

func (*TopHitsAggregation) Highlight

func (a *TopHitsAggregation) Highlight(highlight *Highlight) *TopHitsAggregation

func (*TopHitsAggregation) Highlighter

func (a *TopHitsAggregation) Highlighter() *Highlight

func (*TopHitsAggregation) NoStoredFields

func (a *TopHitsAggregation) NoStoredFields() *TopHitsAggregation

func (*TopHitsAggregation) ScriptField

func (a *TopHitsAggregation) ScriptField(scriptField *ScriptField) *TopHitsAggregation

func (*TopHitsAggregation) ScriptFields

func (a *TopHitsAggregation) ScriptFields(scriptFields ...*ScriptField) *TopHitsAggregation

func (*TopHitsAggregation) SearchSource

func (a *TopHitsAggregation) SearchSource(searchSource *SearchSource) *TopHitsAggregation

func (*TopHitsAggregation) Size

func (a *TopHitsAggregation) Size(size int) *TopHitsAggregation

func (*TopHitsAggregation) Sort

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

func (*TopHitsAggregation) SortBy

func (a *TopHitsAggregation) SortBy(sorter ...Sorter) *TopHitsAggregation

func (*TopHitsAggregation) SortWithInfo

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

func (*TopHitsAggregation) Source

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

func (*TopHitsAggregation) TrackScores

func (a *TopHitsAggregation) TrackScores(trackScores bool) *TopHitsAggregation

func (*TopHitsAggregation) Version

func (a *TopHitsAggregation) Version(version bool) *TopHitsAggregation

type TopMetricsAggregation

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

TopMetricsAggregation selects metrics from the document with the largest or smallest "sort" value. top_metrics is fairly similar to top_hits in spirit but because it is more limited it is able to do its job using less memory and is often faster.

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

func NewTopMetricsAggregation

func NewTopMetricsAggregation() *TopMetricsAggregation

func (*TopMetricsAggregation) Field

Field adds a field to run aggregation against.

func (*TopMetricsAggregation) Size

Size sets the number of top documents returned by the aggregation. The default size is 1.

func (*TopMetricsAggregation) Sort

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

Sort adds a sort order.

func (*TopMetricsAggregation) SortBy

SortBy adds a sort order.

func (*TopMetricsAggregation) SortWithInfo

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

SortWithInfo adds a sort order.

func (*TopMetricsAggregation) Source

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

type TotalHits

type TotalHits struct {
	Value    int64  `json:"value"`    // value of the total hit count
	Relation string `json:"relation"` // how the value should be interpreted: accurate ("eq") or a lower bound ("gte")
}

TotalHits specifies total number of hits and its relation

func (*TotalHits) UnmarshalJSON

func (h *TotalHits) UnmarshalJSON(data []byte) error

UnmarshalJSON into TotalHits, accepting both the new response structure in ES 7.x as well as the older response structure in earlier versions. The latter can be enabled with RestTotalHitsAsInt(true).

type TypeQuery

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

TypeQuery filters documents matching the provided document / mapping type.

For details, see: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-type-query.html

func NewTypeQuery

func NewTypeQuery(typ string) *TypeQuery

func (*TypeQuery) Source

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

Source returns JSON for the query.

type UnassignedInfo

type UnassignedInfo struct {
	Reason           string     `json:"reason"`
	At               *time.Time `json:"at,omitempty"`
	FailedAttempts   int        `json:"failed_attempts,omitempty"`
	Delayed          bool       `json:"delayed"`
	Details          string     `json:"details,omitempty"`
	AllocationStatus string     `json:"allocation_status"`
}

type ValidateService

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

ValidateService allows a user to validate a potentially expensive query without executing it. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-validate.html.

func (*ValidateService) AllShards

func (s *ValidateService) AllShards(allShards *bool) *ValidateService

Execute validation on all shards instead of one random shard per index.

func (*ValidateService) AllowNoIndices

func (s *ValidateService) AllowNoIndices(allowNoIndices bool) *ValidateService

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 (*ValidateService) AnalyzeWildcard

func (s *ValidateService) AnalyzeWildcard(analyzeWildcard bool) *ValidateService

AnalyzeWildcard specifies whether wildcards and prefix queries in the query string query should be analyzed (default: false).

func (*ValidateService) Analyzer

func (s *ValidateService) Analyzer(analyzer string) *ValidateService

Analyzer is the analyzer for the query string query.

func (*ValidateService) BodyJson

func (s *ValidateService) BodyJson(body interface{}) *ValidateService

BodyJson sets the query definition using the Query DSL.

func (*ValidateService) BodyString

func (s *ValidateService) BodyString(body string) *ValidateService

BodyString sets the query definition using the Query DSL as a string.

func (*ValidateService) DefaultOperator

func (s *ValidateService) DefaultOperator(defaultOperator string) *ValidateService

DefaultOperator is the default operator for query string query (AND or OR).

func (*ValidateService) Df

Df is the default field for query string query (default: _all).

func (*ValidateService) ErrorTrace

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

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

func (*ValidateService) ExpandWildcards

func (s *ValidateService) ExpandWildcards(expandWildcards string) *ValidateService

ExpandWildcards indicates whether to expand wildcard expression to concrete indices that are open, closed or both.

func (*ValidateService) Explain

func (s *ValidateService) Explain(explain *bool) *ValidateService

An explain parameter can be specified to get more detailed information about why a query failed.

func (*ValidateService) FilterPath

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

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

func (*ValidateService) Header

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

Header adds a header to the request.

func (*ValidateService) Headers

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

Headers specifies the headers of the request.

func (*ValidateService) Human

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

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

func (*ValidateService) IgnoreUnavailable

func (s *ValidateService) IgnoreUnavailable(ignoreUnavailable bool) *ValidateService

IgnoreUnavailable indicates whether the specified concrete indices should be ignored when unavailable (missing or closed).

func (*ValidateService) Index

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

Index sets the names of the indices to use for search.

func (*ValidateService) Lenient

func (s *ValidateService) Lenient(lenient bool) *ValidateService

Lenient specifies whether format-based query failures (such as providing text to a numeric field) should be ignored.

func (*ValidateService) Pretty

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

Pretty tells Elasticsearch whether to return a formatted JSON response.

func (*ValidateService) Q

Query in the Lucene query string syntax.

func (*ValidateService) Query

func (s *ValidateService) Query(query Query) *ValidateService

Query sets a query definition using the Query DSL.

func (*ValidateService) Rewrite

func (s *ValidateService) Rewrite(rewrite *bool) *ValidateService

Provide a more detailed explanation showing the actual Lucene query that will be executed.

func (*ValidateService) Type deprecated

func (s *ValidateService) Type(typ ...string) *ValidateService

Type adds search restrictions for a list of types.

Deprecated: Types are in the process of being removed. Instead of using a type, prefer to filter on a field on the document.

type ValueCountAggregation

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

ValueCountAggregation is a single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. These values can be extracted either from specific fields in the documents, or be generated by a provided script. Typically, this aggregator will be used in conjunction with other single-value aggregations. For example, when computing the avg one might be interested in the number of values the average is computed over. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-metrics-valuecount-aggregation.html

func NewValueCountAggregation

func NewValueCountAggregation() *ValueCountAggregation

func (*ValueCountAggregation) Field

func (*ValueCountAggregation) Format

func (*ValueCountAggregation) Meta

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

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

func (*ValueCountAggregation) Script

func (*ValueCountAggregation) Source

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

func (*ValueCountAggregation) SubAggregation

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

type WeightFactorFunction

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

WeightFactorFunction builds a weight factor function that multiplies the weight to the score. See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-function-score-query.html#_weight for details.

func NewWeightFactorFunction

func NewWeightFactorFunction(weight float64) *WeightFactorFunction

NewWeightFactorFunction initializes and returns a new WeightFactorFunction.

func (*WeightFactorFunction) GetWeight

func (fn *WeightFactorFunction) GetWeight() *float64

GetWeight returns the adjusted score. It is part of the ScoreFunction interface. Returns nil if weight is not specified.

func (*WeightFactorFunction) Name

func (fn *WeightFactorFunction) Name() string

Name represents the JSON field name under which the output of Source needs to be serialized by FunctionScoreQuery (see FunctionScoreQuery.Source).

func (*WeightFactorFunction) Source

func (fn *WeightFactorFunction) Source() (interface{}, error)

Source returns the serializable JSON data of this score function.

func (*WeightFactorFunction) 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 WeightedAvgAggregation

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

WeightedAvgAggregation is a single-value metrics aggregation that computes the weighted average of numeric values that are extracted from the aggregated documents. These values can be extracted either from specific numeric fields in the documents.

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

func NewWeightedAvgAggregation

func NewWeightedAvgAggregation() *WeightedAvgAggregation

func (*WeightedAvgAggregation) Field

func (*WeightedAvgAggregation) Format

func (*WeightedAvgAggregation) Meta

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

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

func (*WeightedAvgAggregation) Source

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

func (*WeightedAvgAggregation) SubAggregation

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

func (*WeightedAvgAggregation) Value

func (*WeightedAvgAggregation) ValueType

func (a *WeightedAvgAggregation) ValueType(valueType string) *WeightedAvgAggregation

func (*WeightedAvgAggregation) Weight

type WildcardQuery

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

WildcardQuery matches documents that have fields matching a wildcard expression (not analyzed). Supported wildcards are *, which matches any character sequence (including the empty one), and ?, which matches any single character. Note this query can be slow, as it needs to iterate over many terms. In order to prevent extremely slow wildcard queries, a wildcard term should not start with one of the wildcards * or ?. The wildcard query maps to Lucene WildcardQuery.

For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/query-dsl-wildcard-query.html

func NewWildcardQuery

func NewWildcardQuery(name, wildcard string) *WildcardQuery

NewWildcardQuery creates and initializes a new WildcardQuery.

func (*WildcardQuery) Boost

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

Boost sets the boost for this query.

func (*WildcardQuery) CaseInsensitive

func (q *WildcardQuery) CaseInsensitive(caseInsensitive bool) *WildcardQuery

CaseInsensitive sets case insensitive matching of this query.

func (*WildcardQuery) QueryName

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

QueryName sets the name of this query.

func (*WildcardQuery) Rewrite

func (q *WildcardQuery) Rewrite(rewrite string) *WildcardQuery

func (*WildcardQuery) Source

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

Source returns the JSON serializable body of this query.

type WrapperQuery

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

WrapperQuery accepts any other query as base64 encoded string.

For details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-wrapper-query.html.

func NewWrapperQuery

func NewWrapperQuery(source string) *WrapperQuery

NewWrapperQuery creates and initializes a new WrapperQuery.

func (*WrapperQuery) Source

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

Source returns JSON for the query.

Source Files

Jump to

Keyboard shortcuts

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