mapping

package
v0.0.0-...-5978c11 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package mapping contains types needed for Elasticsearch but map be utilized elsewhere in the application

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMetaLimitExceeded          = errors.New("limit of 5 metadata entries exceeded")
	ErrInvalidDynamicParam        = errors.New("invalid dynamic parameter value")
	ErrInvalidIndexOptionsParam   = errors.New("invalid index options parameter value")
	ErrInvalidIndexPrefixMaxChars = errors.New("invalid index prefix max chars")
	ErrInvalidIndexPrefixMinChars = errors.New("invalid index prefix min chars")
)

Errors

View Source
var ErrFieldExists = errors.New("field already exists")
View Source
var (
	// ErrInvalidType indicates an invalid type
	ErrInvalidType = errors.New("invalid Type")
)
View Source
var FieldTypeHandlers = map[Type]func() Field{
	TypeAlias:           func() Field { return NewAliasField() },
	TypeBinary:          func() Field { return NewBinaryField() },
	TypeBoolean:         func() Field { return NewBooleanField() },
	TypeByte:            func() Field { return NewByteField() },
	TypeCompletion:      func() Field { return NewCompletionField() },
	TypeConstant:        func() Field { return NewConstantField() },
	TypeDate:            func() Field { return NewDateField() },
	TypeDateNanos:       func() Field { return NewDateNanoSecField() },
	TypeDateRange:       func() Field { return NewDateRangeField() },
	TypeDenseVector:     func() Field { return NewDenseVectorField() },
	TypeDouble:          func() Field { return NewDoubleField() },
	TypeDoubleRange:     func() Field { return NewDoubleRangeField() },
	TypeFlattened:       func() Field { return NewFlattenedField() },
	TypeFloat:           func() Field { return NewFloatField() },
	TypeFloatRange:      func() Field { return NewFloatRangeField() },
	TypeGeoPoint:        func() Field { return NewGeoPointField() },
	TypeGeoShape:        func() Field { return NewGeoShapeField() },
	TypeHalfFloat:       func() Field { return NewHalfFloatField() },
	TypeIP:              func() Field { return NewIPField() },
	TypeIPRange:         func() Field { return NewIPRangeField() },
	TypeInteger:         func() Field { return NewIntegerField() },
	TypeIntegerRange:    func() Field { return NewIntegerRangeField() },
	TypeJoin:            func() Field { return NewJoinField() },
	TypeKeyword:         func() Field { return NewKeywordField() },
	TypeLong:            func() Field { return NewLongField() },
	TypeLongRange:       func() Field { return NewLongRangeField() },
	TypeNested:          func() Field { return NewNestedField() },
	TypeObject:          func() Field { return NewObjectField() },
	TypePercolator:      func() Field { return NewPercolatorField() },
	TypeRankFeature:     func() Field { return NewRankFeatureField() },
	TypeRankFeatures:    func() Field { return NewRankFeaturesField() },
	TypeScaledFloat:     func() Field { return NewScaledFloatField() },
	TypeSearchAsYouType: func() Field { return NewSearchAsYouTypeField() },
	TypeShort:           func() Field { return NewShortField() },
	TypeText:            func() Field { return NewTextField() },
	TypeTokenCount:      func() Field { return NewTokenCountField() },
	TypeUnsignedLong:    func() Field { return NewUnsignedLongField() },
	TypeWildcardKeyword: func() Field { return NewWildcardField() },
}

FieldTypeHandlers is a map of mapping Type to func that returns a Field instantiated with the appropriate Type

Functions

This section is empty.

Types

type AliasField

type AliasField struct {
	BaseField `bson:",inline" json:",inline"`
	PathParam `bson:",inline" json:",inline"`
}

An AliasField mapping defines an alternate name for a field in the index. The alias can be used in place of the target field in search requests, and selected other APIs like field capabilities.

Alias targets

There are a few restrictions on the target of an alias:

  • The target must be a concrete field, and not an object or another field

alias.

  • The target field must exist at the time the alias is created.

  • If nested objects are defined, a field alias must have the same nested

scope as its target.

  • Additionally, a field alias can only have one target. This means that it is

not possible to use a field alias to query over multiple target fields in a single clause.

An alias can be changed to refer to a new target through a mappings update. A known limitation is that if any stored percolator queries contain the field alias, they will still refer to its original target. More information can be found in the percolator documentation.

Currently only the search and field capabilities APIs will accept and resolve field aliases. Other APIs that accept field names, such as term vectors, cannot be used with field aliases.

Finally, some queries, such as terms, geo_shape, and more_like_this, allow for fetching query information from an indexed document. Because field aliases aren’t supported when fetching documents, the part of the query that specifies the lookup path cannot refer to a field by its alias.

https://www.elastic.co/guide/en/elasticsearch/reference/current/alias.html

func NewAliasField

func NewAliasField() *AliasField

func (AliasField) Clone

func (a AliasField) Clone() Field

type AnalyzerParam

type AnalyzerParam struct {
	AnalyzerValue            string `json:"analyzer,omitempty" bson:"analyzer,omitempty"`
	SearchAnalyzerValue      string `json:"search_analyzer,omitempty" bson:"search_analyzer,omitempty"`
	SearchQuoteAnalyzerValue string `json:"search_quote_analyzer,omitempty" bson:"search_quote_analyzer,omitempty"`
}

AnalyzerParam adds Analyzer, SearchAnalyzer, and SearchQuoteAnalyzer

https://www.elastic.co/guide/en/elasticsearch/reference/current/analyzer.html

func (AnalyzerParam) Analyzer

func (ap AnalyzerParam) Analyzer() string

Analyzer parameter specifies the analyzer used for text analysis when indexing or searching a text field.

Unless overridden with the search_analyzer mapping parameter, this analyzer is used for both index and search analysis.

func (AnalyzerParam) SearchAnalyzer

func (ap AnalyzerParam) SearchAnalyzer() string

SearchAnalyzer overrides Analyzer for search analysis

func (AnalyzerParam) SearchQuoteAnalyzer

func (ap AnalyzerParam) SearchQuoteAnalyzer() string

SearchQuoteAnalyzer setting allows you to specify an analyzer for phrases, this is particularly useful when dealing with disabling stop words for phrase queries.

func (*AnalyzerParam) SetAnalyzer

func (ap *AnalyzerParam) SetAnalyzer(v string)

SetAnalyzer sets Analyzer to v

func (*AnalyzerParam) SetSearchAnalyzer

func (ap *AnalyzerParam) SetSearchAnalyzer(v string)

SetSearchAnalyzer sets SearchAnalyzer to v

func (AnalyzerParam) SetSearchQuoteAnalyzer

func (ap AnalyzerParam) SetSearchQuoteAnalyzer(v string)

SetSearchQuoteAnalyzer sets SearchQuoteAnalyzer to v

type BaseField

type BaseField struct {
	MappingType Type `bson:"type" json:"type"`
}

BaseField Mapping

func (BaseField) Type

func (b BaseField) Type() Type

type BinaryField

type BinaryField struct {
	BaseField      `json:",inline" bson:",inline"`
	DocValuesParam `json:",inline" bson:",inline"`
	StoreParam     `json:",inline" bson:",inline"`
}

BinaryField is a value encoded as a Base64 string.

https://www.elastic.co/guide/en/elasticsearch/reference/current/binary.html

func NewBinaryField

func NewBinaryField() *BinaryField

func (BinaryField) Clone

func (b BinaryField) Clone() Field

type BooleanField

type BooleanField struct {
	BaseField      `bson:",inline" json:",inline"`
	DocValuesParam `bson:",inline" json:",inline"`
	IndexParam     `bson:",inline" json:",inline"`
	NullValueParam `bson:",inline" json:",inline"`
	StoreParam     `bson:",inline" json:",inline"`
	MetaParam      `bson:",inline" json:",inline"`
}

BooleanField accepts JSON true and false values, but can also accept strings which are interpreted as either true or false:

False values

false, "false", "" (empty string)

True values

true, "true"

func NewBooleanField

func NewBooleanField() *BooleanField

func (BooleanField) Clone

func (b BooleanField) Clone() Field

type ByteField

type ByteField struct {
	BaseField            `bson:",inline" json:",inline"`
	CoerceParam          `bson:",inline" json:",inline"`
	DocValuesParam       `bson:",inline" json:",inline"`
	IgnoreMalformedParam `bson:",inline" json:",inline"`
	IndexParam           `bson:",inline" json:",inline"`
	NullValueParam       `bson:",inline" json:",inline"`
	StoreParam           `bson:",inline" json:",inline"`
	MetaParam            `bson:",inline" json:",inline"`
}

A ByteField is a signed 8-bit integer with a minimum value of -128 and a maximum value of 127.

https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html

func NewByteField

func NewByteField() *ByteField

func (ByteField) Clone

func (f ByteField) Clone() Field

type CoerceParam

type CoerceParam struct {
	CoerceValue *bool `bson:"coerce,omitempty" json:"coerce,omitempty"`
}

CoerceParam is a mixin for Field mapping types with coerce

Data is not always clean. Depending on how it is produced a number might be rendered in the JSON body as a true JSON number, e.g. 5, but it might also be rendered as a string, e.g. "5". Alternatively, a number that should be an integer might instead be rendered as a floating point, e.g. 5.0, or even "5.0".

Coercion attempts to clean up dirty values to fit the data type of a field. For instance:

  • Strings will be coerced to numbers.

  • Floating points will be truncated for integer values.

https://www.elastic.co/guide/en/elasticsearch/reference/current/coerce.html

func (CoerceParam) Coerce

func (cp CoerceParam) Coerce() bool

Coerce attempts to clean up dirty values to fit the data type of a field.

func (*CoerceParam) SetCoerce

func (cp *CoerceParam) SetCoerce(v bool)

SetCoerce sets CoerceParam to v

type CompletionField

type CompletionField struct {
	BaseField                       `json:",inline" bson:",inline"`
	AnalyzerParam                   `json:",inline" bson:",inline"`
	PreserveSeperatorsParam         `json:",inline" bson:",inline"`
	PreservePositionIncrementsParam `json:",inline" bson:",inline"`
	MaxInputLengthParam             `json:",inline" bson:",inline"`
}

The CompletionField is a completion suggester which provides provides auto-complete/search-as-you-type functionality. This is a navigational feature to guide users to relevant results as they are typing, improving search precision. It is not meant for spell correction or did-you-mean functionality like the term or phrase suggesters.

Ideally, auto-complete functionality should be as fast as a user types to provide instant feedback relevant to what a user has already typed in. Hence, completion suggester is optimized for speed. The suggester uses data structures that enable fast lookups, but are costly to build and are stored in-memory.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html#completion-suggester

func NewCompletionField

func NewCompletionField() *CompletionField

func (CompletionField) Clone

func (f CompletionField) Clone() Field

type ConstantField

type ConstantField struct {
	BaseField          `bson:",inline" json:",inline"`
	ConstantValueParam `bson:",inline" json:",inline"`
}

ConstantField is a specialization of the Keyword field for the case that all documentsin the index have the same value.

! X-Pack

https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html#constant-keyword-field-type

func NewConstantField

func NewConstantField() *ConstantField

func (ConstantField) Clone

func (f ConstantField) Clone() Field

type ConstantValueParam

type ConstantValueParam struct {
	ConstantValueValue interface{} `bson:"value,omitempty" json:"value,omitempty"`
}

ConstantValueParam is a mixin for mappings with the value parameter

The value to associate with all documents in the index. If this parameter is not provided, it is set based on the first document that gets indexed.

https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html#constant-keyword-params

func (ConstantValueParam) ConstantValue

func (cv ConstantValueParam) ConstantValue() interface{}

ConstantValue is the constant value used in a ConstantKeywordField ConstantValue is the value to associate with all documents in the index. If this parameter is not provided, it is set based on the first document that gets indexed.

func (*ConstantValueParam) SetConstantValue

func (cv *ConstantValueParam) SetConstantValue(v interface{})

SetConstantValue sets the ConstantValue to v

type CopyToParam

type CopyToParam struct {
	CopyToValue string `bson:"copy_to,omitempty" json:"copy_to,omitempty"`
}

CopyToParam is a Field mixin for CopyTo

The copy_to parameter allows you to copy the values of multiple fields into a group field, which can then be queried as a single field.

https://www.elastic.co/guide/en/elasticsearch/reference/current/copy-to.html

func (CopyToParam) CopyTo

func (ctp CopyToParam) CopyTo() string

CopyTo parameter allows you to copy the values of multiple fields into a group field, which can then be queried as a single field.

func (*CopyToParam) SetCopyTo

func (ctp *CopyToParam) SetCopyTo(v string)

SetCopyTo sets CopyToParam.Value to v

type DateField

type DateField struct {
	BaseField            `bson:",inline" json:",inline"`
	DocValuesParam       `bson:",inline" json:",inline"`
	FormatParam          `bson:",inline" json:",inline"`
	IgnoreMalformedParam `bson:",inline" json:",inline"`
	IndexParam           `bson:",inline" json:",inline"`
	NullValueParam       `bson:",inline" json:",inline"`
	StoreParam           `bson:",inline" json:",inline"`
	MetaParam            `bson:",inline" json:",inline"`
}

func NewDateField

func NewDateField() *DateField

func (DateField) Clone

func (f DateField) Clone() Field

type DateNanoSecField

type DateNanoSecField struct {
	BaseField            `bson:",inline" json:",inline"`
	DocValuesParam       `bson:",inline" json:",inline"`
	FormatParam          `bson:",inline" json:",inline"`
	IgnoreMalformedParam `bson:",inline" json:",inline"`
	IndexParam           `bson:",inline" json:",inline"`
	NullValueParam       `bson:",inline" json:",inline"`
	StoreParam           `bson:",inline" json:",inline"`
	MetaParam            `bson:",inline" json:",inline"`
}

DateNanoSecField is an addition to the DateField data type.

However there is an important distinction between the two. The existing date data type stores dates in millisecond resolution. The date_nanos data type stores dates in nanosecond resolution, which limits its range of dates from roughly 1970 to 2262, as dates are still stored as a long representing nanoseconds since the epoch.

Queries on nanoseconds are internally converted to range queries on this long representation, and the result of aggregations and stored fields is converted back to a string depending on the date format that is associated with the field.

Date formats can be customised, but if no format is specified then it uses the default:

"strict_date_optional_time||epoch_millis"

This means that it will accept dates with optional timestamps, which conform to the formats supported by strict_date_optional_time including up to nine second fractionals or milliseconds-since-the-epoch (thus losing precision on the nano second part). Using strict_date_optional_time will format the result up to only three second fractionals. To print and parse up to nine digits of resolution, use strict_date_optional_time_nanos.

Limitations

Aggregations are still on millisecond resolution, even when using a date_nanos field. This limitation also affects transforms.

https://www.elastic.co/guide/en/elasticsearch/reference/current/date_nanos.html

func NewDateNanoSecField

func NewDateNanoSecField() *DateNanoSecField

func (DateNanoSecField) Clone

func (f DateNanoSecField) Clone() Field

type DateRangeField

type DateRangeField struct {
	BaseField   `bson:",inline" json:",inline"`
	CoerceParam `bson:",inline" json:",inline"`
	IndexParam  `bson:",inline" json:",inline"`
	StoreParam  `bson:",inline" json:",inline"`
}

DateRangeField is a range of date values. Date ranges support various date formats through the format mapping parameter. Regardless of the format used, date values are parsed into an unsigned 64-bit integer representing milliseconds since the Unix epoch in UTC. Values containing the now date math expression are not supported.

func NewDateRangeField

func NewDateRangeField() *DateRangeField

func (DateRangeField) Clone

func (f DateRangeField) Clone() Field

type DenseVectorField

type DenseVectorField struct {
	BaseField       `json:",inline" bson:",inline"`
	DimensionsParam `json:",inline" bson:",inline"`
}

DenseVectorField stores dense vectors of float values. The maximum number of dimensions that can be in a vector should not exceed 2048. A dense_vector field is a single-valued field.

! X-Pack

These vectors can be used for document scoring. For example, a document score can represent a distance between a given query vector and the indexed document vector.

You index a dense vector as an array of floats.

https://www.elastic.co/guide/en/elasticsearch/reference/current/dense-vector.html

func NewDenseVectorField

func NewDenseVectorField() *DenseVectorField

func (DenseVectorField) Clone

func (f DenseVectorField) Clone() Field

type DimensionsParam

type DimensionsParam struct {
	DimensionsValue int `bson:"dims,omitempty" json:"dims,omitempty"`
}

DimensionsParam is a mapping with the dims parameter

dims is the number of dimensions in the vector, required parameter for fields that have it.

https://www.elastic.co/guide/en/elasticsearch/reference/current/dense-vector.html

func (DimensionsParam) Dimensions

func (d DimensionsParam) Dimensions() int

func (DimensionsParam) Dims

func (d DimensionsParam) Dims() int

Dims is the number of dimensions in the vector, required parameter.

func (*DimensionsParam) SetDimensions

func (d *DimensionsParam) SetDimensions(v int)

func (*DimensionsParam) SetDims

func (d *DimensionsParam) SetDims(v int)

SetDims sets the dimensions to v

type DocValuesParam

type DocValuesParam struct {
	DocValuesValue *bool `json:"doc_values,omitempty" bson:"doc_values,omitempty"`
}

DocValuesParam is a mixin for Mappings that have doc_values

Most fields are indexed by default, which makes them searchable. The inverted index allows queries to look up the search term in unique sorted list of terms, and from that immediately have access to the list of documents that contain the term.

Sorting, aggregations, and access to field values in scripts requires a different data access pattern. Instead of looking up the term and finding documents, we need to be able to look up the document and find the terms that it has in a field.

Doc values are the on-disk data structure, built at document index time, which makes this data access pattern possible. They store the same values as the _source but in a column-oriented fashion that is way more efficient for sorting and aggregations. Doc values are supported on almost all field types, with the notable exception of text and annotated_text fields.

All fields which support doc values have them enabled by default. If you are sure that you don’t need to sort or aggregate on a field, or access the field value from a script, you can disable doc values in order to save disk space

https://www.elastic.co/guide/en/elasticsearch/reference/current/doc-values.html

func (DocValuesParam) DocValues

func (dv DocValuesParam) DocValues() bool

DocValues returns DocValues, defaulted to true

func (*DocValuesParam) SetDocValues

func (dv *DocValuesParam) SetDocValues(v bool)

SetDocValues sets Value to v

type DoubleField

type DoubleField struct {
	BaseField            `bson:",inline" json:",inline"`
	CoerceParam          `bson:",inline" json:",inline"`
	DocValuesParam       `bson:",inline" json:",inline"`
	IgnoreMalformedParam `bson:",inline" json:",inline"`
	IndexParam           `bson:",inline" json:",inline"`
	NullValueParam       `bson:",inline" json:",inline"`
	StoreParam           `bson:",inline" json:",inline"`
	MetaParam            `bson:",inline" json:",inline"`
}

A DoubleField is a double-precision 64-bit IEEE 754 floating point number, restricted to finite values.

https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html

func NewDoubleField

func NewDoubleField() *DoubleField

func (DoubleField) Clone

func (f DoubleField) Clone() Field

type DoubleRangeField

type DoubleRangeField struct {
	BaseField   `bson:",inline" json:",inline"`
	CoerceParam `bson:",inline" json:",inline"`
	IndexParam  `bson:",inline" json:",inline"`
	StoreParam  `bson:",inline" json:",inline"`
}

DoubleRangeField is a range of double-precision 64-bit IEEE 754 floating point values.

func NewDoubleRangeField

func NewDoubleRangeField() *DoubleRangeField

func (DoubleRangeField) Clone

func (f DoubleRangeField) Clone() Field

type DynamicParam

type DynamicParam struct {
	DynamicParamValue dynamic.BoolOrString `bson:"dynamic,omitempty" json:"dynamic,omitempty"`
}

DynamicParam is a mixin for mappings with the Dynamic param

Dynamic determines whether or not new properties should be added dynamically to an existing object. Inner objects inherit the dynamic setting from their parent object or from the mapping type.

true - New fields are added to the mapping (default).

false - New fields are ignored. These fields will not be indexed or searchable but will still appear in the _source field of returned hits. These fields will not be added to the mapping, and new fields must be added explicitly.

strict - If new fields are detected, an exception is thrown and the document is rejected. New fields must be explicitly added to the mapping.

runtime - New fields are added to the mapping as runtime fields. These fields are not indexed, and are loaded from _source at query time.

https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic.html

func (DynamicParam) Dynamic

func (dp DynamicParam) Dynamic() dynamic.BoolOrString

Dynamic determines whether or not new properties should be added dynamically to an existing object. Accepts true (default), false and strict.

func (*DynamicParam) SetDynamic

func (dp *DynamicParam) SetDynamic(v interface{}) error

SetDynamic sets the value of Dynamic to v.

type EagerGlobalOrdinalsParam

type EagerGlobalOrdinalsParam struct {
	EagerGlobalOrdinalsValue *bool `bson:"eager_global_ordinals,omitempty" json:"eager_global_ordinals,omitempty"`
}

EagerGlobalOrdinalsParam is a Field mapping with the EagerGlobalOrdinals param

To support aggregations and other operations that require looking up field values on a per-document basis, Elasticsearch uses a data structure called doc values. Term-based field types such as keyword store their doc values using an ordinal mapping for a more compact representation. This mapping works by assigning each term an incremental integer or ordinal based on its lexicographic order. The field’s doc values store only the ordinals for each document instead of the original terms, with a separate lookup structure to convert between ordinals and terms.

When used during aggregations, ordinals can greatly improve performance. As an example, the terms aggregation relies only on ordinals to collect documents into buckets at the shard-level, then converts the ordinals back to their original term values when combining results across shards.

Each index segment defines its own ordinal mapping, but aggregations collect data across an entire shard. So to be able to use ordinals for shard-level operations like aggregations, Elasticsearch creates a unified mapping called global ordinals. The global ordinal mapping is built on top of segment ordinals, and works by maintaining a map from global ordinal to the local ordinal for each segment.

Global ordinals are used if a search contains any of the following components:

  • Certain bucket aggregations on keyword, ip, and flattened fields. This

includes terms aggregations as mentioned above, as well as composite, diversified_sampler, and significant_terms.

  • Bucket aggregations on text fields that require fielddata to be enabled.

  • Operations on parent and child documents from a join field, including

has_child queries and parent aggregations.

https://www.elastic.co/guide/en/elasticsearch/reference/current/eager-global-ordinals.html

func (EagerGlobalOrdinalsParam) EagerGlobalOrdinals

func (ego EagerGlobalOrdinalsParam) EagerGlobalOrdinals() bool

EagerGlobalOrdinals returns the EagerGlobalOrdinals value, defaulted to false

func (*EagerGlobalOrdinalsParam) SetEagerGlobalOrdinals

func (ego *EagerGlobalOrdinalsParam) SetEagerGlobalOrdinals(v bool)

SetEagerGlobalOrdinals sets the EagerGlobalOrdinals value to v

type EnablePositionIncrementsParam

type EnablePositionIncrementsParam struct {
	EnablePositionIncrementsValue *bool `bson:"enable_position_increments,omitempty" json:"enable_position_increments,omitempty"`
}

EnablePositionIncrementsParam is a mixin that adds the enable_position_increments param

https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html#nested-params

func (EnablePositionIncrementsParam) EnablePositionIncrements

func (epi EnablePositionIncrementsParam) EnablePositionIncrements() bool

EnablePositionIncrements deteremines if all fields in the nested object are also added to the root document as standard (flat) fields. Defaults to false

func (*EnablePositionIncrementsParam) SetEnablePositionIncrements

func (epi *EnablePositionIncrementsParam) SetEnablePositionIncrements(v bool)

SetEnablePositionIncrements sets the EnablePositionIncrements Value to v

type EnabledParam

type EnabledParam struct {
	EnabledValue *bool `bson:"enabled,omitempty" json:"enabled,omitempty"`
}

EnabledParam is a mixin for mappings that adds the enabled parameter

Enabled determines whether the JSON value given for the object field should be parsed and indexed (true, default) or completely ignored (false).

Elasticsearch tries to index all of the fields you give it, but sometimes you want to just store the field without indexing it. For instance, imagine that you are using Elasticsearch as a web session store. You may want to index the session ID and last update time, but you don’t need to query or run aggregations on the session data itself.

The enabled setting, which can be applied only to the top-level mapping definition and to object fields, causes Elasticsearch to skip parsing of the contents of the field entirely. The JSON can still be retrieved from the _source field, but it is not searchable or stored in any other way

https://www.elastic.co/guide/en/elasticsearch/reference/current/enabled.html

func (EnabledParam) Enabled

func (ep EnabledParam) Enabled() bool

Enabled determines whether the JSON value given for the object field should be parsed and indexed (true, default) or completely ignored (false).

func (*EnabledParam) SetEnabled

func (ep *EnabledParam) SetEnabled(v bool)

SetEnabled sets Enabled to v

type Field

type Field interface {
	Type() Type
	Clone() Field
}

Field is an elasticsearch field mapping

func NewField

func NewField(t Type) (Field, error)

NewField returns an instantiated Mapping

type FieldDataFrequencyFilter

type FieldDataFrequencyFilter struct {
	Min            float64 `bson:"min" json:"min"`
	Max            float64 `bson:"max" json:"max"`
	MinSegmentSize int     `bson:"min_segment_size" json:"min_segment_size"`
}

FieldDataFrequencyFilter is utilized with mappings

func (*FieldDataFrequencyFilter) Clone

type FieldDataFrequencyFilterParam

type FieldDataFrequencyFilterParam struct {
	FieldDataFrequencyFilterValue *FieldDataFrequencyFilter `bson:"fielddata_frequency_filter,omitempty" json:"fielddata_frequency_filter,omitempty"`
}

FieldDataFrequencyFilterParam is a mixin that adds the field_data_frequency_filter param

FieldDataFrequencyFilter is an expert settings which allow to decide which values to load in memory when fielddata is enabled. By default all values are loaded.

FieldData filtering can be used to reduce the number of terms loaded into memory, and thus reduce memory usage. Terms can be filtered by frequency:

The frequency filter allows you to only load terms whose document frequency falls between a min and max value, which can be expressed an absolute number (when the number is bigger than 1.0) or as a percentage (eg 0.01 is 1% and 1.0 is 100%). Frequency is calculated per segment. Percentages are based on the number of docs which have a value for the field, as opposed to all docs in the segment.

Small segments can be excluded completely by specifying the minimum number of docs that the segment should contain with min_segment_size

https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html#field-data-filtering

func (FieldDataFrequencyFilterParam) FieldDataFrequencyFilter

func (fd FieldDataFrequencyFilterParam) FieldDataFrequencyFilter() *FieldDataFrequencyFilter

FieldDataFrequencyFilter can be used to reduce the number of terms loaded into memory, and thus reduce memory usage when using FieldData filtering.

func (*FieldDataFrequencyFilterParam) SetFieldDataFrequencyFilter

func (fd *FieldDataFrequencyFilterParam) SetFieldDataFrequencyFilter(v *FieldDataFrequencyFilter)

SetFieldDataFrequencyFilter sets the FieldDataFrequencyFilter value to v

type FieldDataParam

type FieldDataParam struct {
	FieldDataValue *bool `bson:"fielddata,omitempty" json:"fielddata,omitempty"`
}

FieldDataParam is a mixin for mappings that adds the fielddata parameter

FieldData determines whether the field can use in-memory fielddata for sorting, aggregations, or scripting? Accepts true or false (default).

Text fields are searchable by default, but by default are not available for aggregations, sorting, or scripting. If you try to sort, aggregate, or access values from a script on a text field, you will see this exception:

Fielddata is disabled on text fields by default. Set fielddata=true on your_field_name in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.

Field data is the only way to access the analyzed tokens from a full text field in aggregations, sorting, or scripting. For example, a full text field like New York would get analyzed as new and york. To aggregate on these tokens requires field data.

IMPORTANT

It usually doesn’t make sense to enable fielddata on text fields. Field data is stored in the heap with the field data cache because it is expensive to calculate. Calculating the field data can cause latency spikes, and increasing heap usage is a cause of cluster performance issues.

https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html#fielddata-mapping-param

func (FieldDataParam) FieldData

func (fd FieldDataParam) FieldData() bool

FieldData determines whether the field use in-memory fielddata for sorting, aggregations, or scripting. Accepts true or false (default).

func (*FieldDataParam) SetFieldData

func (fd *FieldDataParam) SetFieldData(v bool)

SetFieldData sets FieldData to v

type FieldWIthTermVector

type FieldWIthTermVector interface {
	Field
	WithTermVector
}

FieldWIthTermVector is a Field with the term_vector paramater

type FieldWithAnalyzer

type FieldWithAnalyzer interface {
	// Analyzer parameter specifies the analyzer used for text analysis when
	// indexing or searching a text field.
	Analyzer() string
	// SetAnalyzer sets Analyzer to v
	SetAnalyzer(v string)
	// SearchAnalyzer overrides Analyzer for search analysis
	SearchAnalyzer() string
	// SetSearchAnalyzer sets SearchAnalyzer to v
	SetSearchAnalyzer(v string)
	// SearchQuoteAnalyzer setting allows you to specify an analyzer for
	// phrases, this is particularly useful when dealing with disabling stop
	// words for phrase queries.
	SearchQuoteAnalyzer() string
	// SetSearchQuoteAnalyzer sets SearchQuoteAnalyzer to v
	SetSearchQuoteAnalyzer(v string)
}

FieldWithAnalyzer is a Field mapping with an analyzer

Analyzer

The analyzer parameter specifies the analyzer used for text analysis when indexing or searching a text field.

Only text fields support the analyzer mapping parameter.

Search Quote Analyzer

The search_quote_analyzer setting allows you to specify an analyzer for phrases, this is particularly useful when dealing with disabling stop words for phrase queries.

To disable stop words for phrases a field utilising three analyzer settings will be required:

1. An analyzer setting for indexing all terms including stop words

2. A search_analyzer setting for non-phrase queries that will remove stop words

3. A search_quote_analyzer setting for phrase queries that will not remove stop words

https://www.elastic.co/guide/en/elasticsearch/reference/current/analyzer.html

type FieldWithCoerce

type FieldWithCoerce interface {
	Field
	WithCoerce
}

FieldWithCoerce has a Coerce param

Data is not always clean. Depending on how it is produced a number might be rendered in the JSON body as a true JSON number, e.g. 5, but it might also be rendered as a string, e.g. "5". Alternatively, a number that should be an integer might instead be rendered as a floating point, e.g. 5.0, or even "5.0".

Coercion attempts to clean up dirty values to fit the data type of a field. For instance:

  • Strings will be coerced to numbers.

  • Floating points will be truncated for integer values.

https://www.elastic.co/guide/en/elasticsearch/reference/current/coerce.html

type FieldWithConstantValue

type FieldWithConstantValue interface {
	Field
	WithConstantValue
}

FieldWithConstantValue is a Field mapping with the value parameter

type FieldWithCopyTo

type FieldWithCopyTo interface {
	CopyTo() string
	SetCopyTo(v string)
}

FieldWithCopyTo is a Field mapping with a CopyTo param

The copy_to parameter allows you to copy the values of multiple fields into a group field, which can then be queried as a single field.

https://www.elastic.co/guide/en/elasticsearch/reference/current/copy-to.html

type FieldWithDimensions

type FieldWithDimensions interface {
	Field
	WithDimensions
}

FieldWithDimensions is a Field mapping with the dims parameter

type FieldWithDocValues

type FieldWithDocValues interface {
	Field
}

FieldWithDocValues is a Field with a DocValues parameter

https://www.elastic.co/guide/en/elasticsearch/reference/current/doc-values.html

type FieldWithDynamic

type FieldWithDynamic interface {
	Dynamic() dynamic.BoolOrString
	// SetDynamic either accepts a string or a bool, returning an error otherwise
	SetDynamic(v interface{}) error
}

FieldWithDynamic is a field with a Dynamic param

Dynamic determines whether or not new properties should be added dynamically to an existing object. Inner objects inherit the dynamic setting from their parent object or from the mapping type.

true - New fields are added to the mapping (default).

false - New fields are ignored. These fields will not be indexed or searchable but will still appear in the _source field of returned hits. These fields will not be added to the mapping, and new fields must be added explicitly.

strict - If new fields are detected, an exception is thrown and the document is rejected. New fields must be explicitly added to the mapping.

runtime - New fields are added to the mapping as runtime fields. These fields are not indexed, and are loaded from _source at query time.

https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic.html

type FieldWithEagerGlobalOrdinals

type FieldWithEagerGlobalOrdinals interface {
	Field
	// EagerGlobalOrdinals returns the EagerGlobalOrdinals value, defaulted to false
	EagerGlobalOrdinals() bool
	// SetEagerGlobalOrdinals sets the EagerGlobalOrdinals value to v
	SetEagerGlobalOrdinals(v bool)
}

FieldWithEagerGlobalOrdinals is a Field mapping with EagerGlobalOrdinals

To support aggregations and other operations that require looking up field values on a per-document basis, Elasticsearch uses a data structure called doc values. Term-based field types such as keyword store their doc values using an ordinal mapping for a more compact representation. This mapping works by assigning each term an incremental integer or ordinal based on its lexicographic order. The field’s doc values store only the ordinals for each document instead of the original terms, with a separate lookup structure to convert between ordinals and terms.

When used during aggregations, ordinals can greatly improve performance. As an example, the terms aggregation relies only on ordinals to collect documents into buckets at the shard-level, then converts the ordinals back to their original term values when combining results across shards.

Each index segment defines its own ordinal mapping, but aggregations collect data across an entire shard. So to be able to use ordinals for shard-level operations like aggregations, Elasticsearch creates a unified mapping called global ordinals. The global ordinal mapping is built on top of segment ordinals, and works by maintaining a map from global ordinal to the local ordinal for each segment.

Global ordinals are used if a search contains any of the following components:

  • Certain bucket aggregations on keyword, ip, and flattened fields. This

includes terms aggregations as mentioned above, as well as composite, diversified_sampler, and significant_terms.

  • Bucket aggregations on text fields that require fielddata to be enabled.

  • Operations on parent and child documents from a join field, including

has_child queries and parent aggregations.

https://www.elastic.co/guide/en/elasticsearch/reference/current/eager-global-ordinals.html

type FieldWithEnablePositionIncrements

type FieldWithEnablePositionIncrements interface {
	Field
	WithIncludeInRoot
}

FieldWithEnablePositionIncrements is a Field with the enable_position_increments parameter

https://www.elastic.co/guide/en/elasticsearch/reference/current/token-count.html#token-count-params

type FieldWithEnabled

type FieldWithEnabled interface {
	Field
	WithEnabled
}

FieldWithEnabled is a Field with an Enabled param

https://www.elastic.co/guide/en/elasticsearch/reference/current/enabled.html

type FieldWithFieldData

type FieldWithFieldData interface {
	Field
	WithFieldData
}

FieldWithFieldData is a Field with a FieldData param

https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html#fielddata-mapping-param

type FieldWithFieldDataFrequencyFilter

type FieldWithFieldDataFrequencyFilter interface {
	Field
	WithFieldDataFrequencyFilter
}

FieldWithFieldDataFrequencyFilter is a Field with a FieldDataFrequencyFilter param

https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html#field-data-filtering

type FieldWithFields

type FieldWithFields interface {
	Field
	WithFields
}

FieldWithFields is a Field with the fields paramater

https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html

type FieldWithFormat

type FieldWithFormat interface {
	Field
	WithFormat
}

FieldWithFormat is a Field with a format parameter

type FieldWithIgnoreAbove

type FieldWithIgnoreAbove interface {
	Field
	WithIgnoreAbove
}

FieldWithIgnoreAbove is a Field with the IgnoreAbove param

https://www.elastic.co/guide/en/elasticsearch/reference/current/ignore-above.html

type FieldWithIgnoreMalformed

type FieldWithIgnoreMalformed interface {
	Field
	WithIgnoreMalformed
}

FieldWithIgnoreMalformed is a Field with the ignore_malformed parameter

https://www.elastic.co/guide/en/elasticsearch/reference/current/ignore-malformed.html

type FieldWithIgnoreZValue

type FieldWithIgnoreZValue interface {
	Field
	WithIgnoreZValue
}

FieldWithIgnoreZValue is a Field mapping with the ignore_z_value parameter

https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html#geo-point-params

type FieldWithIncludeInParent

type FieldWithIncludeInParent interface {
	Field
	WithIncludeInParent
}

type FieldWithIncludeInRoot

type FieldWithIncludeInRoot interface {
	Field
	WithIncludeInRoot
}

FieldWithIncludeInRoot is a Field with the include_in_root parameter

type FieldWithIndex

type FieldWithIndex interface {
	Field
	WithIndex
}

FieldWithIndex is a Field with the index parameter

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-index.html

type FieldWithIndexOptions

type FieldWithIndexOptions interface {
	Field
	WithIndexOptions
}

FieldWithIndexOptions is a Field mapping with the index_options parameter

https://www.elastic.co/guide/en/elasticsearch/reference/current/index-options.html

type FieldWithIndexPhrases

type FieldWithIndexPhrases interface {
	Field
	WithIndexPhrases
}

FieldWithIndexPhrases is a Field with the index_phrases parameter

https://www.elastic.co/guide/en/elasticsearch/reference/current/index-phrases.html#index-phrases

type FieldWithIndexPrefixes

type FieldWithIndexPrefixes interface {
	Field
	WithIndexPrefixes
}

FieldWithIndexPrefixes is a Field with index_prefix parameter

https://www.elastic.co/guide/en/elasticsearch/reference/current/index-prefixes.html

type FieldWithMaxInputLength

type FieldWithMaxInputLength interface {
	Field
	WithMaxInputLength
}

FieldWithMaxInputLength is a Field mapping with the max_input_length parameter

type FieldWithMaxShingleSize

type FieldWithMaxShingleSize interface {
	Field
	WithMaxShingleSize
}

FieldWithMaxShingleSize is a Field mapping with the max_shingle_size parameter

type FieldWithNormalizer

type FieldWithNormalizer interface {
	Field
	WithNormalizer
}

FieldWithNormalizer is a Field with the normalizer parameter

https://www.elastic.co/guide/en/elasticsearch/reference/current/normalizer.html

type FieldWithNorms

type FieldWithNorms interface {
	Field
	WithNorms
}

FieldWithNorms is a Field with the norms parameter

https://www.elastic.co/guide/en/elasticsearch/reference/current/norms.html

type FieldWithOrientation

type FieldWithOrientation interface {
	Field
	WithOrientation
}

FieldWithOrientation is a Field with the orientation paramater

type FieldWithPath

type FieldWithPath interface {
	Field
	WithPath
}

type FieldWithPositionIncrementGap

type FieldWithPositionIncrementGap interface {
	Field
	WithPositionIncrementGap
}

FieldWithPositionIncrementGap is a Field mapping with the position_increment_gap parameter

https://www.elastic.co/guide/en/elasticsearch/reference/current/position-increment-gap.html

type FieldWithPositiveScoreImpact

type FieldWithPositiveScoreImpact interface {
	Field
	WithPositiveScoreImpact
}

FieldWithPositiveScoreImpact is a Field with the positive_score_impact param

type FieldWithPreservePositionIncrements

type FieldWithPreservePositionIncrements interface {
	Field
	WithPreservePositionIncrements
}

type FieldWithPreserveSeperators

type FieldWithPreserveSeperators interface {
	Field
	WithPreserveSeperators
}

FieldWithPreserveSeperators is a Field mapping with the preserve_seperators parameter

type FieldWithProperties

type FieldWithProperties interface {
	Field
	WithFields
}

FieldWithProperties is a Field with the properties paramater

https://www.elastic.co/guide/en/elasticsearch/reference/current/properties.html

type FieldWithRelations

type FieldWithRelations interface {
	Field
	WithRelations
}

FieldWithRelations is a Field with the relations parameter

https://www.elastic.co/guide/en/elasticsearch/reference/current/parent-join.html

type FieldWithSimilarity

type FieldWithSimilarity interface {
	Field
	WithSimilarity
}

FieldWithSimilarity is a Field with the similarity paramater

type FieldWithSplitQueriesOnWhitespace

type FieldWithSplitQueriesOnWhitespace interface {
	Field
	WithSplitQueriesOnWhitespace
}

FieldWithSplitQueriesOnWhitespace is a Field with the split_queries_on_whitespace param

type FieldWithStore

type FieldWithStore interface {
	Field
	WithStore
}

FieldWithStore is a Field with a Store attribute

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-store.html

type Fields

type Fields map[string]Field

Fields are a collection of Field mappings

func (Fields) AddField

func (flds Fields) AddField(key string, field Field) error

func (Fields) Clone

func (flds Fields) Clone() Fields

func (Fields) Field

func (flds Fields) Field(key string) Field

func (Fields) SetField

func (flds Fields) SetField(key string, field Field)

func (*Fields) UnmarshalJSON

func (flds *Fields) UnmarshalJSON(data []byte) error

type FieldsParam

type FieldsParam struct {
	FieldsValue Fields `bson:"fields,omitempty" json:"fields,omitempty"`
}

FieldsParam is a mixin for mappings that adds the fields param

It is often useful to index the same field in different ways for different purposes. This is the purpose of multi-fields. For instance, a string field could be mapped as a text field for full-text search, and as a keyword field for sorting or aggregations

https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html

func (*FieldsParam) DeleteField

func (f *FieldsParam) DeleteField(key string)

DeleteField deletes the Fields entry with the given key

func (FieldsParam) Field

func (f FieldsParam) Field(key string) Field

Field returns the field with Key if it is exists, otherwise nil

func (FieldsParam) Fields

func (f FieldsParam) Fields() Fields

Fields (Multi-fields) allow the same string value to be indexed in multiple ways for different purposes, such as one field for search and a multi-field for sorting and aggregations, or the same string value analyzed by different analyzers.

func (*FieldsParam) SetField

func (f *FieldsParam) SetField(key string, v Field)

SetField sets or adds the given Field v to the Fields param. It initializes FieldsParam's Value if it is currently nil.

func (*FieldsParam) SetFields

func (f *FieldsParam) SetFields(v Fields)

SetFields sets the Fields value to v

type FlattenedField

type FlattenedField struct {
	BaseField `json:",inline" bson:",inline"`
	// DepthLimitParam - i didnt write this out yet
	DocValuesParam                `json:",inline" bson:",inline"`
	EagerGlobalOrdinalsParam      `json:",inline" bson:",inline"`
	IgnoreAboveParam              `json:",inline" bson:",inline"`
	IndexParam                    `json:",inline" bson:",inline"`
	IndexOptionsParam             `json:",inline" bson:",inline"`
	NullValueParam                `json:",inline" bson:",inline"`
	SimilarityParam               `json:",inline" bson:",inline"`
	SplitQueriesOnWhitespaceParam `json:",inline" bson:",inline"`
}

FlattenedField maps an entire object as a single field.

By default, each subfield in an object is mapped and indexed separately. If the names or types of the subfields are not known in advance, then they are mapped dynamically.

The flattened type provides an alternative approach, where the entire object is mapped as a single field. Given an object, the flattened mapping will parse out its leaf values and index them into one field as keywords. The object’s contents can then be searched through simple queries and aggregations.

This data type can be useful for indexing objects with a large or unknown number of unique keys. Only one field mapping is created for the whole JSON object, which can help prevent a mappings explosion from having too many distinct field mappings.

On the other hand, flattened object fields present a trade-off in terms of search functionality. Only basic queries are allowed, with no support for numeric range queries or highlighting. Further information on the limitations can be found in the Supported operations section.

! X-Pack

https://www.elastic.co/guide/en/elasticsearch/reference/current/flattened.html

func NewFlattenedField

func NewFlattenedField() *FlattenedField

func (FlattenedField) Clone

func (f FlattenedField) Clone() Field

type FloatField

type FloatField struct {
	BaseField            `bson:",inline" json:",inline"`
	CoerceParam          `bson:",inline" json:",inline"`
	DocValuesParam       `bson:",inline" json:",inline"`
	IgnoreMalformedParam `bson:",inline" json:",inline"`
	IndexParam           `bson:",inline" json:",inline"`
	NullValueParam       `bson:",inline" json:",inline"`
	StoreParam           `bson:",inline" json:",inline"`
	MetaParam            `bson:",inline" json:",inline"`
}

A FloatField is a single-precision 32-bit IEEE 754 floating point number, restricted to finite values.

https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html

func NewFloatField

func NewFloatField() *FloatField

func (FloatField) Clone

func (f FloatField) Clone() Field

type FloatRangeField

type FloatRangeField struct {
	BaseField   `bson:",inline" json:",inline"`
	CoerceParam `bson:",inline" json:",inline"`
	IndexParam  `bson:",inline" json:",inline"`
	StoreParam  `bson:",inline" json:",inline"`
}

FloatRangeField is a range of single-precision 32-bit IEEE 754 floating point values.

func NewFloatRangeField

func NewFloatRangeField() *FloatRangeField

func (FloatRangeField) Clone

func (f FloatRangeField) Clone() Field

type FormatParam

type FormatParam struct {
	FormatValue string `bson:"format,omitempty" json:"format,omitempty"`
}

FormatParam is a mixin that adds the format parameter to mappings

In JSON documents, dates are represented as strings. Elasticsearch uses a set of preconfigured formats to recognize and parse these strings into a long value representing milliseconds-since-the-epoch in UTC.

Besides the built-in formats, custom formats can be specified using the familiar yyyy/MM/dd syntax

"epoch_millis"

A formatter for the number of milliseconds since the epoch. Note, that this timestamp is subject to the limits of a Java Long.MIN_VALUE and Long.MAX_VALUE.

"epoch_second"

A formatter for the number of seconds since the epoch. Note, that this timestamp is subject to the limits of a Java Long.MIN_VALUE and Long. MAX_VALUE divided by 1000 (the number of milliseconds in a second).

"date_optional_time" || "strict_date_optional_time"

A generic ISO datetime parser, where the date must include the year at a minimum, and the time (separated by T), is optional. Examples: "yyyy-MM-dd'T'HH:mm:ss.SSSZ" || "yyyy-MM-dd"

"strict_date_optional_time_nanos"

A generic ISO datetime parser, where the date must include the year at a minimum, and the time (separated by T), is optional. The fraction of a second part has a nanosecond resolution. Examples: yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ or yyyy-MM-dd.

"basic_date"

A basic formatter for a full date as four digit year, two digit month of year, and two digit day of month: yyyyMMdd.

"basic_date_time"

A basic formatter that combines a basic date and time, separated by a T: yyyyMMdd'T'HHmmss.SSSZ.

"basic_date_time_no_millis"

A basic formatter that combines a basic date and time without millis, separated by a T: yyyyMMdd'T'HHmmssZ.

"basic_ordinal_date"

A formatter for a full ordinal date, using a four digit year and three digit dayOfYear: yyyyDDD.

"basic_ordinal_date_time"

A formatter for a full ordinal date and time, using a four digit year and three digit dayOfYear: yyyyDDD'T'HHmmss.SSSZ.

"basic_ordinal_date_time_no_millis"

A formatter for a full ordinal date and time without millis, using a four digit year and three digit dayOfYear: yyyyDDD'T'HHmmssZ.

"basic_time"

A basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit millis, and time zone offset: HHmmss.SSSZ.

"basic_time_no_millis"

A basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset: HHmmssZ.

"basic_t_time"

A basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit millis, and time zone off set prefixed by T: 'T'HHmmss.SSSZ.

"basic_t_time_no_millis"

A basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset prefixed by T: 'T'HHmmssZ.

"basic_week_date" || "strict_basic_week_date"

A basic formatter for a full date as four digit weekyear, two digit week of weekyear, and one digit day of week: xxxx'W'wwe.

"basic_week_date_time" || "strict_basic_week_date_time"

A basic formatter that combines a basic weekyear date and time, separated by a T: xxxx'W'wwe'T'HHmmss.SSSZ.

"basic_week_date_time_no_millis" || "strict_basic_week_date_time_no_millis"

A basic formatter that combines a basic weekyear date and time without millis, separated by a T: xxxx'W'wwe'T'HHmmssZ.

"date" || "strict_date"

A formatter for a full date as four digit year, two digit month of year, and two digit day of month: yyyy-MM-dd.

"date_hour" || "strict_date_hour"

A formatter that combines a full date and two digit hour of day: yyyy-MM-dd'T'HH.

"date_hour_minute" || "strict_date_hour_minute"

A formatter that combines a full date, two digit hour of day, and two digit minute of hour: yyyy-MM-dd'T'HH:mm.

"date_hour_minute_second" || "strict_date_hour_minute_second"

A formatter that combines a full date, two digit hour of day, two digit minute of hour, and two digit second of minute: yyyy-MM-dd'T'HH:mm:ss.

"date_hour_minute_second_fraction" || "strict_date_hour_minute_second_fraction"

A formatter that combines a full date, two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second: yyyy-MM-dd'T'HH:mm:ss.SSS.

"date_hour_minute_second_millis" || "strict_date_hour_minute_second_millis" A formatter that combines a full date, two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second: yyyy-MM-dd'T'HH:mm:ss.SSS.

"date_time" || "strict_date_time"

A formatter that combines a full date and time, separated by a T: yyyy-MM-dd'T'HH:mm:ss.SSSZZ.

"date_time_no_millis" || "strict_date_time_no_millis" A formatter that combines a full date and time without millis, separated by a T: yyyy-MM-dd'T'HH:mm:ssZZ.

"hour" || "strict_hour" A formatter for a two digit hour of day: HH

"hour_minute" || "strict_hour_minute"

A formatter for a two digit hour of day and two digit minute of hour: HH:mm.

"hour_minute_second" || "strict_hour_minute_second"

A formatter for a two digit hour of day, two digit minute of hour, and two digit second of minute: HH:mm:ss.

"hour_minute_second_fraction" || "strict_hour_minute_second_fraction"

A formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second: HH:mm:ss.SSS.

"hour_minute_second_millis" || "strict_hour_minute_second_millis"

A formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second: HH:mm:ss.SSS.

"ordinal_date" || "strict_ordinal_date"

A formatter for a full ordinal date, using a four digit year and three digit dayOfYear: yyyy-DDD.

"ordinal_date_time" || "strict_ordinal_date_time"

A formatter for a full ordinal date and time, using a four digit year and three digit dayOfYear: yyyy-DDD'T'HH:mm:ss.SSSZZ.

"ordinal_date_time_no_millis" || "strict_ordinal_date_time_no_millis"

A formatter for a full ordinal date and time without millis, using a four digit year and three digit dayOfYear: yyyy-DDD'T'HH:mm:ssZZ.

"time" || "strict_time"

A formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit fraction of second, and time zone offset: HH:mm:ss.SSSZZ.

"time_no_millis" || "strict_time_no_millis"

A formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset: HH:mm:ssZZ.

"t_time" || "strict_t_time"

A formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit fraction of second, and time zone offset prefixed by T: 'T'HH:mm:ss.SSSZZ.

"t_time_no_millis" || "strict_t_time_no_millis"

A formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset prefixed by T: 'T'HH:mm:ssZZ.

"week_date" || "strict_week_date"

A formatter for a full date as four digit weekyear, two digit week of weekyear, and one digit day of week: xxxx-'W'ww-e.

"week_date_time" || "strict_week_date_time"

A formatter that combines a full weekyear date and time, separated by a T: xxxx-'W'ww-e'T'HH:mm:ss.SSSZZ.

"week_date_time_no_millis" || "strict_week_date_time_no_millis"

A formatter that combines a full weekyear date and time without millis, separated by a T: xxxx-'W'ww-e'T'HH:mm:ssZZ.

"weekyear" || "strict_weekyear"

A formatter for a four digit weekyear: xxxx.

"weekyear_week" || "strict_weekyear_week"

A formatter for a four digit weekyear and two digit week of weekyear: xxxx-'W'ww.

"weekyear_week_day" || "strict_weekyear_week_day"

A formatter for a four digit weekyear, two digit week of weekyear, and one digit day of week: xxxx-'W'ww-e.

"year" || "strict_year"

A formatter for a four digit year: yyyy.

"year_month" || "strict_year_month"

A formatter for a four digit year and two digit month of year: yyyy-MM.

"year_month_day" || "strict_year_month_day"

A formatter for a four digit year, two digit month of year, and two digit day of month: yyyy-MM-dd.

https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html

func (FormatParam) Format

func (f FormatParam) Format() string

Format is the format(s) that the that can be parsed. Defaults to strict_date_optional_time||epoch_millis.

Multiple formats can be seperated by ||

func (*FormatParam) SetFormat

func (f *FormatParam) SetFormat(v string)

type GeoPointField

type GeoPointField struct {
	BaseField            `bson:",inline" json:",inline"`
	IgnoreMalformedParam `bson:",inline" json:",inline"`
	IgnoreZValueParam    `bson:",inline" json:",inline"`
	CoerceParam          `bson:",inline" json:",inline"`
}

A GeoPointField accepts latitude-longitude pairs, which can be used:

  • to find geo-points within a bounding box, within a certain distance of a

central point, or within a polygon or within a geo_shape query.

  • to aggregate documents geographically or by distance from a central point.

  • to integrate distance into a document’s relevance score.

  • to sort documents by distance.

Geo-points expressed as an array or string

Please note that string geo-points are ordered as lat,lon, while array geo-points are ordered as the reverse: lon,lat.

Originally, lat,lon was used for both array and string, but the array format was changed early on to conform to the format used by GeoJSON.

A point can be expressed as a geohash. Geohashes are base32 encoded strings of the bits of the latitude and longitude interleaved. Each character in a geohash adds additional 5 bits to the precision. So the longer the hash, the more precise it is. For the indexing purposed geohashs are translated into latitude-longitude pairs. During this process only first 12 characters are used, so specifying more than 12 characters in a geohash doesn’t increase the precision. The 12 characters provide 60 bits, which should reduce a possible error to less than 2cm.

https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html

func NewGeoPointField

func NewGeoPointField() *GeoPointField

func (GeoPointField) Clone

func (f GeoPointField) Clone() Field

type GeoShapeField

type GeoShapeField struct {
	BaseField            `bson:",inline" json:",inline"`
	OrientationParam     `bson:",inline" json:",inline"`
	IgnoreMalformedParam `bson:",inline" json:",inline"`
	IgnoreZValueParam    `bson:",inline" json:",inline"`
	CoerceParam          `bson:",inline" json:",inline"`
}

GeoShapeField facilitates the indexing of and searching with arbitrary geo shapes such as rectangles and polygons. It should be used when either the data being indexed or the queries being executed contain shapes other than just points.

https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-shape.html

func NewGeoShapeField

func NewGeoShapeField() *GeoShapeField

func (GeoShapeField) Clone

func (f GeoShapeField) Clone() Field

type HalfFloatField

type HalfFloatField struct {
	BaseField            `bson:",inline" json:",inline"`
	CoerceParam          `bson:",inline" json:",inline"`
	DocValuesParam       `bson:",inline" json:",inline"`
	IgnoreMalformedParam `bson:",inline" json:",inline"`
	IndexParam           `bson:",inline" json:",inline"`
	NullValueParam       `bson:",inline" json:",inline"`
	StoreParam           `bson:",inline" json:",inline"`
	MetaParam            `bson:",inline" json:",inline"`
}

A HalfFloatField is a half-precision 16-bit IEEE 754 floating point number, restricted to finite values.

https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html

func NewHalfFloatField

func NewHalfFloatField() *HalfFloatField

func (HalfFloatField) Clone

func (f HalfFloatField) Clone() Field

type IPField

type IPField struct {
	BaseField            `json:",inline" bson:",inline"`
	DocValuesParam       `json:",inline" bson:",inline"`
	IgnoreMalformedParam `json:",inline" bson:",inline"`
	IndexParam           `json:",inline" bson:",inline"`
	NullValueParam       `json:",inline" bson:",inline"`
	StoreParam           `json:",inline" bson:",inline"`
}

An IPField can index/store either IPv4 or IPv6 addresses.

https://www.elastic.co/guide/en/elasticsearch/reference/current/ip.html

func NewIPField

func NewIPField() *IPField

func (IPField) Clone

func (f IPField) Clone() Field

type IPRangeField

type IPRangeField struct {
	BaseField   `bson:",inline" json:",inline"`
	CoerceParam `bson:",inline" json:",inline"`
	IndexParam  `bson:",inline" json:",inline"`
	StoreParam  `bson:",inline" json:",inline"`
}

IPRangeField is a range of ip values supporting either IPv4 or IPv6 (or mixed) addresses.

func NewIPRangeField

func NewIPRangeField() *IPRangeField

func (IPRangeField) Clone

func (f IPRangeField) Clone() Field

type IgnoreAboveParam

type IgnoreAboveParam struct {
	IgnoreAboveValue *uint `bson:"ignore_above,omitempty" json:"ignore_above,omitempty"`
}

IgnoreAboveParam is a mixin for mappings that adds the IgnoreAbove (ignore_above) parameter

Strings longer than the ignore_above setting will not be indexed or stored. For arrays of strings, ignore_above will be applied for each array element separately and string elements longer than ignore_above will not be indexed or stored.

https://www.elastic.co/guide/en/elasticsearch/reference/current/ignore-above.html

func (IgnoreAboveParam) IgnoreAbove

func (ia IgnoreAboveParam) IgnoreAbove() uint

IgnoreAbove signiall to not index any string longer than this value. Defaults to 2147483647 so that all values would be accepted. Please however note that default dynamic mapping rules create a sub keyword field that overrides this default by setting ignore_above: 256.

func (IgnoreAboveParam) SetIgnoreAbove

func (ia IgnoreAboveParam) SetIgnoreAbove(v uint)

SetIgnoreAbove sets the IgnoreAbove value to v

type IgnoreMalformedParam

type IgnoreMalformedParam struct {
	IgnoreMalformedValue *bool `bson:"ignore_malformed,omitempty" json:"ignore_malformed,omitempty"`
}

IgnoreMalformedParam is a mixin that adds the ignore_malformed parameter to mappings

Sometimes you don’t have much control over the data that you receive. One user may send a login field that is a date, and another sends a login field that is an email address.

Trying to index the wrong data type into a field throws an exception by default, and rejects the whole document. The ignore_malformed parameter, if set to true, allows the exception to be ignored. The malformed field is not indexed, but other fields in the document are processed normally.

https://www.elastic.co/guide/en/elasticsearch/reference/current/ignore-malformed.html

func (IgnoreMalformedParam) IgnoreMalformed

func (im IgnoreMalformedParam) IgnoreMalformed() bool

IgnoreMalformed determines if malformed numbers are ignored. If true, malformed numbers are ignored. If false (default), malformed numbers throw an exception and reject the whole document.

func (*IgnoreMalformedParam) SetIgnoreMalformed

func (im *IgnoreMalformedParam) SetIgnoreMalformed(v bool)

SetIgnoreMalformed sets IgnoreMalformed to v

type IgnoreZValueParam

type IgnoreZValueParam struct {
	IgnoreZValueValue *bool `bson:"ignore_z_value,omitempty" json:"ignore_z_value,omitempty"`
}

IgnoreZValueParam is a mixin that adds the ignore_z_value parameter

If IgnoreZValue is true (default) three dimension points will be accepted (stored in source) but only latitude and longitude values will be indexed; the third dimension is ignored. If false, geo-points containing any more than latitude and longitude (two dimensions) values throw an exception and reject the whole document.

https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html#geo-point-params

func (IgnoreZValueParam) IgnoreZValue

func (izv IgnoreZValueParam) IgnoreZValue() bool

IgnoreZValue determines whether three dimension points will be indexed.

If true (default) three dimension points will be accepted (stored in source) but only latitude and longitude values will be indexed; the third dimension is ignored. If false, geo-points containing any more than latitude and longitude (two dimensions) values throw an exception and reject the whole document.

func (*IgnoreZValueParam) SetIgnoreZValue

func (izv *IgnoreZValueParam) SetIgnoreZValue(v bool)

SetIgnoreZValue sets the IgnoreZValue Value to v

type IncludeInParentParam

type IncludeInParentParam struct {
	IncludeInParentValue *bool `bson:"include_in_parent,omitempty" json:"include_in_parent,omitempty"`
}

IncludeInParentParam is a mixin that adds the include_in_parent param

https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html#nested-params

func (IncludeInParentParam) IncludeInParent

func (iip IncludeInParentParam) IncludeInParent() bool

IncludeInParent (Optional, Boolean) If true, all fields in the nested object are also added to the parent document as standard (flat) fields. Defaults to false.

func (*IncludeInParentParam) SetIncludeInParent

func (iip *IncludeInParentParam) SetIncludeInParent(v bool)

SetIncludeInParent sets the IncludeInParent Value to v

type IncludeInRootParam

type IncludeInRootParam struct {
	IncludeInRootValue *bool `bson:"include_in_root,omitempty" json:"include_in_root,omitempty"`
}

IncludeInRootParam is a mixin that adds the include_in_root param

https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html#nested-params

func (IncludeInRootParam) IncludeInRoot

func (iir IncludeInRootParam) IncludeInRoot() bool

IncludeInRoot deteremines if all fields in the nested object are also added to the root document as standard (flat) fields. Defaults to false

func (*IncludeInRootParam) SetIncludeInRoot

func (iir *IncludeInRootParam) SetIncludeInRoot(v bool)

SetIncludeInRoot sets the IncludeInRoot Value to v

type IndexOptions

type IndexOptions string

IndexOptions is an option to the the index_options parameter controls what information is added to the inverted index for search and highlighting purposes.

const (
	// IndexOptionsDocs - Only the doc number is indexed. Can answer the
	// question Does this term exist in this field?
	IndexOptionsDocs IndexOptions = "docs"
	// IndexOptionsFreqs - Doc number and term frequencies are indexed. Term
	// frequencies are used to score repeated terms higher than single terms.
	IndexOptionsFreqs IndexOptions = "freqs"
	// IndexOptionsPositions - Doc number, term frequencies, and term positions
	// (or order) are indexed. Positions can be used for proximity or phrase
	// queries.
	IndexOptionsPositions IndexOptions = "positions"
	// IndexOptionsOffsets - Doc number, term frequencies, positions, and start and end character offsets
	// (which map the term back to the original string) are indexed. Offsets are
	// used by the unified highlighter to speed up highlighting.
	IndexOptionsOffsets IndexOptions = "offsets"
)

func (IndexOptions) String

func (io IndexOptions) String() string

type IndexOptionsParam

type IndexOptionsParam struct {
	IndexOptionsValue *IndexOptions `json:"index_options,omitempty" bson:"index_options,omitempty"`
}

IndexOptionsParam is a mixin that adds the index_options param to mappings

The index_options parameter controls what information is added to the inverted index for search and highlighting purposes.

"docs"

Only the doc number is indexed. Can answer the question Does this term exist in this field?

"freqs"

Doc number and term frequencies are indexed. Term frequencies are used to score repeated terms higher than single terms.

"positions" (default)

Doc number, term frequencies, and term positions (or order) are indexed. Positions can be used for proximity or phrase queries.

"offsets"

Doc number, term frequencies, positions, and start and end character offsets (which map the term back to the original string) are indexed. Offsets are used by the unified highlighter to speed up highlighting.

https://www.elastic.co/guide/en/elasticsearch/reference/current/index-options.html

func (IndexOptionsParam) IndexOptions

func (io IndexOptionsParam) IndexOptions() IndexOptions

IndexOptions parameter controls what information is added to the inverted index for search and highlighting purposes.

func (*IndexOptionsParam) SetIndexOptions

func (io *IndexOptionsParam) SetIndexOptions(v IndexOptions) error

SetIndexOptions sets IndexOptions value to v

type IndexParam

type IndexParam struct {
	IndexValue *bool `bson:"index,omitempty" json:"index,omitempty"`
}

IndexParam is a mapping mixin that adds the index parameter

The index parameter controls whether field values are indexed. It accepts true or false and defaults to true. Fields that are not indexed are not queryable.

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-index.html

func (IndexParam) Index

func (i IndexParam) Index() bool

Index controls whether field values are indexed. It accepts true or false and defaults to true. Fields that are not indexed are not queryable.

func (*IndexParam) SetIndex

func (i *IndexParam) SetIndex(v bool)

SetIndex sets the Index value to v

Index controls whether field values are indexed. It accepts true or false and defaults to true. Fields that are not indexed are not queryable.

type IndexPhrasesParam

type IndexPhrasesParam struct {
	IndexPhrasesValue *bool `bson:"index_phrases,omitempty" json:"index_phrases,omitempty"`
}

IndexPhrasesParam is a mixin that adds the index_phrases parameter

If IndexPhrases parameter is enabled, two-term word combinations (shingles) are indexed into a separate field. This allows exact phrase queries (no slop) to run more efficiently, at the expense of a larger index. Note that this works best when stopwords are not removed, as phrases containing stopwords will not use the subsidiary field and will fall back to a standard phrase query. Accepts true or false (default).

https://www.elastic.co/guide/en/elasticsearch/reference/current/index-phrases.html#index-phrases

func (IndexPhrasesParam) IndexPhrases

func (cp IndexPhrasesParam) IndexPhrases() bool

IndexPhrases is a param that if enabled, two-term word combinations (shingles) are indexed into a separate field. This allows exact phrase queries (no slop) to run more efficiently, at the expense of a larger index.

Note that this works best when stopwords are not removed, as phrases containing stopwords will not use the subsidiary field and will fall back to a standard phrase query. Accepts true or false (default).

func (*IndexPhrasesParam) SetIndexPhrases

func (cp *IndexPhrasesParam) SetIndexPhrases(v bool)

SetIndexPhrases sets the IndexPhrases value to v

type IndexPrefixes

type IndexPrefixes struct {
	MinimumChars *uint `bson:"min_chars,omitempty" json:"min_chars,omitempty"`
	MaximumChars *uint `bson:"max_chars,omitempty" json:"max_chars,omitempty"`
}

func (*IndexPrefixes) Clone

func (ip *IndexPrefixes) Clone() *IndexPrefixes

type IndexPrefixesParams

type IndexPrefixesParams struct {
	IndexPrefixesValue *IndexPrefixes `bson:"index_prefixes,omitempty" json:"index_prefixes,omitempty"`
}

IndexPrefixesParams is a mixin that adds the index_prefixes param

The index_prefixes parameter enables the indexing of term prefixes to speed up prefix searches. It accepts the following optional settings

https://www.elastic.co/guide/en/elasticsearch/reference/current/index-prefixes.html

func (IndexPrefixesParams) IndexPrefixesMaxChars

func (ip IndexPrefixesParams) IndexPrefixesMaxChars() uint

IndexPrefixesMaxChars is the maximum prefix length to index. Must be less than 20, and defaults to 5. The value is inclusive.

func (IndexPrefixesParams) IndexPrefixesMinChars

func (ip IndexPrefixesParams) IndexPrefixesMinChars() uint

IndexPrefixesMinChars is the minimum prefix length to index. Must be greater than 0, and defaults to 2. The value is inclusive.

func (*IndexPrefixesParams) SetIndexPrefixesMaxChars

func (ip *IndexPrefixesParams) SetIndexPrefixesMaxChars(v uint) error

SetIndexPrefixesMaxChars sets the maximum prefix length to index. Must be less than 20, and defaults to 5. The value is inclusive.

func (*IndexPrefixesParams) SetIndexPrefixesMinChars

func (ip *IndexPrefixesParams) SetIndexPrefixesMinChars(v uint) error

SetIndexPrefixesMinChars sets the minimum prefix length to index. Must be greater than 0, and defaults to 2. The value is inclusive.

type IntegerField

type IntegerField struct {
	BaseField            `bson:",inline" json:",inline"`
	CoerceParam          `bson:",inline" json:",inline"`
	DocValuesParam       `bson:",inline" json:",inline"`
	IgnoreMalformedParam `bson:",inline" json:",inline"`
	IndexParam           `bson:",inline" json:",inline"`
	NullValueParam       `bson:",inline" json:",inline"`
	StoreParam           `bson:",inline" json:",inline"`
	MetaParam            `bson:",inline" json:",inline"`
}

An IntegerField is a signed 64-bit integer with a minimum value of -263 and a maximum value of 263-1.

https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html

func NewIntegerField

func NewIntegerField() *IntegerField

func (IntegerField) Clone

func (f IntegerField) Clone() Field

type IntegerRangeField

type IntegerRangeField struct {
	BaseField   `bson:",inline" json:",inline"`
	CoerceParam `bson:",inline" json:",inline"`
	IndexParam  `bson:",inline" json:",inline"`
	StoreParam  `bson:",inline" json:",inline"`
}

IntegerRangeField is a range of signed 32-bit integers with a minimum value of -231 and maximum of 231-1.

func NewIntegerRangeField

func NewIntegerRangeField() *IntegerRangeField

func (IntegerRangeField) Clone

func (f IntegerRangeField) Clone() Field

type JoinField

type JoinField struct {
	BaseField                `bson:",inline" json:",inline"`
	EagerGlobalOrdinalsParam `bson:",inline" json:",inline"`
	RelationsParam           `bson:",inline" json:",inline"`
}

A JoinField is a special field that creates parent/child relation within documents of the same index. The relations section defines a set of possible relations within the documents, each relation being a parent name and a child name.

To index a document with a join, the name of the relation and the optional parent of the document must be provided in the source

When indexing parent documents, you can choose to specify just the name of the relation as a shortcut instead of encapsulating it in the normal object notation

When indexing a child, the name of the relation as well as the parent id of the document must be added in the _source.

WARNING

It is required to index the lineage of a parent in the same shard so you must always route child documents using their greater parent id.

Parent-join and performance

The join field shouldn’t be used like joins in a relation database. In Elasticsearch the key to good performance is to de-normalize your data into documents. Each join field, has_child or has_parent query adds a significant tax to your query performance. It can also trigger global ordinals to be built.

The only case where the join field makes sense is if your data contains a one-to-many relationship where one entity significantly outnumbers the other entity. An example of such case is a use case with products and offers for these products. In the case that offers significantly outnumbers the number of products then it makes sense to model the product as parent document and the offer as child document.

Parent-join restrictions

Only one join field mapping is allowed per index.

  • Parent and child documents must be indexed on the same shard. This means

that the same routing value needs to be provided when getting, deleting, or updating a child document.

  • An element can have multiple children but only one parent.

  • It is possible to add a new relation to an existing join field.

  • It is also possible to add a child to an existing element but only if the

element is already a parent.

Searching with parent-join

The parent-join creates one field to index the name of the relation within the document (my_parent, my_child, …​).

It also creates one field per parent/child relation. The name of this field is the name of the join field followed by # and the name of the parent in the relation. So for instance for the my_parent → [my_child, another_child] relation, the join field creates an additional field named my_join_field#my_parent.

This field contains the parent _id that the document links to if the document is a child (my_child or another_child) and the _id of document if it’s a parent (my_parent).

When searching an index that contains a join field, these two fields are always returned in the search response

Parent-join queries and aggregations

See the has_child and has_parent queries, the children aggregation, and inner hits for more information.

The value of the join field is accessible in aggregations and scripts, and may be queried with the parent_id query

Global ordinals

The join field uses global ordinals to speed up joins. Global ordinals need to be rebuilt after any change to a shard. The more parent id values are stored in a shard, the longer it takes to rebuild the global ordinals for the join field.

Global ordinals, by default, are built eagerly: if the index has changed, global ordinals for the join field will be rebuilt as part of the refresh. This can add significant time to the refresh. However most of the times this is the right trade-off, otherwise global ordinals are rebuilt when the first parent-join query or aggregation is used. This can introduce a significant latency spike for your users and usually this is worse as multiple global ordinals for the join field may be attempt rebuilt within a single refresh interval when many writes are occurring.

When the join field is used infrequently and writes occur frequently it may make sense to disable eager loading:

Multiple children per parent

It is also possible to define multiple children for a single parent

Using multiple levels of relations to replicate a relational model is not recommended. Each level of relation adds an overhead at query time in terms of memory and computation. You should de-normalize your data if you care about performance.

https://www.elastic.co/guide/en/elasticsearch/reference/current/parent-join.html

func NewJoinField

func NewJoinField() *JoinField

func (JoinField) Clone

func (f JoinField) Clone() Field

type KeywordField

type KeywordField struct {
	BaseField                     `bson:",inline" json:",inline"`
	DocValuesParam                `bson:",inline" json:",inline"`
	EagerGlobalOrdinalsParam      `bson:",inline" json:",inline"`
	FieldsParam                   `bson:",inline" json:",inline"`
	IgnoreAboveParam              `bson:",inline" json:",inline"`
	IndexParam                    `bson:",inline" json:",inline"`
	IndexOptionsParam             `bson:",inline" json:",inline"`
	NormsParam                    `bson:",inline" json:",inline"`
	NullValueParam                `bson:",inline" json:",inline"`
	StoreParam                    `bson:",inline" json:",inline"`
	SimilarityParam               `bson:",inline" json:",inline"`
	NormalizerParam               `bson:",inline" json:",inline"`
	SplitQueriesOnWhitespaceParam `bson:",inline" json:",inline"`
	MetaParam                     `bson:",inline" json:",inline"`
}

KeywordField keyword, which is used for structured content such as IDs, email addresses, hostnames, status codes, zip codes, or tags.

https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html#keyword-field-type

func NewKeywordField

func NewKeywordField() *KeywordField

func (KeywordField) Clone

func (f KeywordField) Clone() Field

type LongField

type LongField struct {
	BaseField            `bson:",inline" json:",inline"`
	CoerceParam          `bson:",inline" json:",inline"`
	DocValuesParam       `bson:",inline" json:",inline"`
	IgnoreMalformedParam `bson:",inline" json:",inline"`
	IndexParam           `bson:",inline" json:",inline"`
	NullValueParam       `bson:",inline" json:",inline"`
	StoreParam           `bson:",inline" json:",inline"`
	MetaParam            `bson:",inline" json:",inline"`
}

A LongField is a signed 64-bit integer with a minimum value of -263 and a maximum value of 263-1.

https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html

func NewLongField

func NewLongField() *LongField

func (LongField) Clone

func (f LongField) Clone() Field

type LongRangeField

type LongRangeField struct {
	BaseField   `bson:",inline" json:",inline"`
	CoerceParam `bson:",inline" json:",inline"`
	IndexParam  `bson:",inline" json:",inline"`
	StoreParam  `bson:",inline" json:",inline"`
}

LongRangeField is a range of signed 64-bit integers with a minimum value of -263 and maximum of 263-1.

func NewLongRangeField

func NewLongRangeField() *LongRangeField

func (LongRangeField) Clone

func (f LongRangeField) Clone() Field

type Mappings

type Mappings struct {
	Properties Fields `json:"properties"  bson:"properties"`
}

func NewMappings

func NewMappings() Mappings

type MaxInputLengthParam

type MaxInputLengthParam struct {
	MaxInputLengthValue *int `bson:"max_input_length,omitempty" json:"max_input_length,omitempty"`
}

func (MaxInputLengthParam) MaxInputLength

func (mil MaxInputLengthParam) MaxInputLength() int

MaxInputLength limits the length of a single input, defaults to 50 UTF-16 code points. This limit is only used at index time to reduce the total number of characters per input string in order to prevent massive inputs from bloating the underlying datastructure. Most use cases won’t be influenced by the default value since prefix completions seldom grow beyond prefixes longer than a handful of characters.

func (*MaxInputLengthParam) SetMaxInputLength

func (mil *MaxInputLengthParam) SetMaxInputLength(v int)

SetMaxInputLength sets the MaxInputLength value to v

type MaxShingleSizeParam

type MaxShingleSizeParam struct {
	MaxShingleSizeValue *int `bson:"max_shingle_size,omitempty" json:"max_shingle_size,omitempty"`
}

MaxShingleSizeParam is a mixin that adds the max_shingle_size parameter

(Optional, integer) Largest shingle size to create. Valid values are 2 (inclusive) to 4 (inclusive). Defaults to 3.

A subfield is created for each integer between 2 and this value. For example, a value of 3 creates two subfields: my_field._2gram and my_field._3gram

More subfields enables more specific queries but increases index size.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-as-you-type.html#specific-params

func (MaxShingleSizeParam) MaxShingleSize

func (mss MaxShingleSizeParam) MaxShingleSize() int

MaxShingleSize is the largest shingle size to create. Valid values are 2 (inclusive) to 4 (inclusive). Defaults to 3.

func (*MaxShingleSizeParam) SetMaxShingleSize

func (mss *MaxShingleSizeParam) SetMaxShingleSize(v int)

SetMaxShingleSize sets the MaxShingleSize to v

Valid values are 2 (inclusive) to 4 (inclusive). Defaults to 3.

type Meta

type Meta map[string]string

func (Meta) Clone

func (m Meta) Clone() Meta

func (Meta) Exists

func (m Meta) Exists(key string) bool

func (Meta) MetricType

func (m Meta) MetricType() (string, bool)

func (Meta) Set

func (m Meta) Set(key string, value string) error

func (Meta) SetMetricType

func (m Meta) SetMetricType(v string) error

func (Meta) SetUnit

func (m Meta) SetUnit(v string) error

func (Meta) Unit

func (m Meta) Unit() (string, bool)

func (Meta) Value

func (m Meta) Value(key string) (string, bool)

type MetaParam

type MetaParam struct {
	MetaValue Meta `bson:"meta,omitempty" json:"meta,omitempty"`
}

MetaParam is a mixin that adds the meta field

Metadata attached to the field. This metadata is opaque to Elasticsearch, it is only useful for multiple applications that work on the same indices to share meta information about fields such as units

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-field-meta.html#mapping-field-meta

func (MetaParam) Meta

func (m MetaParam) Meta() Meta

Meta is metadata attached to the field. This metadata is opaque to Elasticsearch, it is only useful for multiple applications that work on the same indices to share meta information about fields such as units

func (MetaParam) MetricType

func (m MetaParam) MetricType() string

MetricType is the type of a numeric field: "gauge" || "counter".

A gauge is a single-value measurement that can go up or down over time, such as a temperature. A counter is a single-value cumulative counter that only goes up, such as the number of requests processed by a web server. By default, no metric type is associated with a field. Only valid for numeric fields.

func (*MetaParam) SetMeta

func (m *MetaParam) SetMeta(v Meta) error

SetMeta sets the metadata attached to the field. This metadata is opaque to Elasticsearch, it is only useful for multiple applications that work on the same indices to share meta information about fields such as units

func (*MetaParam) SetMetricType

func (m *MetaParam) SetMetricType(v string) error

SetMetricType sets the type of a numeric field: "gauge" || "counter".

A gauge is a single-value measurement that can go up or down over time, such as a temperature. A counter is a single-value cumulative counter that only goes up, such as the number of requests processed by a web server. By default, no metric type is associated with a field. Only valid for numeric fields.

func (*MetaParam) SetUnit

func (m *MetaParam) SetUnit(u string) error

SetUnit associated with a numeric field: "percent", "byte" or a time unit.

By default, a field does not have a unit. Only valid for numeric fields. The convention for percents is to use value 1 to mean 100%.

func (MetaParam) Unit

func (m MetaParam) Unit() string

Unit associated with a numeric field: "percent", "byte" or a time unit.

By default, a field does not have a unit. Only valid for numeric fields. The convention for percents is to use value 1 to mean 100%.

type NestedField

type NestedField struct {
	BaseField            `json:",inline" bson:",inline"`
	DynamicParam         `json:",inline" bson:",inline"`
	PropertiesParam      `json:",inline" bson:",inline"`
	IncludeInParentParam `json:",inline" bson:",inline"`
	IncludeInRootParam   `json:",inline" bson:",inline"`
}

NestedField is a specialised version of the object data type that allows arrays of objects to be indexed in a way that they can be queried independently of each other.

When ingesting key-value pairs with a large, arbitrary set of keys, you might consider modeling each key-value pair as its own nested document with key and value fields. Instead, consider using the flattened data type, which maps an entire object as a single field and allows for simple searches over its contents. Nested documents and queries are typically expensive, so using the flattened data type for this use case is a better option.

Interacting with nested documents

Nested documents can be:

  • queried with the nested query.

  • analyzed with the nested and reverse_nested aggregations.

  • sorted with nested sorting.

  • retrieved and highlighted with nested inner hits.

IMPORTANT

Because nested documents are indexed as separate documents, they can only be accessed within the scope of the nested query, the nested/reverse_nested aggregations, or nested inner hits.

For instance, if a string field within a nested document has index_options set to offsets to allow use of the postings during the highlighting, these offsets will not be available during the main highlighting phase. Instead, highlighting needs to be performed via nested inner hits. The same consideration applies when loading fields during a search through docvalue_fields or stored_fields.

Limits on nested mappings and objects

As described earlier, each nested object is indexed as a separate Lucene document. Continuing with the previous example, if we indexed a single document containing 100 user objects, then 101 Lucene documents would be created: one for the parent document, and one for each nested object. Because of the expense associated with nested mappings, Elasticsearch puts settings in place to guard against performance problems:

index.mapping.nested_fields.limit

The maximum number of distinct nested mappings in an index. The nested type should only be used in special cases, when arrays of objects need to be queried independently of each other. To safeguard against poorly designed mappings, this setting limits the number of unique nested types per index. Default is 50.

index.mapping.nested_objects.limit

The maximum number of nested JSON objects that a single document can contain across all nested types. This limit helps to prevent out of memory errors when a document contains too many nested objects. Default is 10000.

To illustrate how this setting works, consider adding another nested type called comments to the previous example mapping. For each document, the combined number of user and comment objects it contains must be below the limit.

See Settings to prevent mapping explosion regarding additional settings for preventing mappings explosion. https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html

func NewNestedField

func NewNestedField() *NestedField

func (NestedField) Clone

func (f NestedField) Clone() Field

type NormalizerParam

type NormalizerParam struct {
	NormalizerValue string `bson:"normalizer,omitempty" json:"normalizer,omitempty"`
}

func (NormalizerParam) Normalizer

func (n NormalizerParam) Normalizer() string

Normalizer property of keyword fields is similar to analyzer except that it guarantees that the analysis chain produces a single token.

func (*NormalizerParam) SetNormalizer

func (n *NormalizerParam) SetNormalizer(v string)

SetNormalizer sets the Normalizer value to v

The normalizer property of keyword fields is similar to analyzer except that it guarantees that the analysis chain produces a single token.

type NormsParam

type NormsParam struct {
	NormsValue *bool `bson:"norms,omitempty" json:"norms,omitempty"`
}

NormsParam is a mixin that adds the norms parameter

Norms store various normalization factors that are later used at query time in order to compute the score of a document relatively to a query.

Although useful for scoring, norms also require quite a lot of disk (typically in the order of one byte per document per field in your index, even for documents that don’t have this specific field). As a consequence, if you don’t need scoring on a specific field, you should disable norms on that field. In particular, this is the case for fields that are used solely for filtering or aggregations.

Norms can be disabled (but not reenabled after the fact)

If updating the norms via the REST API, they will not be removed instantly, but will be removed as old segments are merged into new segments as you continue indexing new documents. Any score computation on a field that has had norms removed might return inconsistent results since some documents won’t have norms anymore while other documents might still have norms.

https://www.elastic.co/guide/en/elasticsearch/reference/current/norms.html

func (NormsParam) Norms

func (n NormsParam) Norms() bool

Norms determines whether field-length should be taken into account when scoring queries. Accepts true (default) or false.

func (*NormsParam) SetNorms

func (n *NormsParam) SetNorms(v bool)

SetNorms sets the Norms value to v

type NullValueParam

type NullValueParam struct {
	NullValueValue interface{} `bson:"null_value,omitempty" json:"null_value,omitempty"`
}

NullValueParam is a mixin that adds the null_value parameter

A null value cannot be indexed or searched. When a field is set to null, (or an empty array or an array of null values) it is treated as though that field has no values.

The null_value parameter allows you to replace explicit null values with the specified value so that it can be indexed and searched

The null_value needs to be the same data type as the field. For instance, a long field cannot have a string null_value.

https://www.elastic.co/guide/en/elasticsearch/reference/current/null-value.html

func (NullValueParam) NullValue

func (nv NullValueParam) NullValue() interface{}

NullValue parameter allows you to replace explicit null values with the specified value so that it can be indexed and searched

func (*NullValueParam) SetNullValue

func (nv *NullValueParam) SetNullValue(v interface{})

SetNullValue sets the NullValue value to v

type ObjectField

type ObjectField struct {
	BaseField       `json:",inline" bson:",inline"`
	PropertiesParam `json:",inline" bson:",inline"`
	EnabledParam    `json:",inline" bson:",inline"`
	DynamicParam    `json:",inline" bson:",inline"`
}

An ObjectField is a field type that contains other documents

JSON documents are hierarchical in nature: the document may contain inner objects which, in turn, may contain inner objects themselve

func NewObjectField

func NewObjectField() *ObjectField

func (ObjectField) Clone

func (f ObjectField) Clone() Field

type Orientation

type Orientation string
const (
	// OrientationRight - Counter-Clockwise Orientation (RIGHT)
	OrientationRight Orientation = "right"
	// OrientationCounterClockwise - Counter-Cloockwise orientation (RIGHT)
	OrientationCounterClockwise Orientation = "counterclockwise"
	// OrientationCCW - Counter-clockwise orientation (RIGHT)
	OrientationCCW Orientation = "ccw"
	// OrientationLeft - Clockwise Orientation
	OrientationLeft Orientation = "left"
	// OrientationClockwise - Clockwise Oreintation (LEFT)
	OrientationClockwise Orientation = "left"
	// OrientationCW Clockwise Orientation (LEFT)
	OrientationCW Orientation = "cw"
)

func (Orientation) IsClockwise

func (o Orientation) IsClockwise() bool

IsClockwise indicates whether the Orientation is Clockwise

func (Orientation) IsCounterClockwise

func (o Orientation) IsCounterClockwise() bool

IsCounterClockwise indicates whether the Orientation is Counter-Clockwise

func (Orientation) String

func (o Orientation) String() string

type OrientationParam

type OrientationParam struct {
	OrientationValue *Orientation `bson:"orientation,omitempty" json:"orientation,omitempty"`
}

OrientationParam is a mixin that adds the orientation parameter

Vertex order for the shape’s coordinates list.

This parameter sets and returns only a RIGHT (counterclockwise) or LEFT (clockwise) value. However, you can specify either value in multiple ways.

To set RIGHT, use one of the following arguments or its uppercase variant:

OrientationRight
OrientationCounterClockwise
OrientationCCW

To set LEFT, use one of the following arguments or its uppercase variant:

OrientationLeft
OrientationClockwise
OrientationCW

Defaults to OrientationRight (RIGHT) to comply with OGC standards. OGC standards define outer ring vertices in counterclockwise order with inner ring (hole) vertices in clockwise order.

Individual GeoJSON or WKT documents can override this parameter.

https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-shape.html#geo-shape-mapping-options

func (OrientationParam) Orientation

func (o OrientationParam) Orientation() Orientation

Orientation is the vertex order for the shape’s coordinates list.

Defaults to OrientationRight (RIGHT) to comply with OGC standards. OGC standards define outer ring vertices in counterclockwise order with inner ring (hole) vertices in clockwise order.

func (*OrientationParam) SetOrientation

func (o *OrientationParam) SetOrientation(v Orientation)

SetOrientation sets the Orientation Value to v

type PathParam

type PathParam struct {
	PathValue string `bson:"path,omitempty" json:"path,omitempty"`
}

func (PathParam) Path

func (p PathParam) Path() string

Path is the path for an alias

func (*PathParam) SetPath

func (p *PathParam) SetPath(v string)

SetPath sets the Path Value to v

type PercolatorField

type PercolatorField struct {
	BaseField `json:",inline" bson:",inline"`
}

The PercolatorField type parses a json structure into a native query and stores that query, so that the percolate query can use it to match provided documents.

Any field that contains a json object can be configured to be a percolator field. The percolator field type has no settings. Just configuring the percolator field type is sufficient to instruct Elasticsearch to treat a field as a query.

https://www.elastic.co/guide/en/elasticsearch/reference/current/percolator.html

func NewPercolatorField

func NewPercolatorField() *PercolatorField

func (PercolatorField) Clone

func (f PercolatorField) Clone() Field

type PositionIncrementGapParam

type PositionIncrementGapParam struct {
	PositionIncrementGapValue *uint `bson:"position_increment_gap,omitempty" json:"position_increment_gap,omitempty"`
}

PositionIncrementGapParam is a mixin that adds the position_increment_gap parameter

Analyzed text fields take term positions into account, in order to be able to support proximity or phrase queries. When indexing text fields with multiple values a "fake" gap is added between the values to prevent most phrase queries from matching across the values. The size of this gap is configured using position_increment_gap and defaults to 100.

https://www.elastic.co/guide/en/elasticsearch/reference/current/position-increment-gap.html

func (PositionIncrementGapParam) PositionIncrementGap

func (pig PositionIncrementGapParam) PositionIncrementGap() uint

PositionIncrementGap is the number of fake term position which should be inserted between each element of an array of strings. Defaults to the position_increment_gap configured on the analyzer which defaults to 100. 100 was chosen because it prevents phrase queries with reasonably large slops (less than 100) from matching terms across field values.

func (*PositionIncrementGapParam) SetPositionIncrementGap

func (pig *PositionIncrementGapParam) SetPositionIncrementGap(v uint)

SetPositionIncrementGap sets the PositionIncrementGap Value to v

type PositiveScoreImpactParam

type PositiveScoreImpactParam struct {
	PositiveScoreImpactValue *bool `bson:"positive_score_impact,omitempty" json:"positive_score_impact,omitempty"`
}

PositiveScoreImpactParam is a mixin that adds the positive_score_impact paramete

func (PositiveScoreImpactParam) PositiveScoreImpact

func (psi PositiveScoreImpactParam) PositiveScoreImpact() bool

PositiveScoreImpact is used by rank_feature queries to modify the scoring formula in such a way that the score increases or decreases the value of the feature

func (*PositiveScoreImpactParam) SetPositiveScoreImpact

func (psi *PositiveScoreImpactParam) SetPositiveScoreImpact(v bool)

SetPositiveScoreImpact sets the PositiveScoreImpact Value to v

type PreservePositionIncrementsParam

type PreservePositionIncrementsParam struct {
	PreservePositionIncrementsValue *bool `bson:"preserve_position_increments,omitempty" json:"preserve_position_increments,omitempty"`
}

PreservePositionIncrementsParam is a mixin that adds the preserve_position_increments param

Enables position increments, defaults to true. If disabled and using stopwords analyzer, you could get a field starting with The Beatles, if you suggest for b. Note: You could also achieve this by indexing two inputs, Beatles and The Beatles, no need to change a simple analyzer, if you are able to enrich your data.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html#completion-suggester

func (PreservePositionIncrementsParam) PreservePositionIncrements

func (ppi PreservePositionIncrementsParam) PreservePositionIncrements() bool

PreservePositionIncrements enables position increments, defaults to true. If disabled and using stopwords analyzer, you could get a field starting with The Beatles, if you suggest for b. Note: You could also achieve this by indexing two inputs, Beatles and The Beatles, no need to change a simple analyzer, if you are able to enrich your data.

func (*PreservePositionIncrementsParam) SetPreservePositionIncrements

func (ppi *PreservePositionIncrementsParam) SetPreservePositionIncrements(v bool)

SetPreservePositionIncrements sets the PreservePositionIncrements value to V

type PreserveSeperatorsParam

type PreserveSeperatorsParam struct {
	PreserveSeperatorsValue *bool `bson:"preserve_separators,omitempty" json:"preserve_separators,omitempty"`
}

PreserveSeperatorsParam is a mixin that adds the preserve_separators param

Preserves the separators, defaults to true. If disabled, you could find a field starting with Foo Fighters, if you suggest for foof.

func (PreserveSeperatorsParam) PreserveSeperators

func (ps PreserveSeperatorsParam) PreserveSeperators() bool

PreserveSeperators preserves the separators, defaults to true. If disabled, you could find a field starting with Foo Fighters, if you suggest for foof.

func (*PreserveSeperatorsParam) SetPreserveSeperators

func (ps *PreserveSeperatorsParam) SetPreserveSeperators(v bool)

SetPreserveSeperators sets the PreserveSeperatorParam value to v

type PropertiesParam

type PropertiesParam struct {
	PropertiesValue Fields `bson:"properties,omitempty" json:"properties,omitempty"`
}

PropertiesParam is a mixin for mappings that adds the properties param

Type mappings, object fields and nested fields contain sub-fields, called properties. These properties may be of any data type, including object and nested. Properties can be added:

  • explicitly by defining them when creating an index. - explicitly by

defining them when adding or updating a mapping type with the PUT mapping API. - dynamically just by indexing documents containing new fields.

https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html

func (*PropertiesParam) DeleteProperty

func (p *PropertiesParam) DeleteProperty(key string)

DeleteProperty deletes the Properties entry with the given key

func (PropertiesParam) Properties

func (p PropertiesParam) Properties() Fields

Properties are fields within the object, which can be of any data type, including object. New properties may be added to an existing object.

func (PropertiesParam) Property

func (p PropertiesParam) Property(key string) Field

Property returns the field with Key if it is exists, otherwise nil

func (*PropertiesParam) SetProperties

func (p *PropertiesParam) SetProperties(v Fields)

SetProperties sets the Properties value to v

func (*PropertiesParam) SetProperty

func (p *PropertiesParam) SetProperty(key string, v Field)

SetProperty sets or adds the given Field v to the Properties param. It initializes PropertiesParam's Value if it is currently nil.

type RankFeatureField

type RankFeatureField struct {
	BaseField                `json:",inline" bson:",inline"`
	PositiveScoreImpactParam `json:",inline" bson:",inline"`
}

A RankFeatureField can index numbers so that they can later be used to boost documents in queries with a rank_feature query.

Rank features that correlate negatively with the score should set positive_score_impact to false (defaults to true). This will be used by the rank_feature query to modify the scoring formula in such a way that the score decreases with the value of the feature instead of increasing. For instance in web search, the url length is a commonly used feature which correlates negatively with scores.

https://www.elastic.co/guide/en/elasticsearch/reference/current/rank-feature.html

func NewRankFeatureField

func NewRankFeatureField() *RankFeatureField

func (RankFeatureField) Clone

func (f RankFeatureField) Clone() Field

type RankFeaturesField

type RankFeaturesField struct {
	BaseField                `json:",inline" bson:",inline"`
	PositiveScoreImpactParam `json:",inline" bson:",inline"`
}

A RankFeaturesField can index numeric feature vectors, so that they can later be used to boost documents in queries with a rank_feature query.

It is analogous to the RankFeature data type but is better suited when the list of features is sparse so that it wouldn’t be reasonable to add one field to the mappings for each of them.

https://www.elastic.co/guide/en/elasticsearch/reference/current/rank-features.html

func NewRankFeaturesField

func NewRankFeaturesField() *RankFeaturesField

func (RankFeaturesField) Clone

func (f RankFeaturesField) Clone() Field

type Relations

Relations are used on JoinFields

https://www.elastic.co/guide/en/elasticsearch/reference/current/parent-join.html

func (Relations) Clone

func (r Relations) Clone() Relations

type RelationsParam

type RelationsParam struct {
	RelationsValue Relations `bson:"relations,omitempty" json:"relations,omitempty"`
}

RelationsParam is a mixin that adds the relations parameter

https://www.elastic.co/guide/en/elasticsearch/reference/current/parent-join.html

func (*RelationsParam) AddRelation

func (r *RelationsParam) AddRelation(key string, value dynamic.StringOrArrayOfStrings)

AddRelation adds the key to the Relations map, set to value

func (*RelationsParam) ClearRelations

func (r *RelationsParam) ClearRelations()

ClearRelations sets Value to a new, empty Relations map

func (RelationsParam) Relations

func (r RelationsParam) Relations() Relations

Relations defines a set of possible relations within the documents, each relation being a parent name and a child name. A parent/child relation can be defined as follows:

func (*RelationsParam) RemoveRelation

func (r *RelationsParam) RemoveRelation(key string)

RemoveRelation deletes the key from the Relations map

func (*RelationsParam) SetRelations

func (r *RelationsParam) SetRelations(v Relations)

SetRelations sets the value of Relations to v

type ScaledFloatField

type ScaledFloatField struct {
	BaseField            `bson:",inline" json:",inline"`
	CoerceParam          `bson:",inline" json:",inline"`
	DocValuesParam       `bson:",inline" json:",inline"`
	IgnoreMalformedParam `bson:",inline" json:",inline"`
	IndexParam           `bson:",inline" json:",inline"`
	NullValueParam       `bson:",inline" json:",inline"`
	StoreParam           `bson:",inline" json:",inline"`
	MetaParam            `bson:",inline" json:",inline"`
	ScalingFactorParam   `bson:",inline" json:",inline"`
}

A ScaledFloatField is a floating point number that is backed by a long, scaled by a fixed double scaling factor.

https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html

func NewScaledFloatField

func NewScaledFloatField() *ScaledFloatField

func (ScaledFloatField) Clone

func (f ScaledFloatField) Clone() Field

type ScalingFactorParam

type ScalingFactorParam struct {
	ScalingFactorValue float64 `json:"scaling_factor" bson:"scaling_factor"`
}

ScalingFactorParam is a mapping with the scaling_factor param

The scaling factor to use when encoding values. Values will be multiplied by this factor at index time and rounded to the closest long value. For instance, a scaled_float with a scaling_factor of 10 would internally store 2.34 as 23 and all search-time operations (queries, aggregations, sorting) will behave as if the document had a value of 2.3. High values of scaling_factor improve accuracy but also increase space requirements. This parameter is required.

https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html#scaled-float-params

func (ScalingFactorParam) ScalingFactor

func (sf ScalingFactorParam) ScalingFactor() float64

ScalingFactor to use when encoding values. Values will be multiplied by this factor at index time and rounded to the closest long value. For instance, a scaled_float with a scaling_factor of 10 would internally store 2.34 as 23 and all search-time operations (queries, aggregations, sorting) will behave as if the document had a value of 2.3. High values of scaling_factor improve accuracy but also increase space requirements. This parameter is required.

func (*ScalingFactorParam) SetScalingFactor

func (sf *ScalingFactorParam) SetScalingFactor(v float64)

SetScalingFactor sets the ScalingFactorValue to v

type SearchAsYouTypeField

type SearchAsYouTypeField struct {
	BaseField           `bson:",inline" json:",inline"`
	MaxShingleSizeParam `bson:",inline" json:",inline"`
	AnalyzerParam       `bson:",inline" json:",inline"`
	IndexParam          `bson:",inline" json:",inline"`
	IndexOptionsParam   `bson:",inline" json:",inline"`
	NormsParam          `bson:",inline" json:",inline"`
	StoreParam          `bson:",inline" json:",inline"`
	SimilarityParam     `bson:",inline" json:",inline"`
	TermVectorParam     `bson:",inline" json:",inline"`
}

SearchAsYouTypeField is a text-like field that is optimized to provide out-of-the-box support for queries that serve an as-you-type completion use case. It creates a series of subfields that are analyzed to index terms that can be efficiently matched by a query that partially matches the entire indexed text value. Both prefix completion (i.e matching terms starting at the beginning of the input) and infix completion (i.e. matching terms at any position within the input) are supported.

The size of shingles in subfields can be configured with the max_shingle_size mapping parameter. The default is 3, and valid values for this parameter are integer values 2 - 4 inclusive. Shingle subfields will be created for each shingle size from 2 up to and including the max_shingle_size. The my_field._index_prefix subfield will always use the analyzer from the shingle subfield with the max_shingle_size when constructing its own analyzer.

Increasing the max_shingle_size will improve matches for queries with more consecutive terms, at the cost of larger index size. The default max_shingle_size should usually be sufficient.

The same input text is indexed into each of these fields automatically, with their differing analysis chains, when an indexed document has a value for the root field my_field.

The most efficient way of querying to serve a search-as-you-type use case is usually a multi_match query of type bool_prefix that targets the root search_as_you_type field and its shingle subfields. This can match the query terms in any order, but will score documents higher if they contain the terms in order in a shingle subfield.

To search for documents that strictly match the query terms in order, or to search using other properties of phrase queries, use a match_phrase_prefix query on the root field. A match_phrase query can also be used if the last term should be matched exactly, and not as a prefix. Using phrase queries may be less efficient than using the match_bool_prefix query.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-as-you-type.html

func NewSearchAsYouTypeField

func NewSearchAsYouTypeField() *SearchAsYouTypeField

func (SearchAsYouTypeField) Clone

func (f SearchAsYouTypeField) Clone() Field

type ShortField

type ShortField struct {
	BaseField            `bson:",inline" json:",inline"`
	CoerceParam          `bson:",inline" json:",inline"`
	DocValuesParam       `bson:",inline" json:",inline"`
	IgnoreMalformedParam `bson:",inline" json:",inline"`
	IndexParam           `bson:",inline" json:",inline"`
	NullValueParam       `bson:",inline" json:",inline"`
	StoreParam           `bson:",inline" json:",inline"`
	MetaParam            `bson:",inline" json:",inline"`
}

A ShortField is signed 16-bit integer with a minimum value of -32,768 and a maximum value of 32,767.

https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html

func NewShortField

func NewShortField() *ShortField

func (ShortField) Clone

func (f ShortField) Clone() Field

type Similarity

type Similarity string

Similarity is mostly useful for text fields, but can also apply to other field types.

const (
	// The Okapi BM25 algorithm. The algorithm used by default in Elasticsearch and Lucene.
	//
	// https://en.wikipedia.org/wiki/Okapi_BM25
	SimilarityBM25 Similarity = "BM25"
	// SimilarityClassic is the former default in ElasticSsearch and Lucene that has since been deprecated
	//
	// Deprecated: TF/IDF algorithm, the former default in Elasticsearch and Lucene.
	SimilarityClassic Similarity = "classic"

	// SimilarityBoolean is a simple boolean similarity, which is used when
	// full-text ranking is not needed and the score should only be based on
	// whether the query terms match or not. Boolean similarity gives terms a
	// score equal to their query boost.
	SimilarityBoolean Similarity = "boolean"
)

func (Similarity) String

func (s Similarity) String() string

type SimilarityParam

type SimilarityParam struct {
	SimilarityValue *Similarity `bson:"similarity,omitempty" json:"similarity,omitempty"`
}

SimilarityParam is a mixin that adds the similarity parameter

Elasticsearch allows you to configure a scoring algorithm or similarity per field. The similarity setting provides a simple way of choosing a similarity algorithm other than the default BM25, such as TF/IDF.

Similarities are mostly useful for text fields, but can also apply to other field types.

Custom similarities can be configured by tuning the parameters of the built-in similarities. For more details about this expert options, see the similarity module.

The only similarities which can be used out of the box, without any further configuration are:

"BM25"

The Okapi BM25 algorithm. The algorithm used by default in Elasticsearch and Lucene.

"classic" (deprecated)

TF/IDF algorithm, the former default in Elasticsearch and Lucene.

"boolean"

A simple boolean similarity, which is used when full-text ranking is not needed and the score should only be based on whether the query terms match or not. Boolean similarity gives terms a score equal to their query boost.

https://www.elastic.co/guide/en/elasticsearch/reference/current/similarity.html

func (*SimilarityParam) SetSimilarity

func (s *SimilarityParam) SetSimilarity(v Similarity)

SetSimilarity sets the Similarity Value to v

func (SimilarityParam) Similarity

func (s SimilarityParam) Similarity() Similarity

Similarity is mostly useful for text fields, but can also apply to other field types.

type SplitQueriesOnWhitespaceParam

type SplitQueriesOnWhitespaceParam struct {
	SplitQueriesOnWhitespaceValue *bool `bson:"split_queries_on_whitespace,omitempty" json:"split_queries_on_whitespace,omitempty"`
}

SplitQueriesOnWhitespaceParam is a mixin that adds the split_queries_on_whitespace paramete

func (*SplitQueriesOnWhitespaceParam) SetSplitQueriesOnWhitespace

func (sq *SplitQueriesOnWhitespaceParam) SetSplitQueriesOnWhitespace(v bool)

SetSplitQueriesOnWhitespace sets the SplitQueriesOnWhitespace Value to v

func (SplitQueriesOnWhitespaceParam) SplitQueriesOnWhitespace

func (sq SplitQueriesOnWhitespaceParam) SplitQueriesOnWhitespace() bool

SplitQueriesOnWhitespace determines whether full text queries should split the input on whitespace when building a query for this field. Accepts true or false (default).

type StoreParam

type StoreParam struct {
	StoreValue *bool `bson:"store,omitempty" json:"store,omitempty"`
}

StoreParam is a mixin that adds Store and SetStore

By default, field values are indexed to make them searchable, but they are not stored. This means that the field can be queried, but the original field value cannot be retrieved.

Usually this doesn’t matter. The field value is already part of the _source field, which is stored by default. If you only want to retrieve the value of a single field or of a few fields, instead of the whole _source, then this can be achieved with source filtering.

In certain situations it can make sense to store a field. For instance, if you have a document with a title, a date, and a very large content field, you may want to retrieve just the title and the date without having to extract those fields from a large _source field

Stored fields returned as arrays

For consistency, stored fields are always returned as an array because there is no way of knowing if the original field value was a single value, multiple values, or an empty array.

The original value can be retrieved from the _source field instead.

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-store.html

func (*StoreParam) SetStore

func (sa *StoreParam) SetStore(v bool)

SetStore sets StoreAttr Value to v

func (StoreParam) Store

func (sa StoreParam) Store() bool

Store returns the StoreAttr Value or false

type TermVector

type TermVector string

TermVector indicates which Term vectors, which contain information about the terms produced by the analysis process, including:

  • a list of terms.

  • the position (or order) of each term.

  • the start and end character offsets mapping the term to its origin in the original string.

  • payloads (if they are available) — user-defined binary data associated with each term position.

  • These term vectors can be stored so that they can be retrieved for a particular document.

https://www.elastic.co/guide/en/elasticsearch/reference/current/term-vector.html

const (
	// TermVectorNone - No term vectors are stored. (default)
	TermVectorNone TermVector = "no"

	// TermVectorTerms - Just the terms in the field are stored.
	TermVectorTerms TermVector = "yes"

	// TermVectorWithPositions  - Terms and positions are stored.
	TermVectorWithPositions TermVector = "with_positions"

	// TermVectorWithOffsets - Terms and character offsets are stored.
	TermVectorWithOffsets TermVector = "with_offsets"

	// TermVectorWithPositionsOffsets  - Terms, positions, and character offsets are stored.
	TermVectorWithPositionsOffsets TermVector = "with_positions_offsets"

	// TermVectorWithPoisitionsPayloads - Terms, positions, and payloads are stored.
	TermVectorWithPoisitionsPayloads TermVector = "with_positions_payloads"

	// TTermVectorPositionsOffsetsPayloads - Terms, positions, offsets and payloads are stored
	TermVectorPositionsOffsetsPayloads TermVector = "with_positions_offsets_payloads"
)

func (TermVector) String

func (tv TermVector) String() string

type TermVectorParam

type TermVectorParam struct {
	TermVectorValue *TermVector `bson:"term_vector,omitempty" json:"term_vector,omitempty"`
}

TermVectorParam is a mixin that adds the term_vector parameter

func (*TermVectorParam) SetTermVector

func (tv *TermVectorParam) SetTermVector(v TermVector)

SetTermVector sets the TermVector Value to v

func (TermVectorParam) TermVector

func (tv TermVectorParam) TermVector() TermVector

TermVector determines whether term vectors should be stored for the field. Defaults to "no" / TermVectorNone.

type TextField

type TextField struct {
	BaseField                     `json:",inline" bson:",inline"`
	EagerGlobalOrdinalsParam      `json:",inline" bson:",inline"`
	FieldDataParam                `json:",inline" bson:",inline"`
	FieldDataFrequencyFilterParam `json:",inline" bson:",inline"`
	FieldsParam                   `json:",inline" bson:",inline"`
	IndexParam                    `json:",inline" bson:",inline"`
	IndexOptionsParam             `json:",inline" bson:",inline"`
	IndexPrefixesParams           `json:",inline" bson:",inline"`
	IndexPhrasesParam             `json:",inline" bson:",inline"`
	NormsParam                    `json:",inline" bson:",inline"`
	PositionIncrementGapParam     `json:",inline" bson:",inline"`
	StoreParam                    `json:",inline" bson:",inline"`
	AnalyzerParam                 `json:",inline" bson:",inline"`
	SimilarityParam               `json:",inline" bson:",inline"`
	TermVectorParam               `json:",inline" bson:",inline"`
	MetaParam                     `json:",inline" bson:",inline"`
}

A TextField is a field to index full-text values, such as the body of an email or the description of a product. These fields are analyzed, that is they are passed through an analyzer to convert the string into a list of individual terms before being indexed. The analysis process allows Elasticsearch to search for individual words within each full text field. Text fields are not used for sorting and seldom used for aggregations (although the significant text aggregation is a notable exception).

text fields are best suited for unstructured but human-readable content. If you need to index unstructured machine-generated content, see Mapping unstructured content.

If you need to index structured content such as email addresses, hostnames, status codes, or tags, it is likely that you should rather use a keyword field.

Use a field as both text and keyword

Sometimes it is useful to have both a full text (text) and a keyword (keyword) version of the same field: one for full text search and the other for aggregations and sorting. This can be achieved with multi-fields.

https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html

func NewTextField

func NewTextField() *TextField

func (TextField) Clone

func (f TextField) Clone() Field

type TokenCountField

type TokenCountField struct {
	BaseField                     `json:",inline" bson:",inline"`
	AnalyzerParam                 `json:",inline" bson:",inline"`
	EnablePositionIncrementsParam `json:",inline" bson:",inline"`
	DocValuesParam                `json:",inline" bson:",inline"`
	IndexParam                    `json:",inline" bson:",inline"`
	NullValueParam                `json:",inline" bson:",inline"`
	StoreParam                    `json:",inline" bson:",inline"`
}

A TokenCountField is really an integer field which accepts string values, analyzes them, then indexes the number of tokens in the string.

https://www.elastic.co/guide/en/elasticsearch/reference/current/token-count.html

func NewTokenCountField

func NewTokenCountField() *TokenCountField

func (TokenCountField) Clone

func (f TokenCountField) Clone() Field

type Type

type Type string

Type of ElasticSearch Mapping

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html#mapping-types

const (
	// TypeBinary is a value encoded as a Base64 string.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/binary.html
	TypeBinary Type = "binary"

	// TypeBoolean is for true and false values.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/boolean.html
	TypeBoolean Type = "boolean"

	// TypeKeyword is used for structured content such as
	// IDs, email addresses, hostnames, status codes, zip codes, or tags.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html#keyword-field-type
	TypeKeyword Type = "keyword"

	// TypeConstant is for keyword fields that always contain the same value.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html#constant-keyword-field-type
	TypeConstant Type = "constant_keyword"

	// TypeWildcardKeyword optimizes log lines and similar keyword values for grep-like wildcard queries.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html#wildcard-field-type
	TypeWildcardKeyword Type = "wildcard"

	// TypeLong is a signed 64-bit integer with a minimum value of -263 and a maximum value of 263-1.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html
	TypeLong Type = "long"

	// TypeInteger is a signed 32-bit integer with a minimum value of -231 and a maximum value of 231-1.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html
	TypeInteger Type = "integer"

	// TypeShort is a signed 16-bit integer with a minimum value of -32,768 and a maximum value of 32,767.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html
	TypeShort Type = "short"

	// TypeByte is a signed 8-bit integer with a minimum value of -128 and a maximum value of 127.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html
	TypeByte Type = "byte"

	// TypeDouble is a double-precision 64-bit IEEE 754 floating point number, restricted to finite values.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html
	TypeDouble Type = "double"

	// TypeFloat is a single-precision 32-bit IEEE 754 floating point number, restricted to finite values.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html
	TypeFloat Type = "float"

	// TypeHalfFloat is a half-precision 16-bit IEEE 754 floating point number, restricted to finite values.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html
	TypeHalfFloat Type = "half_float"

	// TypeScaledFloat is a floating point number that is backed by a long, scaled by a fixed double scaling factor.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html
	TypeScaledFloat Type = "scaled_float"

	// TypeUnsignedLong is an unsigned 64-bit integer with a minimum value of 0 and a maximum value of 264-1.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html
	TypeUnsignedLong Type = "unsigned_long"

	// TypeDateNanos is an addition to the date data type. However there is an important
	// distinction between the two. The existing date data type stores dates in millisecond
	// resolution. The date_nanos data type stores dates in nanosecond resolution, which
	// limits its range of dates from roughly 1970 to 2262, as dates are still stored as a
	// long representing nanoseconds since the epoch.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/date_nanos.html
	TypeDateNanos Type = "date_nanos"

	// TypeDate is a date in one of the following formats:
	//
	//  	- strings containing formatted dates, e.g. "2015-01-01" or "2015/01/01 12:10:30".
	//
	//  	- a long number representing milliseconds-since-the-epoch.
	//
	//  	- an integer representing seconds-since-the-epoch.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html
	TypeDate Type = "date"

	// TypeAlias defines an alias for an existing field.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/alias.html
	TypeAlias Type = "alias"

	// TypeObject is a JSON object.
	//
	// Options:
	//
	// dynamic - Whether or not new properties should be added dynamically to an
	// existing object. Accepts true (default), false and strict.
	//
	// enabled - Whether the JSON value given for the object field should be parsed
	// and indexed (true, default) or completely ignored (false).
	//
	// properties - The fields within the object, which can be of any data type,
	// including object. New properties may be added to an existing object.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/object.html
	TypeObject Type = "object"

	// TypeFlattened is an entire JSON object as a single field value.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/flattened.html
	TypeFlattened Type = "flattened"

	// TypeNested is a JSON object that preserves the relationship between its subfields.
	//
	// The nested type is a specialised version of the object data type that allows arrays
	// of objects to be indexed in a way that they can be queried independently of each other.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html
	TypeNested Type = "nested"

	//TypeJoin defines a parent/child relationship for documents in the same index.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/parent-join.html
	TypeJoin Type = "join"

	// TypeLongRange is a range of signed 64-bit integers with a minimum value of -263
	// and maximum of 263-1.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/range.html
	TypeLongRange Type = "long_range"

	// TypeIntegerRange is range of signed 32-bit integers with a minimum value of -231
	// and maximum of 231-1.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/range.html
	TypeIntegerRange Type = "integer_range"

	// TypeFloatRange is a range of single-precision 32-bit IEEE 754 floating point values.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/range.html
	TypeFloatRange Type = "float_range"

	// TypeDoubleRange is a range of double-precision 64-bit IEEE 754 floating point values.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/range.html
	TypeDoubleRange Type = "double_range"

	// TypeDateRange is a range of date values. Date ranges support various date formats
	// through the format mapping parameter. Regardless of the format used, date values
	// are parsed into an unsigned 64-bit integer representing milliseconds since the
	// Unix epoch in UTC. Values containing the now date math expression are not supported.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/range.html
	TypeDateRange Type = "date_range"

	// TypeIPRange is a range of ip values supporting either IPv4 or IPv6 (or mixed) addresses.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/range.html
	TypeIPRange Type = "ip_range"

	// TypeIP is IPv4 and IPv6 addresses.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/ip.html
	TypeIP Type = "ip"

	// TypeVersion is a software version. Supports Semantic Versioning precedence rules.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/version.html
	TypeVersion Type = "version"

	// TypeMurmur3 compute and stores hashes of values.
	//
	// https://www.elastic.co/guide/en/elasticsearch/plugins/7.11/mapper-murmur3.html
	TypeMurmur3 Type = "murmur3"

	// TypeAggregateMetricDouble is a pre-aggregated metric values.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/aggregate-metric-double.html
	TypeAggregateMetricDouble Type = "aggregate_metric_double"

	// TypeHistogram is a pre-aggregated numerical values in the form of a histogram.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/histogram.html
	TypeHistogram Type = "histogram"

	// TypeText is analyzed, unstructured text.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html
	TypeText Type = "text"

	// TypeAnnotatedText is text containing special markup. Used for identifying named entities.
	//
	// https://www.elastic.co/guide/en/elasticsearch/plugins/7.11/mapper-annotated-text.html
	TypeAnnotatedText Type = "annotated-text"

	// TypeCompletion is used for auto-complete suggestions.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html#completion-suggester
	TypeCompletion Type = "completion"

	// TypeSearchAsYouType is text-like type for as-you-type completion.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-as-you-type.html
	TypeSearchAsYouType Type = "search_as_you_type"

	// TypeTokenCount is a count of tokens in a text.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/token-count.html
	TypeTokenCount Type = "token_count"

	// TypeDenseVector is a Document Ranking Type that records dense vectors of float values.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/dense-vector.html
	TypeDenseVector Type = "dense_vector"

	// TypeRankFeature is a Document Ranking Type that can index numbers so that they can later
	// be used to boost documents in queries with a rank_feature query
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/rank-feature.html
	TypeRankFeature Type = "rank_feature"

	// TypeRankFeatures is a Document Ranking Type that can index numeric feature vectors,
	// so that they can later be used to boost documents in queries with a rank_feature query.
	//
	// It is analogous to the rank_feature data type but is better suited when the list of
	// features is sparse so that it wouldn’t be reasonable to add one field to the mappings
	// for each of them.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/rank-features.html
	TypeRankFeatures Type = "rank_features"

	// TypeGeoPoint is  a latitude and longitude points.
	//
	// Fields of type geo_point accept latitude-longitude pairs, which can be used:
	//
	//  	- to find geo-points within a bounding box, within a certain distance of a central point, or within a polygon or within a geo_shape query.
	//
	//  	- to aggregate documents geographically or by distance from a central point.
	//
	//  	- to integrate distance into a document’s relevance score.
	//
	//  	- to sort documents by distance.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html
	TypeGeoPoint Type = "geo_point"

	// TypeGeoShape are complex shapes, such as polygons.
	//
	// The geo_shape data type facilitates the indexing of and searching with arbitrary
	// geo shapes such as rectangles and polygons. It should be used when either the
	// data being indexed or the queries being executed contain shapes other than just
	// points.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-shape.html
	TypeGeoShape Type = "geo_shape"
	// TypePoint is an arbitrary cartesian points.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/point.html
	TypePoint Type = "point"

	// TypeShape data type facilitates the indexing of and searching with arbitrary
	// x, y cartesian shapes such as rectangles and polygons. It can be used to
	// index and query geometries whose coordinates fall in a 2-dimensional planar
	// coordinate system.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/shape.html
	TypeShape Type = "shape"

	// TypePercolator indexes queries written in Query DSL.
	//
	// The percolator field type parses a json structure into a native query and stores that
	// query, so that the percolate query can use it to match provided documents.
	//
	// Any field that contains a json object can be configured to be a percolator field.
	// The percolator field type has no settings. Just configuring the percolator field type
	// is sufficient to instruct Elasticsearch to treat a field as a query.
	//
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/percolator.html
	TypePercolator Type = "percolator"
)

type UnsignedLongField

type UnsignedLongField struct {
	BaseField            `bson:",inline" json:",inline"`
	CoerceParam          `bson:",inline" json:",inline"`
	DocValuesParam       `bson:",inline" json:",inline"`
	IgnoreMalformedParam `bson:",inline" json:",inline"`
	IndexParam           `bson:",inline" json:",inline"`
	NullValueParam       `bson:",inline" json:",inline"`
	StoreParam           `bson:",inline" json:",inline"`
	MetaParam            `bson:",inline" json:",inline"`
}

An UnsignedLongField is an unsigned 64-bit integer with a minimum value of 0 and a maximum value of 264-1.

https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html

func NewUnsignedLongField

func NewUnsignedLongField() *UnsignedLongField

func (UnsignedLongField) Clone

func (f UnsignedLongField) Clone() Field

type WildcardField

type WildcardField struct {
	BaseField        `bson:",inline" json:",inline"`
	NullValueParam   `bson:",inline" json:",inline"`
	IgnoreAboveParam `bson:",inline" json:",inline"`
}

A WildcardField stores values optimised for wildcard grep-like queries. Wildcard queries are possible on other field types but suffer from constraints:

  • text fields limit matching of any wildcard expressions to individual tokens rather than the original whole value held in a field

  • keyword fields are untokenized but slow at performing wildcard queries (especially patterns with leading wildcards).

Internally the wildcard field indexes the whole field value using ngrams and stores the full string. The index is used as a rough filter to cut down the number of values that are then checked by retrieving and checking the full values. This field is especially well suited to run grep-like queries on log lines. Storage costs are typically lower than those of keyword fields but search speeds for exact matches on full terms are slower.

Limitations

wildcard fields are untokenized like keyword fields, so do not support queries that rely on word positions such as phrase queries.

https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html#wildcard-field-type

func NewWildcardField

func NewWildcardField() *WildcardField

func (WildcardField) Clone

func (f WildcardField) Clone() Field

type WithCoerce

type WithCoerce interface {
	// Coerce attempts to clean up dirty values to fit the data type of a field.
	// For instance:
	//
	// Default: false
	Coerce() bool
	// SetCoerce sets CoerceParam to v
	SetCoerce(v bool)
}

WithCoerce has a Coerce param

type WithConstantValue

type WithConstantValue interface {
	// ConstantValue is the constant value used in a ConstantKeywordField
	// ConstantValue is the value to associate with all documents in the index.
	// If this parameter is not provided, it is set based on the first document
	// that gets indexed.
	ConstantValue() interface{}
	// SetConstantValue sets the Constant Value to v
	SetConstantValue(v interface{})
}

WithConstantValue is a mapping with the value parameter

The value to associate with all documents in the index. If this parameter is not provided, it is set based on the first document that gets indexed.

https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html#constant-keyword-params

type WithDimensions

type WithDimensions interface {
	// Dims is the number of dimensions in the vector, required parameter.
	Dims() int
	// SetDims sets the dimensions to v
	SetDims(v int)
}

WithDimensions is a mapping with the dims parameter

dims is the number of dimensions in the vector, required parameter for fields that have it.

https://www.elastic.co/guide/en/elasticsearch/reference/current/dense-vector.html

type WithDocValues

type WithDocValues interface {
	// SetDocValues sets Value to v
	SetDocValues(v bool)
	// DocValues returns DocValues, defaulted to true
	DocValues() bool
}

WithDocValues is a mapping with a DocValues parameter

Most fields are indexed by default, which makes them searchable. The inverted index allows queries to look up the search term in unique sorted list of terms, and from that immediately have access to the list of documents that contain the term.

Sorting, aggregations, and access to field values in scripts requires a different data access pattern. Instead of looking up the term and finding documents, we need to be able to look up the document and find the terms that it has in a field.

Doc values are the on-disk data structure, built at document index time, which makes this data access pattern possible. They store the same values as the _source but in a column-oriented fashion that is way more efficient for sorting and aggregations. Doc values are supported on almost all field types, with the notable exception of text and annotated_text fields.

All fields which support doc values have them enabled by default. If you are sure that you don’t need to sort or aggregate on a field, or access the field value from a script, you can disable doc values in order to save disk space

https://www.elastic.co/guide/en/elasticsearch/reference/current/doc-values.html

type WithEnablePositionIncrements

type WithEnablePositionIncrements interface {
	//Indicates if position increments should be counted. Set to false if you
	//don’t want to count tokens removed by analyzer filters (like stop).
	//Defaults to true.
	EnablePositionIncrements() bool
	// SetEnablePositionIncrements sets the EnablePositionIncrements Value to v
	SetEnablePositionIncrements(v bool)
}

WithEnablePositionIncrements is a mapping with the enable_position_increments parameter

EnablePositionIncrements Indicates if position increments should be counted. Set to false if you don’t want to count tokens removed by analyzer filters (like stop). Defaults to true.

https://www.elastic.co/guide/en/elasticsearch/reference/current/token-count.html#token-count-params

type WithEnabled

type WithEnabled interface {
	// Enabled determines whether the JSON value given for the object field should be
	// parsed and indexed (true, default) or completely ignored (false).
	Enabled() bool
	// SetEnabled sets Enabled to v
	SetEnabled(v bool)
}

WithEnabled is a mapping with an enabled parameter

Enabled determines whether the JSON value given for the object field should be parsed and indexed (true, default) or completely ignored (false).

Elasticsearch tries to index all of the fields you give it, but sometimes you want to just store the field without indexing it. For instance, imagine that you are using Elasticsearch as a web session store. You may want to index the session ID and last update time, but you don’t need to query or run aggregations on the session data itself.

The enabled setting, which can be applied only to the top-level mapping definition and to object fields, causes Elasticsearch to skip parsing of the contents of the field entirely. The JSON can still be retrieved from the _source field, but it is not searchable or stored in any other way

https://www.elastic.co/guide/en/elasticsearch/reference/current/enabled.html

type WithFieldData

type WithFieldData interface {
	// FieldData determines whether the field use in-memory fielddata for
	// sorting, aggregations, or scripting. Accepts true or false (default).
	FieldData() bool
	// SetFieldData sets FieldData to v
	SetFieldData(v bool)
}

WithFieldData is a mapping with the FieldData param

FieldData determines whether the field can use in-memory fielddata for sorting, aggregations, or scripting? Accepts true or false (default).

Text fields are searchable by default, but by default are not available for aggregations, sorting, or scripting. If you try to sort, aggregate, or access values from a script on a text field, you will see this exception:

Fielddata is disabled on text fields by default. Set fielddata=true on your_field_name in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.

Field data is the only way to access the analyzed tokens from a full text field in aggregations, sorting, or scripting. For example, a full text field like New York would get analyzed as new and york. To aggregate on these tokens requires field data.

IMPORTANT

It usually doesn’t make sense to enable fielddata on text fields. Field data is stored in the heap with the field data cache because it is expensive to calculate. Calculating the field data can cause latency spikes, and increasing heap usage is a cause of cluster performance issues.

https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html#fielddata-mapping-param

type WithFieldDataFrequencyFilter

type WithFieldDataFrequencyFilter interface {
	// FieldDataFrequencyFilter can be used to reduce the number of terms loaded
	// into memory, and thus reduce memory usage when using FieldData filtering.
	FieldDataFrequencyFilter() *FieldDataFrequencyFilter
	// SetFieldDataFrequencyFilter sets the FieldDataFrequencyFilter value to v
	SetFieldDataFrequencyFilter(v *FieldDataFrequencyFilter)
}

WithFieldDataFrequencyFilter is a mapping with the field_data_frequency_filter

FieldDataFrequencyFilter is an expert settings which allow to decide which values to load in memory when fielddata is enabled. By default all values are loaded.

FieldData filtering can be used to reduce the number of terms loaded into memory, and thus reduce memory usage. Terms can be filtered by frequency:

The frequency filter allows you to only load terms whose document frequency falls between a min and max value, which can be expressed an absolute number (when the number is bigger than 1.0) or as a percentage (eg 0.01 is 1% and 1.0 is 100%). Frequency is calculated per segment. Percentages are based on the number of docs which have a value for the field, as opposed to all docs in the segment.

Small segments can be excluded completely by specifying the minimum number of docs that the segment should contain with min_segment_size

https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html#field-data-filtering

type WithFields

type WithFields interface {
	// Fields, also known as Multi-fields, allow the same string value to be
	// indexed in multiple ways for different purposes, such as one field for
	// search and a multi-field for sorting and aggregations, or the same string
	// value analyzed by different analyzers.
	Fields() Fields
	// Field returns the field with Key if it is exists, otherwise nil
	Field(key string) Field
	// SetFields sets the Fields value to v
	SetFields(v Fields)
	// SetField sets or adds the given Field v to the Fields param. It
	// initializes FieldsParam's Value if it is currently nil.
	SetField(key string, v Field)
	// DeleteField deletes the Fields entry with the given key
	DeleteField(key string)
}

WithFields is a mixin that adds the fields param

It is often useful to index the same field in different ways for different purposes. This is the purpose of multi-fields. For instance, a string field could be mapped as a text field for full-text search, and as a keyword field for sorting or aggregations

https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html

type WithFormat

type WithFormat interface {
	//The date format(s) that can be parsed. Defaults to
	//strict_date_optional_time||epoch_millis.
	Format() string
	// SetFormat sets the Format Value to v
	SetFormat(v string)
}

WithFormat is a mapping with a format parameter

In JSON documents, dates are represented as strings. Elasticsearch uses a set of preconfigured formats to recognize and parse these strings into a long value representing milliseconds-since-the-epoch in UTC.

Besides the built-in formats, custom formats can be specified using the familiar yyyy/MM/dd syntax

"epoch_millis"

A formatter for the number of milliseconds since the epoch. Note, that this timestamp is subject to the limits of a Java Long.MIN_VALUE and Long.MAX_VALUE.

"epoch_second"

A formatter for the number of seconds since the epoch. Note, that this timestamp is subject to the limits of a Java Long.MIN_VALUE and Long. MAX_VALUE divided by 1000 (the number of milliseconds in a second).

"date_optional_time" || "strict_date_optional_time"

A generic ISO datetime parser, where the date must include the year at a minimum, and the time (separated by T), is optional. Examples: "yyyy-MM-dd'T'HH:mm:ss.SSSZ" || "yyyy-MM-dd"

"strict_date_optional_time_nanos"

A generic ISO datetime parser, where the date must include the year at a minimum, and the time (separated by T), is optional. The fraction of a second part has a nanosecond resolution. Examples: yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ or yyyy-MM-dd.

"basic_date"

A basic formatter for a full date as four digit year, two digit month of year, and two digit day of month: yyyyMMdd.

"basic_date_time"

A basic formatter that combines a basic date and time, separated by a T: yyyyMMdd'T'HHmmss.SSSZ.

"basic_date_time_no_millis"

A basic formatter that combines a basic date and time without millis, separated by a T: yyyyMMdd'T'HHmmssZ.

"basic_ordinal_date"

A formatter for a full ordinal date, using a four digit year and three digit dayOfYear: yyyyDDD.

"basic_ordinal_date_time"

A formatter for a full ordinal date and time, using a four digit year and three digit dayOfYear: yyyyDDD'T'HHmmss.SSSZ.

"basic_ordinal_date_time_no_millis"

A formatter for a full ordinal date and time without millis, using a four digit year and three digit dayOfYear: yyyyDDD'T'HHmmssZ.

"basic_time"

A basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit millis, and time zone offset: HHmmss.SSSZ.

"basic_time_no_millis"

A basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset: HHmmssZ.

"basic_t_time"

A basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit millis, and time zone off set prefixed by T: 'T'HHmmss.SSSZ.

"basic_t_time_no_millis"

A basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset prefixed by T: 'T'HHmmssZ.

"basic_week_date" || "strict_basic_week_date"

A basic formatter for a full date as four digit weekyear, two digit week of weekyear, and one digit day of week: xxxx'W'wwe.

"basic_week_date_time" || "strict_basic_week_date_time"

A basic formatter that combines a basic weekyear date and time, separated by a T: xxxx'W'wwe'T'HHmmss.SSSZ.

"basic_week_date_time_no_millis" || "strict_basic_week_date_time_no_millis"

A basic formatter that combines a basic weekyear date and time without millis, separated by a T: xxxx'W'wwe'T'HHmmssZ.

"date" || "strict_date"

A formatter for a full date as four digit year, two digit month of year, and two digit day of month: yyyy-MM-dd.

"date_hour" || "strict_date_hour"

A formatter that combines a full date and two digit hour of day: yyyy-MM-dd'T'HH.

"date_hour_minute" || "strict_date_hour_minute"

A formatter that combines a full date, two digit hour of day, and two digit minute of hour: yyyy-MM-dd'T'HH:mm.

"date_hour_minute_second" || "strict_date_hour_minute_second"

A formatter that combines a full date, two digit hour of day, two digit minute of hour, and two digit second of minute: yyyy-MM-dd'T'HH:mm:ss.

"date_hour_minute_second_fraction" || "strict_date_hour_minute_second_fraction"

A formatter that combines a full date, two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second: yyyy-MM-dd'T'HH:mm:ss.SSS.

"date_hour_minute_second_millis" || "strict_date_hour_minute_second_millis" A formatter that combines a full date, two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second: yyyy-MM-dd'T'HH:mm:ss.SSS.

"date_time" || "strict_date_time"

A formatter that combines a full date and time, separated by a T: yyyy-MM-dd'T'HH:mm:ss.SSSZZ.

"date_time_no_millis" || "strict_date_time_no_millis" A formatter that combines a full date and time without millis, separated by a T: yyyy-MM-dd'T'HH:mm:ssZZ.

"hour" || "strict_hour" A formatter for a two digit hour of day: HH

"hour_minute" || "strict_hour_minute"

A formatter for a two digit hour of day and two digit minute of hour: HH:mm.

"hour_minute_second" || "strict_hour_minute_second"

A formatter for a two digit hour of day, two digit minute of hour, and two digit second of minute: HH:mm:ss.

"hour_minute_second_fraction" || "strict_hour_minute_second_fraction"

A formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second: HH:mm:ss.SSS.

"hour_minute_second_millis" || "strict_hour_minute_second_millis"

A formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second: HH:mm:ss.SSS.

"ordinal_date" || "strict_ordinal_date"

A formatter for a full ordinal date, using a four digit year and three digit dayOfYear: yyyy-DDD.

"ordinal_date_time" || "strict_ordinal_date_time"

A formatter for a full ordinal date and time, using a four digit year and three digit dayOfYear: yyyy-DDD'T'HH:mm:ss.SSSZZ.

"ordinal_date_time_no_millis" || "strict_ordinal_date_time_no_millis"

A formatter for a full ordinal date and time without millis, using a four digit year and three digit dayOfYear: yyyy-DDD'T'HH:mm:ssZZ.

"time" || "strict_time"

A formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit fraction of second, and time zone offset: HH:mm:ss.SSSZZ.

"time_no_millis" || "strict_time_no_millis"

A formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset: HH:mm:ssZZ.

"t_time" || "strict_t_time"

A formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit fraction of second, and time zone offset prefixed by T: 'T'HH:mm:ss.SSSZZ.

"t_time_no_millis" || "strict_t_time_no_millis"

A formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset prefixed by T: 'T'HH:mm:ssZZ.

"week_date" || "strict_week_date"

A formatter for a full date as four digit weekyear, two digit week of weekyear, and one digit day of week: xxxx-'W'ww-e.

"week_date_time" || "strict_week_date_time"

A formatter that combines a full weekyear date and time, separated by a T: xxxx-'W'ww-e'T'HH:mm:ss.SSSZZ.

"week_date_time_no_millis" || "strict_week_date_time_no_millis"

A formatter that combines a full weekyear date and time without millis, separated by a T: xxxx-'W'ww-e'T'HH:mm:ssZZ.

"weekyear" || "strict_weekyear"

A formatter for a four digit weekyear: xxxx.

"weekyear_week" || "strict_weekyear_week"

A formatter for a four digit weekyear and two digit week of weekyear: xxxx-'W'ww.

"weekyear_week_day" || "strict_weekyear_week_day"

A formatter for a four digit weekyear, two digit week of weekyear, and one digit day of week: xxxx-'W'ww-e.

"year" || "strict_year"

A formatter for a four digit year: yyyy.

"year_month" || "strict_year_month"

A formatter for a four digit year and two digit month of year: yyyy-MM.

"year_month_day" || "strict_year_month_day"

A formatter for a four digit year, two digit month of year, and two digit day of month: yyyy-MM-dd.

https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html

type WithIgnoreAbove

type WithIgnoreAbove interface {
	// IgnoreAbove signiall to not index any string longer than this value.
	// Defaults to 2147483647 so that all values would be accepted. Please
	// however note that default dynamic mapping rules create a sub keyword
	// field that overrides this default by setting ignore_above: 256.
	IgnoreAbove() uint
	// SetIgnoreAbove sets the IgnoreAbove value to v
	SetIgnoreAbove(v uint)
}

WithIgnoreAbove is a mapping the ignore_above parameter

Strings longer than the ignore_above setting will not be indexed or stored. For arrays of strings, ignore_above will be applied for each array element separately and string elements longer than ignore_above will not be indexed or stored.

https://www.elastic.co/guide/en/elasticsearch/reference/current/ignore-above.html

type WithIgnoreMalformed

type WithIgnoreMalformed interface {
	// IgnoreMalformed determines if malformed numbers are ignored. If true,
	// malformed numbers are ignored. If false (default), malformed numbers
	// throw an exception and reject the whole document.
	IgnoreMalformed() bool
	// SetIgnoreMalformed sets IgnoreMalformed to v
	SetIgnoreMalformed(v bool)
}

WithIgnoreMalformed is a mapping with the ignore_malformed parameter

Sometimes you don’t have much control over the data that you receive. One user may send a login field that is a date, and another sends a login field that is an email address.

Trying to index the wrong data type into a field throws an exception by default, and rejects the whole document. The ignore_malformed parameter, if set to true, allows the exception to be ignored. The malformed field is not indexed, but other fields in the document are processed normally.

https://www.elastic.co/guide/en/elasticsearch/reference/current/ignore-malformed.html

type WithIgnoreZValue

type WithIgnoreZValue interface {
	// IgnoreZValue determines whether three dimension points will be indexed.
	//
	// If true (default) three dimension points will be accepted (stored in
	// source) but only latitude and longitude values will be indexed; the third
	// dimension is ignored. If false, geo-points containing any more than
	// latitude and longitude (two dimensions) values throw an exception and
	// reject the whole document.
	IgnoreZValue() bool
	// SetIgnoreZValue sets the IgnoreZValue Value to v
	SetIgnoreZValue(v bool)
}

WithIgnoreZValue is a mapping with the ignore_z_value parameter

If IgnoreZValue is true (default) three dimension points will be accepted (stored in source) but only latitude and longitude values will be indexed; the third dimension is ignored. If false, geo-points containing any more than latitude and longitude (two dimensions) values throw an exception and reject the whole document.

https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html#geo-point-params

type WithIncludeInParent

type WithIncludeInParent interface {
	// IncludeInParent (Optional, Boolean) If true, all fields in the nested
	// object are also added to the parent document as standard (flat) fields.
	// Defaults to false.
	IncludeInParent() bool
	// SetIncludeInParent sets the IncludeInParent Value to v
	SetIncludeInParent(v bool)
}

WithIncludeInParent is a mapping with the include_in_parent parameter

(Optional, Boolean) If true, all fields in the nested object are also added to the parent document as standard (flat) fields. Defaults to false.

https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html#nested-params

type WithIncludeInRoot

type WithIncludeInRoot interface {
	// IncludeInRoot deteremines if all fields in the nested object are also
	// added to the root document as standard (flat) fields. Defaults to false
	IncludeInRoot() bool
	// SetIncldueInRoot sets the IncludeInRoot Value to v
	SetIncludeInRoot(v bool)
}

WithIncludeInRoot is a mapping with the include_in_root parameter

(Optional, Boolean) If true, all fields in the nested object are also added to the root document as standard (flat) fields. Defaults to false

https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html#nested-params

type WithIndex

type WithIndex interface {
	Index() bool
	SetIndex(v bool)
}

WithIndex is a mapping with index parameter

The index parameter controls whether field values are indexed. It accepts true or false and defaults to true. Fields that are not indexed are not queryable.

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-index.html

type WithIndexOptions

type WithIndexOptions interface {
	//IndexOptions parameter controls what information is added to the inverted
	//index for search and highlighting purposes.
	IndexOptions() IndexOptions
	// SetIndexOptions sets IndexOptions value to v
	SetIndexOptions(v IndexOptions) error
}

WithIndexOptions is a mapping wit the index_options parameter

The index_options parameter controls what information is added to the inverted index for search and highlighting purposes.

"docs"

Only the doc number is indexed. Can answer the question Does this term exist in this field?

"freqs"

Doc number and term frequencies are indexed. Term frequencies are used to score repeated terms higher than single terms.

"positions" (default)

Doc number, term frequencies, and term positions (or order) are indexed. Positions can be used for proximity or phrase queries.

"offsets"

Doc number, term frequencies, positions, and start and end character offsets (which map the term back to the original string) are indexed. Offsets are used by the unified highlighter to speed up highlighting.

https://www.elastic.co/guide/en/elasticsearch/reference/current/index-options.html

type WithIndexPhrases

type WithIndexPhrases interface {
	// IndexPhrases is a param that if enabled, two-term word combinations
	// (shingles) are indexed into a separate field. This allows exact phrase
	// queries (no slop) to run more efficiently, at the expense of a larger index.
	//
	// Note that this works best when stopwords are not removed, as phrases
	// containing stopwords will not use the subsidiary field and will fall back to
	// a standard phrase query. Accepts true or false (default).
	IndexPhrases() bool
	// SetIndexPhrases sets the IndexPhrases value to v
	SetIndexPhrases(v bool)
}

WithIndexPhrases is a mapping with the index_phrases parameter

If IndexPhrases parameter is enabled, two-term word combinations (shingles) are indexed into a separate field. This allows exact phrase queries (no slop) to run more efficiently, at the expense of a larger index. Note that this works best when stopwords are not removed, as phrases containing stopwords will not use the subsidiary field and will fall back to a standard phrase query. Accepts true or false (default).

https://www.elastic.co/guide/en/elasticsearch/reference/current/index-phrases.html#index-phrases

type WithIndexPrefixes

type WithIndexPrefixes interface {
	// IndexPrefixesMinChars is the minimum prefix length to index. Must be
	// greater than 0, and defaults to 2. The value is inclusive.
	IndexPrefixesMinChars() uint
	// SetIndexPrefixesMinChars sets the MinChars value to v
	SetIndexPrefixesMinChars(v uint) error
	// IndexPrefixesMaxChars is the maximum prefix length to index. Must be less
	// than 20, and defaults to 5. The value is inclusive.
	IndexPrefixesMaxChars() uint
	// SetIndexPrefixesMaxChars sets the maximum
	SetIndexPrefixesMaxChars(v uint) error
}

WithIndexPrefixes is a mapping with the index_prefixes parameter

The index_prefixes parameter enables the indexing of term prefixes to speed up prefix searches. It accepts the following optional settings

https://www.elastic.co/guide/en/elasticsearch/reference/current/index-prefixes.html

type WithMaxInputLength

type WithMaxInputLength interface {
	// MaxInputLength limits the length of a single input, defaults to 50 UTF-16
	// code points. This limit is only used at index time to reduce the total
	// number of characters per input string in order to prevent massive inputs
	// from bloating the underlying datastructure. Most use cases won’t be
	// influenced by the default value since prefix completions seldom grow
	// beyond prefixes longer than a handful of characters.
	MaxInputLength() int

	// SetMaxInputLength sets the MaxInputLength value to v
	SetMaxInputLength(v int)
}

WithMaxInputLength is a mapping with the max_input_length parameter

Limits the length of a single input, defaults to 50 UTF-16 code points. This limit is only used at index time to reduce the total number of characters per input string in order to prevent massive inputs from bloating the underlying datastructure. Most use cases won’t be influenced by the default value since prefix completions seldom grow beyond prefixes longer than a handful of characters.

type WithMaxShingleSize

type WithMaxShingleSize interface {
	// MaxShingleSize is the largest shingle size to create. Valid values are 2
	// (inclusive) to 4 (inclusive). Defaults to 3.
	MaxShingleSize() int
	// SetMaxShingleSize sets the MaxShingleSize to v
	//
	// Valid values are 2 (inclusive) to 4 (inclusive). Defaults to 3.
	SetMaxShingleSize(v int)
}

WithMaxShingleSize is a mapping with the max_shingle_size parameter

(Optional, integer) Largest shingle size to create. Valid values are 2 (inclusive) to 4 (inclusive). Defaults to 3.

A subfield is created for each integer between 2 and this value. For example, a value of 3 creates two subfields: my_field._2gram and my_field._3gram

More subfields enables more specific queries but increases index size.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-as-you-type.html#specific-params

type WithMeta

type WithMeta interface {
	Meta() Meta
	SetMeta(Meta) error
	// SetUnit associated with a numeric field: "percent", "byte" or a time
	// unit. By default, a field does not have a unit. Only valid for numeric
	// fields. The convention for percents is to use value 1 to mean 100%.
	SetUnit(u string) error
	// Unit associated with a numeric field: "percent", "byte" or a time unit.
	// By default, a field does not have a unit. Only valid for numeric fields.
	// The convention for percents is to use value 1 to mean 100%.
	Unit() string
	// MetricType is the type of a numeric field: "gauge" || "counter". A gauge
	// is a single-value measurement that can go up or down over time, such as a
	// temperature. A counter is a single-value cumulative counter that only
	// goes up, such as the number of requests processed by a web server. By
	// default, no metric type is associated with a field. Only valid for
	// numeric fields.
	MetricType() string
	// SetMetricType sets the type of a numeric field: "gauge" || "counter".
	// A gauge is a single-value measurement that can go up or down over time,
	// such as a temperature. A counter is a single-value cumulative counter that
	// only goes up, such as the number of requests processed by a web server. By
	//default, no metric type is associated with a field. Only valid for numeric
	//fields.
	SetMetricType(v string) error
}

WithMeta is a mapping with the meta parameter

Meta is metadata attached to the field. This metadata is opaque to Elasticsearch, it is only useful for multiple applications that work on the same indices to share meta information about fields such as units

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-field-meta.html#mapping-field-meta

type WithNormalizer

type WithNormalizer interface {
	// Normalizer property of keyword fields is similar to analyzer except that it
	// guarantees that the analysis chain produces a single token.
	Normalizer() string
	// SetNormalizer sets the Normalizer value to v
	//
	// The normalizer property of keyword fields is similar to analyzer except that
	// it guarantees that the analysis chain produces a single token.
	SetNormalizer(v string)
}

WithNormalizer is a mixin that adds the normalizer parameter

The normalizer property of keyword fields is similar to analyzer except that it guarantees that the analysis chain produces a single token.

The normalizer is applied prior to indexing the keyword, as well as at search-time when the keyword field is searched via a query parser such as the match query or via a term-level query such as the term query.

A simple normalizer called lowercase ships with elasticsearch and can be used. Custom normalizers can be defined as part of analysis settings

https://www.elastic.co/guide/en/elasticsearch/reference/current/normalizer.html

type WithNorms

type WithNorms interface {
	// Whether field-length should be taken into account when scoring queries.
	// Accepts true (default) or false.
	Norms() bool
	// SetNorms sets the Norms value to v
	SetIndexPhrases(v bool)
}

WithNorms is a mapping with the Norms parameter

Norms store various normalization factors that are later used at query time in order to compute the score of a document relatively to a query.

Although useful for scoring, norms also require quite a lot of disk (typically in the order of one byte per document per field in your index, even for documents that don’t have this specific field). As a consequence, if you don’t need scoring on a specific field, you should disable norms on that field. In particular, this is the case for fields that are used solely for filtering or aggregations.

Norms can be disabled (but not reenabled after the fact)

If updating the norms via the REST API, they will not be removed instantly, but will be removed as old segments are merged into new segments as you continue indexing new documents. Any score computation on a field that has had norms removed might return inconsistent results since some documents won’t have norms anymore while other documents might still have norms.

https://www.elastic.co/guide/en/elasticsearch/reference/current/norms.html

type WithNullValue

type WithNullValue interface {
	// NullValue parameter allows you to replace explicit null values with the
	// specified value so that it can be indexed and searched
	NullValue() interface{}
	// SetNullValue sets the NullValue value to v
	SetNullValue(v interface{})
}

WithNullValue is a mapping with the null_value parameter

A null value cannot be indexed or searched. When a field is set to null, (or an empty array or an array of null values) it is treated as though that field has no values.

The null_value parameter allows you to replace explicit null values with the specified value so that it can be indexed and searched

The null_value needs to be the same data type as the field. For instance, a long field cannot have a string null_value.

https://www.elastic.co/guide/en/elasticsearch/reference/current/null-value.html

type WithOrientation

type WithOrientation interface {

	// Orientation is the vertex order for the shape’s coordinates list.
	//
	// Defaults to OrientationRight (RIGHT) to comply with OGC standards. OGC
	// standards define outer ring vertices in counterclockwise order with inner
	// ring (hole) vertices in clockwise order.
	Orientation() Orientation
	// SetOrientation sets the Orientation Value to v
	SetOrientation(v Orientation)
}

WithOrientation is a mapping with the orientation parameter

type WithPath

type WithPath interface {
	// Path is the path for an alias
	Path() string
	// SetPath sets the Path Value to v
	SetPath(v string)
}

type WithPositionIncrementGap

type WithPositionIncrementGap interface {
	// PositionIncrementGap is the number of fake term position which should be
	// inserted between each element of an array of strings. Defaults to the
	// position_increment_gap configured on the analyzer which defaults to 100.
	// 100 was chosen because it prevents phrase queries with reasonably large
	// slops (less than 100) from matching terms across field values.
	PositionIncrementGap() uint
	// SetPositionIncrementGap sets the PositionIncrementGap Value to v
	SetPositionIncrementGap(v uint)
}

WithPositionIncrementGap is a mapping with the position_increment_gap parameter

Analyzed text fields take term positions into account, in order to be able to support proximity or phrase queries. When indexing text fields with multiple values a "fake" gap is added between the values to prevent most phrase queries from matching across the values. The size of this gap is configured using position_increment_gap and defaults to 100.

https://www.elastic.co/guide/en/elasticsearch/reference/current/position-increment-gap.html

type WithPositiveScoreImpact

type WithPositiveScoreImpact interface {
	// PositiveScoreImpact is used by rank_feature queries to modify the scoring
	// formula in such a way that the score increases or decreases the value of
	// the feature
	PositiveScoreImpact() bool
	// SetPositiveScoreImpact sets the PositiveScoreImpact Value to v
	SetPositiveScoreImpact(v bool)
}

WithPositiveScoreImpact is a mapping with the positive_score_impact parameter Rank features that correlate negatively with the score should set positive_score_impact to false (defaults to true). This will be used by the rank_feature query to modify the scoring formula in such a way that the score decreases with the value of the feature instead of increasing. For instance in web search, the url length is a commonly used feature which correlates negatively with scores.

https://www.elastic.co/guide/en/elasticsearch/reference/current/rank-feature.html

type WithPreservePositionIncrements

type WithPreservePositionIncrements interface {
	// PreservePositionIncrements enables position increments, defaults to true.
	// If disabled and using stopwords analyzer, you could get a field starting
	// with The Beatles, if you suggest for b. Note: You could also achieve this
	// by indexing two inputs, Beatles and The Beatles, no need to change a
	// simple analyzer, if you are able to enrich your data.
	PreservePositionIncrements() bool
	// SetPreservePositionIncrements sets the PreservePositionIncrements value
	// to V
	SetPreservePositionIncrements(v bool)
}

WithPreservePositionIncrements is a mapping with the preserve_position_increments parameter

Enables position increments, defaults to true. If disabled and using stopwords analyzer, you could get a field starting with The Beatles, if you suggest for b. Note: You could also achieve this by indexing two inputs, Beatles and The Beatles, no need to change a simple analyzer, if you are able to enrich your data.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html#completion-suggester

type WithPreserveSeperators

type WithPreserveSeperators interface {
	// PreserveSeperators preserves the separators, defaults to true. If
	// disabled, you could find a field starting with Foo Fighters, if you
	// suggest for foof.
	PreserveSeperators() bool
	// SetPreserveSeperators sets the PreserveSeperatorParam value to v
	SetPreserveSeperators(v bool)
}

WithPreserveSeperators is a mapping with the preserve_seperators parameter

Preserves the separators, defaults to true. If disabled, you could find a field starting with Foo Fighters, if you suggest for foof.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html#completion-suggester

type WithProperties

type WithProperties interface {
	// Properties are fields within the object, which can be of any data type,
	// including object. New properties may be added to an existing object.
	Properties() Fields
	// SetProperties sets the Properties value to v
	SetProperties(v Fields)
	// Property returns the field with Key if it is exists, otherwise nil
	Property(key string) Field
	// SetProperty sets or adds the given Field v to the Properties param. It
	// initializes PropertiesParam's Value if it is currently nil.
	SetProperty(key string, v Field)
	// DeleteProperty deletes the Properties entry with the given key
	DeleteProperty(key string)
}

WithProperties is a mixin that adds the properties param

Type mappings, object fields and nested fields contain sub-fields, called properties. These properties may be of any data type, including object and nested. Properties can be added:

  • explicitly by defining them when creating an index. - explicitly by

defining them when adding or updating a mapping type with the PUT mapping API. - dynamically just by indexing documents containing new fields.

https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html

type WithRelations

type WithRelations interface {
	Relations() Relations
	SetRelations(v Relations)
	AddRelation(key string, value dynamic.StringOrArrayOfStrings)
	RemoveRelation(v string)
	ClearRelations()
}

WithRelations is a mapping with a relations parameter

The relations section defines a set of possible relations within the documents, each relation being a parent name and a child name.

https://www.elastic.co/guide/en/elasticsearch/reference/current/parent-join.html

type WithScalingFactor

type WithScalingFactor interface {
	ScalingFactor() float64
}

WithScalingFactor is a mapping with the scaling_factor param

https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html#scaled-float-params

type WithSimilarity

type WithSimilarity interface {
	// Similarity is mostly useful for text fields, but can also apply to other
	// field types.
	Similarity() Similarity
	// SetSimilarity sets the Similarity Value to v
	SetSimilarity(v Similarity)
}

WithSimilarity is a mapping with the similarity parameter

Elasticsearch allows you to configure a scoring algorithm or similarity per field. The similarity setting provides a simple way of choosing a similarity algorithm other than the default BM25, such as TF/IDF.

Similarities are mostly useful for text fields, but can also apply to other field types.

Custom similarities can be configured by tuning the parameters of the built-in similarities. For more details about this expert options, see the similarity module.

The only similarities which can be used out of the box, without any further configuration are:

"BM25"

The Okapi BM25 algorithm. The algorithm used by default in Elasticsearch and Lucene.

"classic" (deprecated)

TF/IDF algorithm, the former default in Elasticsearch and Lucene.

"boolean"

A simple boolean similarity, which is used when full-text ranking is not needed and the score should only be based on whether the query terms match or not. Boolean similarity gives terms a score equal to their query boost.

https://www.elastic.co/guide/en/elasticsearch/reference/current/similarity.html

type WithSplitQueriesOnWhitespace

type WithSplitQueriesOnWhitespace interface {
	// SplitQueriesOnWhitespace determines whether full text queries should split
	// the input on whitespace when building a query for this field. Accepts true or
	// false (default).
	SplitQueriesOnWhitespace() bool
	// SetSplitQueriesOnWhitespace sets the SplitQueriesOnWhitespace Value to v
	SetSplitQueriesOnWhitespace(v bool)
}

WithSplitQueriesOnWhitespace is mapping with the split_queries_on_whitespace parameter

split_queries_on_whitespace determines whether full text queries should split the input on whitespace when building a query for this field. Accepts true or false (default).

type WithStore

type WithStore interface {
	Store() bool
	SetStore(v bool)
}

WithStore is a mapping with a Store paramter By default, field values are indexed to make them searchable, but they are not stored. This means that the field can be queried, but the original field value cannot be retrieved.

Usually this doesn’t matter. The field value is already part of the _source field, which is stored by default. If you only want to retrieve the value of a single field or of a few fields, instead of the whole _source, then this can be achieved with source filtering.

In certain situations it can make sense to store a field. For instance, if you have a document with a title, a date, and a very large content field, you may want to retrieve just the title and the date without having to extract those fields from a large _source field

Stored fields returned as arrays

For consistency, stored fields are always returned as an array because there is no way of knowing if the original field value was a single value, multiple values, or an empty array.

The original value can be retrieved from the _source field instead.

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-store.html

type WithTermVector

type WithTermVector interface {
	// TermVector determines whether term vectors should be stored for the field.
	// Defaults to "no" / TermVectorNone.
	TermVector() TermVector
	// SetTermVector sets the TermVector Value to v
	SetTermVector(v TermVector)
}

WithTermVector is a mapping with the term_vector parameter

Term vectors contain information about the terms produced by the analysis process, including:

  • a list of terms.

  • the position (or order) of each term.

  • the start and end character offsets mapping the term to its origin in the

original string.

  • payloads (if they are available) — user-defined binary data associated with

each term position.

These term vectors can be stored so that they can be retrieved for a particular document.

WARNING

Setting with_positions_offsets will double the size of a field’s index.

https://www.elastic.co/guide/en/elasticsearch/reference/current/term-vector.html

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL