mapping

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2024 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Overview

This is implemented by the official document.

Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/Property.ts

  • Licensed to Elasticsearch B.V. under one or more contributor
  • license agreements. See the NOTICE file distributed with
  • this work for additional information regarding copyright
  • ownership. Elasticsearch B.V. licenses this file to you under
  • the Apache License, Version 2.0 (the "License"); you may
  • not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing,
  • software distributed under the License is distributed on an
  • "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  • KIND, either express or implied. See the License for the
  • specific language governing permissions and limitations
  • under the License.

Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/RuntimeFields.ts

  • Licensed to Elasticsearch B.V. under one or more contributor
  • license agreements. See the NOTICE file distributed with
  • this work for additional information regarding copyright
  • ownership. Elasticsearch B.V. licenses this file to you under
  • the Apache License, Version 2.0 (the "License"); you may
  • not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing,
  • software distributed under the License is distributed on an
  • "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  • KIND, either express or implied. See the License for the
  • specific language governing permissions and limitations
  • under the License.

Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/TermVectorOption.ts

  • Licensed to Elasticsearch B.V. under one or more contributor
  • license agreements. See the NOTICE file distributed with
  • this work for additional information regarding copyright
  • ownership. Elasticsearch B.V. licenses this file to you under
  • the Apache License, Version 2.0 (the "License"); you may
  • not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing,
  • software distributed under the License is distributed on an
  • "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  • KIND, either express or implied. See the License for the
  • specific language governing permissions and limitations
  • under the License.

Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/TypeMapping.ts

  • Licensed to Elasticsearch B.V. under one or more contributor
  • license agreements. See the NOTICE file distributed with
  • this work for additional information regarding copyright
  • ownership. Elasticsearch B.V. licenses this file to you under
  • the Apache License, Version 2.0 (the "License"); you may
  • not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing,
  • software distributed under the License is distributed on an
  • "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  • KIND, either express or implied. See the License for the
  • specific language governing permissions and limitations
  • under the License.

https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/complex.ts

  • Licensed to Elasticsearch B.V. under one or more contributor
  • license agreements. See the NOTICE file distributed with
  • this work for additional information regarding copyright
  • ownership. Elasticsearch B.V. licenses this file to you under
  • the Apache License, Version 2.0 (the "License"); you may
  • not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing,
  • software distributed under the License is distributed on an
  • "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  • KIND, either express or implied. See the License for the
  • specific language governing permissions and limitations
  • under the License.

Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/core.ts

  • Licensed to Elasticsearch B.V. under one or more contributor
  • license agreements. See the NOTICE file distributed with
  • this work for additional information regarding copyright
  • ownership. Elasticsearch B.V. licenses this file to you under
  • the Apache License, Version 2.0 (the "License"); you may
  • not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing,
  • software distributed under the License is distributed on an
  • "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  • KIND, either express or implied. See the License for the
  • specific language governing permissions and limitations
  • under the License.

Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/dynamic-template.ts

  • Licensed to Elasticsearch B.V. under one or more contributor
  • license agreements. See the NOTICE file distributed with
  • this work for additional information regarding copyright
  • ownership. Elasticsearch B.V. licenses this file to you under
  • the Apache License, Version 2.0 (the "License"); you may
  • not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing,
  • software distributed under the License is distributed on an
  • "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  • KIND, either express or implied. See the License for the
  • specific language governing permissions and limitations
  • under the License.

Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/geo.ts

  • Licensed to Elasticsearch B.V. under one or more contributor
  • license agreements. See the NOTICE file distributed with
  • this work for additional information regarding copyright
  • ownership. Elasticsearch B.V. licenses this file to you under
  • the Apache License, Version 2.0 (the "License"); you may
  • not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing,
  • software distributed under the License is distributed on an
  • "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  • KIND, either express or implied. See the License for the
  • specific language governing permissions and limitations
  • under the License.

Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/meta-fields.ts

  • Licensed to Elasticsearch B.V. under one or more contributor
  • license agreements. See the NOTICE file distributed with
  • this work for additional information regarding copyright
  • ownership. Elasticsearch B.V. licenses this file to you under
  • the Apache License, Version 2.0 (the "License"); you may
  • not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing,
  • software distributed under the License is distributed on an
  • "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  • KIND, either express or implied. See the License for the
  • specific language governing permissions and limitations
  • under the License.

Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/range.ts

  • Licensed to Elasticsearch B.V. under one or more contributor
  • license agreements. See the NOTICE file distributed with
  • this work for additional information regarding copyright
  • ownership. Elasticsearch B.V. licenses this file to you under
  • the Apache License, Version 2.0 (the "License"); you may
  • not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing,
  • software distributed under the License is distributed on an
  • "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  • KIND, either express or implied. See the License for the
  • specific language governing permissions and limitations
  • under the License.

Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/specialized.ts

  • Licensed to Elasticsearch B.V. under one or more contributor
  • license agreements. See the NOTICE file distributed with
  • this work for additional information regarding copyright
  • ownership. Elasticsearch B.V. licenses this file to you under
  • the Apache License, Version 2.0 (the "License"); you may
  • not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing,
  • software distributed under the License is distributed on an
  • "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  • KIND, either express or implied. See the License for the
  • specific language governing permissions and limitations
  • under the License.

Index

Constants

View Source
const (
	L2Norm     denseVectorSimilarity = "l2_norm"
	DotProduct denseVectorSimilarity = "dot_product"
	Cosine     denseVectorSimilarity = "cosine"
)
View Source
const (
	Days         esUnit = "d"
	Hours        esUnit = "h"
	Minutes      esUnit = "m"
	Seconds      esUnit = "s"
	Milliseconds esUnit = "ms"
	Microseconds esUnit = "micros"
	Nanoseconds  esUnit = "nanos"
	Percent      esUnit = "percent"
	UnitByte     esUnit = "byte"
)

for time units: https://www.elastic.co/guide/en/elasticsearch/reference/8.4/api-conventions.html#time-units for other units: https://www.elastic.co/guide/en/elasticsearch/reference/8.4/mapping-field-meta.html

Variables

This section is empty.

Functions

func IsNested

func IsNested(prop Property) bool

func IsObject

func IsObject(prop Property) bool

func IsObjectLike

func IsObjectLike(prop Property) bool

Types

type AggregateMetricDoubleProperty

type AggregateMetricDoubleProperty struct {
	PropertyBase
	Type             EsType                                                  `json:"type"`
	DefaultMetric    string                                                  `json:"default_metric"`
	Metrics          []string                                                `json:"metrics"`
	TimeSeriesMetric sliceund.Und[timeseriesmetrictype.TimeSeriesMetricType] `json:"time_series_metric,omitempty"`
}

type AllField

type AllField struct {
	Analyzer                 string `json:"analyzer"`
	Enabled                  bool   `json:"enabled"`
	OmitNorms                bool   `json:"omit_norms"`
	SearchAnalyzer           string `json:"search_analyzer"`
	Similarity               string `json:"similarity"`
	Store                    bool   `json:"store"`
	StoreTermVectorOffsets   bool   `json:"store_term_vector_offsets"`
	StoreTermVectorPayloads  bool   `json:"store_term_vector_payloads"`
	StoreTermVectorPositions bool   `json:"store_term_vector_positions"`
	StoreTermVectors         bool   `json:"store_term_vectors"`
}

type BinaryProperty

type BinaryProperty struct {
	DocValuesPropertyBase
	Type EsType `json:"type"`
}

type BooleanProperty

type BooleanProperty struct {
	DocValuesPropertyBase
	Boost     sliceund.Und[float64]                  `json:"boost,omitempty"`
	Fielddata sliceund.Und[indices.NumericFielddata] `json:"fielddata,omitempty"`
	Index     sliceund.Und[bool]                     `json:"index,omitempty"`
	NullValue sliceund.Und[bool]                     `json:"null_value,omitempty"`
	Type      EsType                                 `json:"type"`
}

type ByteNumberProperty

type ByteNumberProperty struct {
	NumberPropertyBase

	Type      EsType             `json:"type"`
	NullValue sliceund.Und[int8] `json:"null_value,omitempty"`
}

type CompletionProperty

type CompletionProperty struct {
	DocValuesPropertyBase

	Analyzer                   sliceund.Und[string]           `json:"analyzer,omitempty"`
	Contexts                   sliceund.Und[[]SuggestContext] `json:"contexts,omitempty"`
	MaxInputLength             sliceund.Und[int]              `json:"max_input_length,omitempty"`
	PreservePositionIncrements sliceund.Und[bool]             `json:"preserve_position_increments,omitempty"`
	PreserveSeparators         sliceund.Und[bool]             `json:"preserve_separators,omitempty"`
	SearchAnalyzer             sliceund.Und[string]           `json:"search_analyzer,omitempty"`
	Type                       EsType                         `json:"type"`
}

type ConstantKeywordProperty

type ConstantKeywordProperty struct {
	PropertyBase

	Value sliceund.Und[any] `json:"value,omitempty"`
	Type  EsType            `json:"type"`
}

type CorePropertyBase

type CorePropertyBase struct {
	PropertyBase
	CopyTo     elastic.Elastic[string] `json:"copy_to,omitempty"`
	Similarity sliceund.Und[string]    `json:"similarity,omitempty"`
	Store      sliceund.Und[bool]      `json:"store,omitempty"`
}

type DataStreamTimestamp

type DataStreamTimestamp struct {
	Enabled bool `json:"enabled"`
}

type DateNanosProperty

type DateNanosProperty struct {
	DocValuesPropertyBase

	Boost           sliceund.Und[float64] `json:"boost,omitempty"`
	Format          sliceund.Und[string]  `json:"format,omitempty"`
	IgnoreMalformed sliceund.Und[bool]    `json:"ignore_malformed,omitempty"`
	Index           sliceund.Und[bool]    `json:"index,omitempty"`
	NullValue       sliceund.Und[any]     `json:"null_value,omitempty"` // date string formatted as ones specified in format field or epoch millis int
	PrecisionStep   sliceund.Und[int]     `json:"precision_step,omitempty"`
	Type            EsType                `json:"type"`
}

type DateProperty

type DateProperty struct {
	DocValuesPropertyBase

	Boost sliceund.Und[float64] `json:"boost,omitempty"`

	Fielddata sliceund.Und[indices.NumericFielddata] `json:"fielddata,omitempty"`

	Format          sliceund.Und[string] `json:"format,omitempty"`
	IgnoreMalformed sliceund.Und[bool]   `json:"ignore_malformed,omitempty"`
	Index           sliceund.Und[bool]   `json:"index,omitempty"`
	NullValue       sliceund.Und[any]    `json:"null_value,omitempty"` // date string formatted as ones specified in format field or epoch millis int
	PrecisionStep   sliceund.Und[int]    `json:"precision_step,omitempty"`
	Locale          sliceund.Und[string] `json:"locale,omitempty"`
	Type            EsType               `json:"type"`
}

type DateRangeProperty

type DateRangeProperty struct {
	RangePropertyBase
	Format sliceund.Und[string] `json:" format,omitempty"`
	Type   EsType               `json:"type"`
}

type DenseVectorIndexOptions

type DenseVectorIndexOptions struct {
	// Currently only hnsw is supported.
	Type string `json:"type"`
	// Defaults to 16.
	M int `json:"m"`
	// Defaults to 100.
	EfConstruction int `json:"ef_construction"`
}

type DenseVectorProperty

type DenseVectorProperty struct {
	PropertyBase
	Type         EsType                                `json:"type"`
	Dims         int                                   `json:"dims"`
	Similarity   sliceund.Und[string]                  `json:"similarity,omitempty"`
	Index        sliceund.Und[bool]                    `json:"index,omitempty"`
	IndexOptions sliceund.Und[DenseVectorIndexOptions] `json:"index_options,omitempty"`
}

type DocValuesPropertyBase

type DocValuesPropertyBase struct {
	CorePropertyBase
	DocValues sliceund.Und[bool] `json:"doc_values,omitempty"`
}

type DoubleNumberProperty

type DoubleNumberProperty struct {
	NumberPropertyBase

	Type      EsType                `json:"type"`
	NullValue sliceund.Und[float64] `json:"null_value,omitempty"`
}

type DoubleRangeProperty

type DoubleRangeProperty struct {
	RangePropertyBase
	Type EsType `json:"type"`
}

type DynamicMapping

type DynamicMapping string
const (
	Strict  DynamicMapping = "strict"
	Runtime DynamicMapping = "runtime"
	True    DynamicMapping = "true"
	False   DynamicMapping = "false"
)

func (DynamicMapping) MarshalJSON

func (m DynamicMapping) MarshalJSON() ([]byte, error)

func (*DynamicMapping) UnmarshalJSON

func (m *DynamicMapping) UnmarshalJSON(data []byte) error

type DynamicProperty

type DynamicProperty struct {
	DocValuesPropertyBase

	Type EsType `json:"type"`

	Enabled   sliceund.Und[bool]    `json:"enabled,omitempty"`
	NullValue sliceund.Und[any]     `json:"null_value,omitempty"` // long | double | string | boolean | null | UserDefinedValue
	Boost     sliceund.Und[float64] `json:"boost,omitempty"`

	// NumberPropertyBase & long, double
	Coerce           sliceund.Und[bool]                                      `json:"coerce,omitempty"`
	Script           sliceund.Und[spec.Script]                               `json:"script,omitempty"`
	OnScriptError    sliceund.Und[OnScriptError]                             `json:"on_script_error,omitempty"`
	IgnoreMalformed  sliceund.Und[bool]                                      `json:"ignore_malformed,omitempty"`
	TimeSeriesMetric sliceund.Und[timeseriesmetrictype.TimeSeriesMetricType] `json:"time_series_metric,omitempty"`

	// string
	Analyzer             sliceund.Und[string]            `json:"analyzer,omitempty"`
	EagerGlobalOrdinals  sliceund.Und[bool]              `json:"eager_global_ordinals,omitempty"`
	Index                sliceund.Und[bool]              `json:"index,omitempty"`
	IndexOptions         sliceund.Und[IndexOptions]      `json:"index_options,omitempty"`
	IndexPhrases         sliceund.Und[bool]              `json:"index_phrases,omitempty"`
	IndexPrefixes        sliceund.Und[TextIndexPrefixes] `json:"index_prefixes,omitempty"`
	Norms                sliceund.Und[bool]              `json:"norms,omitempty"`
	PositionIncrementGap sliceund.Und[int]               `json:"position_increment_gap,omitempty"`
	SearchAnalyzer       sliceund.Und[string]            `json:"search_analyzer,omitempty"`
	SearchQuoteAnalyzer  sliceund.Und[string]            `json:"search_quote_analyzer,omitempty"`
	TermVector           sliceund.Und[TermVectorOption]  `json:"term_vector,omitempty"`

	// date
	Format        sliceund.Und[string] `json:"format,omitempty"`
	PrecisionStep sliceund.Und[int]    `json:"precision_step,omitempty"`
	Locale        sliceund.Und[string] `json:"locale,omitempty"`
}

type DynamicTemplate

type DynamicTemplate struct {
	Mapping          sliceund.Und[Property]  `json:"mapping,omitempty"`
	Match            sliceund.Und[string]    `json:"match,omitempty"`
	MatchMappingType sliceund.Und[string]    `json:"match_mapping_type,omitempty"`
	MatchPattern     sliceund.Und[MatchType] `json:"match_pattern,omitempty"`
	PathMatch        sliceund.Und[string]    `json:"path_match,omitempty"`
	PathUnmatch      sliceund.Und[string]    `json:"path_unmatch,omitempty"`
	Unmatch          sliceund.Und[string]    `json:"unmatch,omitempty"`
}

type EsType

type EsType string

Enum for Elasticsearch mapping field data types.

const (
	// common
	Binary          EsType = "binary"
	Boolean         EsType = "boolean"
	Dynamic         EsType = "dynamic"
	Join            EsType = "join"
	Keyword         EsType = "keyword"
	MatchOnlyText   EsType = "match_only_text"
	Percolator      EsType = "percolator"
	RankFeature     EsType = "rank_feature"
	RankFeatures    EsType = "rank_features"
	SearchAsYouType EsType = "search_as_you_type"
	Text            EsType = "text"
	Version         EsType = "version"
	Wildcard        EsType = "wildcard"
	// dates
	DateNanos EsType = "date_nanos"
	Date      EsType = "date"
	// complex
	AggregateMetricDouble EsType = "aggregate_metric_double"
	DenseVector           EsType = "dense_vector"
	Flattened             EsType = "flattened"
	Nested                EsType = "nested"
	Object                EsType = "object"
	// structured
	Completion      EsType = "completion"
	ConstantKeyword EsType = "constant_keyword"
	FieldAlias      EsType = "alias"
	Histogram       EsType = "histogram"
	Ip              EsType = "ip"
	Murmur3Hash     EsType = "murmur3"
	TokenCount      EsType = "token_count"
	// spatial
	GeoPoint EsType = "geo_point"
	GeoShape EsType = "geo_shape"
	Point    EsType = "point"
	Shape    EsType = "shape"
	// numbers
	ByteNumber         EsType = "byte"
	DoubleNumber       EsType = "double"
	FloatNumber        EsType = "float"
	HalfFloatNumber    EsType = "half_float"
	IntegerNumber      EsType = "integer"
	LongNumber         EsType = "long"
	ScaledFloatNumber  EsType = "scaled_float"
	ShortNumber        EsType = "short"
	UnsignedLongNumber EsType = "unsigned_long"
	// ranges
	DateRange    EsType = "date_range"
	DoubleRange  EsType = "double_range"
	FloatRange   EsType = "float_range"
	IntegerRange EsType = "integer_range"
	IpRange      EsType = "ip_range"
	LongRange    EsType = "long_range"
)

func GetTypeName

func GetTypeName(prop Property) EsType

type FieldAliasProperty

type FieldAliasProperty struct {
	PropertyBase

	Path sliceund.Und[string] `json:"path,omitempty"`
	Type EsType               `json:"type"`
}

type FieldMapping

type FieldMapping struct {
	FullName string              `json:"full_name"`
	Mapping  map[string]Property `json:"mapping"`
}

type FieldNamesField

type FieldNamesField struct {
	Enabled bool `json:"enabled"`
}

type FlattenedProperty

type FlattenedProperty struct {
	PropertyBase
	Boost                    sliceund.Und[float64]      `json:"boost,omitempty"`
	DepthLimit               sliceund.Und[int]          `json:"depth_limit,omitempty"`
	DocValues                sliceund.Und[bool]         `json:"doc_values,omitempty"`
	EagerGlobalOrdinals      sliceund.Und[bool]         `json:"eager_global_ordinals,omitempty"`
	Index                    sliceund.Und[bool]         `json:"index,omitempty"`
	IndexOptions             sliceund.Und[IndexOptions] `json:"index_options,omitempty"`
	NullValue                sliceund.Und[string]       `json:"null_value,omitempty"`
	Similarity               sliceund.Und[string]       `json:"similarity,omitempty"`
	SplitQueriesOnWhitespace sliceund.Und[bool]         `json:"split_queries_on_whitespace,omitempty"`
	Type                     EsType                     `json:"type"`
}

type FloatNumberProperty

type FloatNumberProperty struct {
	NumberPropertyBase

	Type      EsType                `json:"type"`
	NullValue sliceund.Und[float32] `json:"null_value,omitempty"`
}

type FloatRangeProperty

type FloatRangeProperty struct {
	RangePropertyBase
	Type EsType `json:"type"`
}

type GeoOrientation

type GeoOrientation string
const (
	/** @aliases RIGHT, counterclockwise, ccw */
	Right GeoOrientation = "right"
	/** @aliases LEFT, clockwise, cw */
	Left GeoOrientation = "left"
)

type GeoPointProperty

type GeoPointProperty struct {
	DocValuesPropertyBase
	IgnoreMalformed sliceund.Und[bool] `json:" ignore_malformed,omitempty"`
	IgnoreZValue    sliceund.Und[bool] `json:" ignore_z_value,omitempty"`
	NullValue       sliceund.Und[any]  `json:" null_value,omitempty"`
	Type            EsType             `json:"type"`
}

type GeoShapeProperty

type GeoShapeProperty struct {
	DocValuesPropertyBase
	Coerce          sliceund.Und[bool]           `json:" coerce,omitempty"`
	IgnoreMalformed sliceund.Und[bool]           `json:" ignore_malformed,omitempty"`
	IgnoreZValue    sliceund.Und[bool]           `json:" ignore_z_value,omitempty"`
	Orientation     sliceund.Und[GeoOrientation] `json:" orientation,omitempty"`
	Strategy        sliceund.Und[GeoStrategy]    `json:" strategy,omitempty"`
	Type            EsType                       `json:"type"`
}

*

  • The `geo_shape` data type facilitates the indexing of and searching with arbitrary geo shapes such as rectangles
  • and polygons. *
  • @doc_id geo-shape

type GeoStrategy

type GeoStrategy string
const (
	Recursive GeoStrategy = "recursive"
	Term      GeoStrategy = "term"
)

type GeoTree

type GeoTree string
const (
	Geohash  GeoTree = "geohash"
	Quadtree GeoTree = "quadtree"
)

type HalfFloatNumberProperty

type HalfFloatNumberProperty struct {
	NumberPropertyBase

	Type      EsType                `json:"type"`
	NullValue sliceund.Und[float32] `json:"null_value,omitempty"` // TODO: use float16 package?
}

type HistogramProperty

type HistogramProperty struct {
	PropertyBase

	IgnoreMalformed sliceund.Und[bool] `json:"ignore_malformed,omitempty"`
	Type            EsType             `json:"type"`
}

type IndexField

type IndexField struct {
	Enabled bool `json:"enabled"`
}

type IndexOptions

type IndexOptions string
const (
	Docs      IndexOptions = "docs"
	Freqs     IndexOptions = "freqs"
	Positions IndexOptions = "positions"
	Offsets   IndexOptions = "offsets"
)

type IntegerNumberProperty

type IntegerNumberProperty struct {
	NumberPropertyBase

	Type      EsType              `json:"type"`
	NullValue sliceund.Und[int32] `json:"null_value,omitempty"`
}

type IntegerRangeProperty

type IntegerRangeProperty struct {
	RangePropertyBase
	Type EsType `json:"type"`
}

type IpProperty

type IpProperty struct {
	DocValuesPropertyBase

	Boost           sliceund.Und[float64]           `json:"boost,omitempty"`
	Index           sliceund.Und[bool]              `json:"index,omitempty"`
	IgnoreMalformed sliceund.Und[bool]              `json:"ignore_malformed,omitempty"`
	NullValue       sliceund.Und[string]            `json:"null_value,omitempty"`
	OnScriptError   sliceund.Und[OnScriptError]     `json:"on_script_error,omitempty"`
	Script          sliceund.Und[mappingdef.Script] `json:"script,omitempty"`
	/**
	 * For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false.
	 * @availability stack stability=experimental
	 * @availability serverless stability=experimental
	 */
	TimeSeriesDimension sliceund.Und[bool] `json:"time_series_dimension,omitempty"`
	Type                EsType             `json:"type"`
}

type IpRangeProperty

type IpRangeProperty struct {
	RangePropertyBase
	Type EsType `json:"type"`
}

type JoinProperty

type JoinProperty struct {
	PropertyBase

	Relations           sliceund.Und[map[string]elastic.Elastic[string]] `json:"relations,omitempty,omitempty"`
	EagerGlobalOrdinals sliceund.Und[bool]                               `json:"eager_global_ordinals,omitempty"`
	Type                EsType                                           `json:"type"`
}

type KeywordProperty

type KeywordProperty struct {
	DocValuesPropertyBase

	Boost                    sliceund.Und[float64]      `json:"boost,omitempty"`
	EagerGlobalOrdinals      sliceund.Und[bool]         `json:"eager_global_ordinals,omitempty"`
	Index                    sliceund.Und[bool]         `json:"index,omitempty"`
	IndexOptions             sliceund.Und[IndexOptions] `json:"index_options,omitempty"`
	Normalizer               sliceund.Und[string]       `json:"normalizer,omitempty"`
	Norms                    sliceund.Und[bool]         `json:"norms,omitempty"`
	NullValue                sliceund.Und[string]       `json:"null_value,omitempty"`
	SplitQueriesOnWhitespace sliceund.Und[bool]         `json:"split_queries_on_whitespace,omitempty"`
	/**
	 * For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false.
	 * @availability stack stability=experimental
	 * @availability serverless stability=experimental
	 */
	TimeSeriesDimension sliceund.Und[bool] `json:"time_series_dimension,omitempty"`
	Type                EsType             `json:"type"`
}

type LongNumberProperty

type LongNumberProperty struct {
	NumberPropertyBase

	Type      EsType              `json:"type"`
	NullValue sliceund.Und[int64] `json:"null_value,omitempty"`
}

type LongRangeProperty

type LongRangeProperty struct {
	RangePropertyBase
	Type EsType `json:"type"`
}

type MatchOnlyTextProperty

type MatchOnlyTextProperty struct {
	Type EsType `json:"type"`
	/**
	 * 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.
	 * @doc_id multi-fields
	 */
	Fields sliceund.Und[map[string]Property] `json:"fields,omitempty"`
	/**
	 * Metadata about the field.
	 * @doc_id mapping-meta-field
	 */
	Meta sliceund.Und[map[string]string] `json:"meta,omitempty"`
	/**
	 * Allows you to copy the values of multiple fields into a group
	 * field, which can then be queried as a single field.
	 */
	CopyTo elastic.Elastic[string] `json:"copy_to,omitempty"`
}

*

  • A variant of text that trades scoring and efficiency of positional queries for space efficiency. This field
  • effectively stores data the same way as a text field that only indexes documents (index_options: docs) and
  • disables norms (norms: false). Term queries perform as fast if not faster as on text fields, however queries
  • that need positions such as the match_phrase query perform slower as they need to look at the _source document
  • to verify whether a phrase matches. All queries return constant scores that are equal to 1.0.

type MatchType

type MatchType string
const (
	Simple MatchType = "simple"
	Regex  MatchType = "regex"
)

type Murmur3HashProperty

type Murmur3HashProperty struct {
	DocValuesPropertyBase

	Type EsType `json:"type"`
}

type NestedProperty

type NestedProperty struct {
	CorePropertyBase
	Enabled         sliceund.Und[bool] `json:"enabled,omitempty"`
	IncludeInParent sliceund.Und[bool] `json:"include_in_parent,omitempty"`
	IncludeInRoot   sliceund.Und[bool] `json:"include_in_root,omitempty"`
	Type            EsType             `json:"type"`
}

type NumberPropertyBase

type NumberPropertyBase struct {
	DocValuesPropertyBase

	Boost           sliceund.Und[float64]       `json:"boost,omitempty"`
	Coerce          sliceund.Und[bool]          `json:"coerce,omitempty"`
	IgnoreMalformed sliceund.Und[bool]          `json:"ignore_malformed,omitempty"`
	Index           sliceund.Und[bool]          `json:"index,omitempty"`
	OnScriptError   sliceund.Und[OnScriptError] `json:"on_script_error,omitempty"`
	Script          sliceund.Und[spec.Script]   `json:"script,omitempty"`
	/**
	 * For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false.
	 * @availability stack stability=experimental
	 * @availability serverless stability=experimental
	 */
	TimeSeriesMetric sliceund.Und[timeseriesmetrictype.TimeSeriesMetricType] `json:"time_series_metric,omitempty"`
	/**
	 * For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false.
	 * @server_default false
	 * @availability stack stability=experimental
	 * @availability serverless stability=experimental
	 */
	TimeSeriesDimension sliceund.Und[bool] `json:"time_series_dimension,omitempty"`
}

type ObjectProperty

type ObjectProperty struct {
	CorePropertyBase
	Enabled sliceund.Und[bool]   `json:"enabled,omitempty"`
	Type    sliceund.Und[EsType] `json:"type,omitempty"`
}

type OnScriptError

type OnScriptError string
const (
	Fail     OnScriptError = "fail"
	Continue OnScriptError = "continue"
)

type PercolatorProperty

type PercolatorProperty struct {
	PropertyBase

	Type EsType `json:"type"`
}

type PointProperty

type PointProperty struct {
	DocValuesPropertyBase
	IgnoreMalformed sliceund.Und[bool]   `json:" ignore_malformed,omitempty"`
	IgnoreZValue    sliceund.Und[bool]   `json:" ignore_z_value,omitempty"`
	NullValue       sliceund.Und[string] `json:" null_value,omitempty"`
	Type            EsType               `json:"type"`
}

type Property

type Property struct {
	Val any
}

Property is enum for mapping field type. type is not necessary to be set. If absent property is considered object.

| BinaryProperty | BooleanProperty | DynamicProperty | JoinProperty | KeywordProperty | MatchOnlyTextProperty | PercolatorProperty | RankFeatureProperty | RankFeaturesProperty | SearchAsYouTypeProperty | TextProperty | VersionProperty | WildcardProperty | DateNanosProperty | DateProperty | AggregateMetricDoubleProperty | DenseVectorProperty | FlattenedProperty | NestedProperty | ObjectProperty | CompletionProperty | ConstantKeywordProperty | FieldAliasProperty | HistogramProperty | IpProperty | Murmur3HashProperty | TokenCountProperty | GeoPointProperty | GeoShapeProperty | PointProperty | ShapeProperty | ByteNumberProperty | DoubleNumberProperty | FloatNumberProperty | HalfFloatNumberProperty | IntegerNumberProperty | LongNumberProperty | ScaledFloatNumberProperty | ShortNumberProperty | UnsignedLongNumberProperty | DateRangeProperty | DoubleRangeProperty | FloatRangeProperty | IntegerRangeProperty | IpRangeProperty | LongRangeProperty

func (Property) MarshalJSON

func (p Property) MarshalJSON() ([]byte, error)

func (*Property) UnmarshalJSON

func (p *Property) UnmarshalJSON(data []byte) error

type PropertyBase

type PropertyBase struct {
	Meta        sliceund.Und[map[string]string]   `json:"meta,omitempty,omitempty"`
	Properties  sliceund.Und[map[string]Property] `json:"properties,omitempty,omitempty"`
	IgnoreAbove sliceund.Und[int]                 `json:"ignore_above,omitempty,omitempty"`
	Dynamic     sliceund.Und[DynamicMapping]      `json:"dynamic,omitempty,omitempty"`
	Fields      sliceund.Und[map[string]Property] `json:"fields,omitempty,omitempty"`
}

type RangePropertyBase

type RangePropertyBase struct {
	DocValuesPropertyBase
	Boost  sliceund.Und[float64] `json:" boost,omitempty"`
	Coerce sliceund.Und[bool]    `json:" coerce,omitempty"`
	Index  sliceund.Und[bool]    `json:" index,omitempty"`
}

type RankFeatureProperty

type RankFeatureProperty struct {
	PropertyBase

	PositiveScoreImpact sliceund.Und[bool] `json:"positive_score_impact,omitempty"`
	Type                EsType             `json:"type"`
}

type RankFeaturesProperty

type RankFeaturesProperty struct {
	PropertyBase

	Type EsType `json:"type"`
}

type RoutingField

type RoutingField struct {
	Required bool `json:"required"`
}

type RuntimeField

type RuntimeField struct {
	/** For type `lookup` */
	FetchFields sliceund.Und[[]RuntimeFieldFetchFields] `json:"fetch_fields,omitempty"`
	Format      sliceund.Und[string]                    `json:"format,omitempty"`
	/** For type `lookup` */
	InputField sliceund.Und[string] `json:"input_field,omitempty"`
	/** For type `lookup` */
	TargetField sliceund.Und[string] `json:"target_field,omitempty"`
	/** For type `lookup` */
	TargetIndex sliceund.Und[string]              `json:"target_index,omitempty"`
	Script      sliceund.Und[esspec.Script]       `json:"script,omitempty"`
	Type        runtimefieldtype.RuntimeFieldType `json:"type"`
}

type RuntimeFieldFetchFields

type RuntimeFieldFetchFields struct {
	Field  string               `json:"field"`
	Format sliceund.Und[string] `json:"format,omitempty"`
}

* @shortcut_property field

type RuntimeFields

type RuntimeFields map[string]RuntimeField

type ScaledFloatNumberProperty

type ScaledFloatNumberProperty struct {
	NumberPropertyBase

	Type          EsType                `json:"type"`
	NullValue     sliceund.Und[float64] `json:"null_value,omitempty"`
	ScalingFactor sliceund.Und[float64] `json:"scaling_factor,omitempty"`
}

type SearchAsYouTypeProperty

type SearchAsYouTypeProperty struct {
	CorePropertyBase

	Analyzer            sliceund.Und[string]           `json:"analyzer,omitempty"`
	Index               sliceund.Und[bool]             `json:"index,omitempty"`
	IndexOptions        sliceund.Und[IndexOptions]     `json:"index_options,omitempty"`
	MaxShingleSize      sliceund.Und[int]              `json:"max_shingle_size,omitempty"`
	Norms               sliceund.Und[bool]             `json:"norms,omitempty"`
	SearchAnalyzer      sliceund.Und[string]           `json:"search_analyzer,omitempty"`
	SearchQuoteAnalyzer sliceund.Und[string]           `json:"search_quote_analyzer,omitempty"`
	TermVector          sliceund.Und[TermVectorOption] `json:"term_vector,omitempty"`
	Type                EsType                         `json:"type"`
}

type ShapeProperty

type ShapeProperty struct {
	DocValuesPropertyBase
	Coerce          sliceund.Und[bool]           `json:" coerce,omitempty"`
	IgnoreMalformed sliceund.Und[bool]           `json:" ignore_malformed,omitempty"`
	IgnoreZValue    sliceund.Und[bool]           `json:" ignore_z_value,omitempty"`
	Orientation     sliceund.Und[GeoOrientation] `json:" orientation,omitempty"`
	Type            EsType                       `json:"type"`
}

*

  • The `shape` data type facilitates the indexing of and searching with arbitrary `x, y` cartesian shapes such as
  • rectangles and polygons. *
  • @doc_id shape

type ShortNumberProperty

type ShortNumberProperty struct {
	NumberPropertyBase

	Type      EsType              `json:"type"`
	NullValue sliceund.Und[int16] `json:"null_value,omitempty"`
}

type SizeField

type SizeField struct {
	Enabled bool `json:"enabled"`
}

type SourceField

type SourceField struct {
	Compress          sliceund.Und[bool]            `json:"compress,omitempty"`
	CompressThreshold sliceund.Und[string]          `json:"compress_threshold,omitempty"`
	Enabled           sliceund.Und[bool]            `json:"enabled,omitempty"`
	Excludes          sliceund.Und[[]string]        `json:"excludes,omitempty"`
	Includes          sliceund.Und[[]string]        `json:"includes,omitempty"`
	Mode              sliceund.Und[SourceFieldMode] `json:"mode,omitempty"`
}

type SourceFieldMode

type SourceFieldMode string
const (
	Disabled SourceFieldMode = "disabled"
	Stored   SourceFieldMode = "stored"
	/**
	 *  Instead of storing source documents on disk exactly as you send them,
	 *  Elasticsearch can reconstruct source content on the fly upon retrieval.
	 */
	Synthetic SourceFieldMode = "synthetic"
)

type SuggestContext

type SuggestContext struct {
	Name      string               `json:"name"`
	Path      sliceund.Und[string] `json:"path,omitempty"`
	Type      string               `json:"type"`
	Precision sliceund.Und[any]    `json:"precision,omitempty"` // int or string
}

type TermVectorOption

type TermVectorOption string
const (
	No                           TermVectorOption = "no"
	Yes                          TermVectorOption = "yes"
	WithOffsets                  TermVectorOption = "with_offsets"
	WithPositions                TermVectorOption = "with_positions"
	WithPositionsOffsets         TermVectorOption = "with_positions_offsets"
	WithPositionsOffsetsPayloads TermVectorOption = "with_positions_offsets_payloads"
	WithPositionsPayloads        TermVectorOption = "with_positions_payloads"
)

type TextIndexPrefixes

type TextIndexPrefixes struct {
	MaxChars int `json:"max_chars"`
	MinChars int `json:"min_chars"`
}

type TextProperty

type TextProperty struct {
	CorePropertyBase

	Analyzer                 sliceund.Und[string]                           `json:"analyzer,omitempty"`
	Boost                    sliceund.Und[float64]                          `json:"boost,omitempty"`
	EagerGlobalOrdinals      sliceund.Und[bool]                             `json:"eager_global_ordinals,omitempty"`
	Fielddata                sliceund.Und[bool]                             `json:"fielddata,omitempty"`
	FielddataFrequencyFilter sliceund.Und[indices.FielddataFrequencyFilter] `json:"fielddata_frequency_filter,omitempty"`
	Index                    sliceund.Und[bool]                             `json:"index,omitempty"`
	IndexOptions             sliceund.Und[IndexOptions]                     `json:"index_options,omitempty"`
	IndexPhrases             sliceund.Und[bool]                             `json:"index_phrases,omitempty"`
	IndexPrefixes            sliceund.Und[TextIndexPrefixes]                `json:"index_prefixes,omitempty"`
	Norms                    sliceund.Und[bool]                             `json:"norms,omitempty"`
	PositionIncrementGap     sliceund.Und[int]                              `json:"position_increment_gap,omitempty"`
	SearchAnalyzer           sliceund.Und[string]                           `json:"search_analyzer,omitempty"`
	SearchQuoteAnalyzer      sliceund.Und[string]                           `json:"search_quote_analyzer,omitempty"`
	TermVector               sliceund.Und[TermVectorOption]                 `json:"term_vector,omitempty"`
	Type                     EsType                                         `json:"type"`
}

type TokenCountProperty

type TokenCountProperty struct {
	DocValuesPropertyBase
	Analyzer                 sliceund.Und[string]  `json:"analyzer,omitempty"`
	Boost                    sliceund.Und[float64] `json:"boost,omitempty"`
	Index                    sliceund.Und[bool]    `json:"index,omitempty"`
	NullValue                sliceund.Und[float64] `json:"null_value,omitempty"`
	EnablePositionIncrements sliceund.Und[bool]    `json:"enable_position_increments,omitempty"`
	Type                     EsType                `json:"type"`
}

type TypeMapping

type TypeMapping struct {
	AllField           sliceund.Und[AllField]                     `json:"all_field,omitempty"`
	DateDetection      sliceund.Und[bool]                         `json:"date_detection,omitempty"`
	Dynamic            sliceund.Und[DynamicMapping]               `json:"dynamic,omitempty"`
	DynamicDateFormats sliceund.Und[[]string]                     `json:"dynamic_date_formats,omitempty"`
	DynamicTemplates   sliceund.Und[[]map[string]DynamicTemplate] `json:"dynamic_templates,omitempty"`
	FieldNames_        sliceund.Und[FieldNamesField]              `json:"_field_names,omitempty"`
	IndexField         sliceund.Und[IndexField]                   `json:"index_field,omitempty"`
	/** @doc_id mapping-meta-field */
	Meta             sliceund.Und[map[string]any]          `json:"_meta,omitempty"`
	NumericDetection sliceund.Und[bool]                    `json:"numeric_detection,omitempty"`
	Properties       sliceund.Und[map[string]Property]     `json:"properties,omitempty"`
	Routing          sliceund.Und[RoutingField]            `json:"_routing,omitempty"`
	Size             sliceund.Und[SizeField]               `json:"_size,omitempty"`
	Source           sliceund.Und[SourceField]             `json:"_source,omitempty"`
	Runtime          sliceund.Und[map[string]RuntimeField] `json:"runtime,omitempty"`
	Enabled          sliceund.Und[bool]                    `json:"enabled,omitempty"`
	/** @since 7.16.0 */
	DataStreamTimestamp sliceund.Und[DataStreamTimestamp] `json:"_data_stream_timestamp,omitempty"`
}

type UnsignedLongNumberProperty

type UnsignedLongNumberProperty struct {
	NumberPropertyBase

	Type      EsType               `json:"type"`
	NullValue sliceund.Und[uint64] `json:"null_value,omitempty"`
}

type VersionProperty

type VersionProperty struct {
	DocValuesPropertyBase

	Type EsType `json:"type"`
}

type WildcardProperty

type WildcardProperty struct {
	DocValuesPropertyBase

	Type EsType `json:"type"`
	/**
	 * @availability stack since=7.15.0
	 * @availability serverless
	 */
	NullValue sliceund.Und[string] `json:"null_value,omitempty"`
}

Directories

Path Synopsis
Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/TimeSeriesMetricType.ts
Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/TimeSeriesMetricType.ts
Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/RuntimeFields.ts
Hand port of https://github.com/elastic/elasticsearch-specification/blob/76e25d34bff1060e300c95f4be468ef88e4f3465/specification/_types/mapping/RuntimeFields.ts

Jump to

Keyboard shortcuts

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