Documentation
¶
Overview ¶
Package twos provides functionality for building index patterns and names.
Index ¶
- Constants
- func AliasExists(ctx context.Context, alias string, processName string) (bool, error)
- func ApplyISMPolicy(ctx context.Context, index, policyName string) error
- func BoolPtr(v bool) *bool
- func BuildCurrentIndex(elements ...string) string
- func BuildIndex(date time.Time, elements ...string) string
- func BuildIndexPattern(elements ...string) string
- func BuildInitialRolloverIndex(prefix string) string
- func BuildRolloverIndex(prefix string, seq int) string
- func BulkIndex(ctx context.Context, items []BulkIndexItem) error
- func CloseIndex(ctx context.Context, name string) error
- func Connect(nodes []string, user, password string) error
- func CreateMLModelGroup(ctx context.Context, name, description string) (string, error)
- func Delete(ctx context.Context, index, id string) error
- func DeleteAlias(ctx context.Context, index, alias, processName string) error
- func DeleteISMPolicy(ctx context.Context, name string) error
- func DeleteIndex(ctx context.Context, name string) error
- func DeleteIndexTemplate(ctx context.Context, name string) error
- func DeleteMLModel(ctx context.Context, modelID string) error
- func DeleteMLModelGroup(ctx context.Context, groupID string) error
- func DeployMLModel(ctx context.Context, modelID string) (string, error)
- func Exists(ctx context.Context, index, id string) (bool, error)
- func Float64Ptr(v float64) *float64
- func Get(ctx context.Context, index, id string) ([]byte, error)
- func GetAllFieldTypes() []string
- func GetCurrentWriteIndex(ctx context.Context, alias, processName string) (string, error)
- func GetIndexSettings(ctx context.Context, name string) (map[string]interface{}, error)
- func GetIndicesForAlias(ctx context.Context, alias string, processName string) ([]string, error)
- func GetMostPermissiveType(types []string) string
- func GetRolloverSequence(indexName string) int
- func GetTypePriority(fieldType string) int
- func GetWriteIndex(ctx context.Context, alias, processName string) (string, error)
- func ISMPolicyExists(ctx context.Context, name string) (bool, error)
- func Index(ctx context.Context, index, id string, doc []byte) error
- func IndexDoc(ctx context.Context, doc interface{}, index, id string) error
- func IndexExists(ctx context.Context, name string) (bool, error)
- func IndexTemplateExists(ctx context.Context, name string) (bool, error)
- func IntPtr(v int) *int
- func IsAggregatable(fieldType string) bool
- func IsRangeType(fieldType string) bool
- func IsRolloverIndex(indexName string) bool
- func IsSortable(fieldType string) bool
- func IsTermType(fieldType string) bool
- func IsTextType(fieldType string) bool
- func MLPredict(ctx context.Context, modelID string, texts []string) ([][]float32, error)
- func MLPredictBatch(ctx context.Context, modelID string, texts []string, batchSize int) ([][]float32, error)
- func MLPredictGeneric(ctx context.Context, modelID string, input map[string]interface{}) (map[string]interface{}, error)
- func MLPredictSingle(ctx context.Context, modelID, text string) ([]float32, error)
- func NeedsKeywordSubfield(fieldType string) bool
- func NextRolloverIndex(currentIndex string) (string, error)
- func OpenIndex(ctx context.Context, name string) error
- func ParseRolloverIndex(indexName string) (prefix string, seq int, err error)
- func RefreshIndex(ctx context.Context, names ...string) error
- func RegisterFieldType(info FieldTypeInfo)
- func RegisterMLModel(ctx context.Context, cfg *MLModelConfig) (modelID string, taskID string, err error)
- func RemoveISMPolicy(ctx context.Context, index string) error
- func RetryISM(ctx context.Context, index string) error
- func SetupRolloverAlias(ctx context.Context, indexPrefix, alias, processName string, ...) error
- func UndeployMLModel(ctx context.Context, modelID string) error
- func UpdateByQuery(ctx context.Context, indices []string, body map[string]interface{}) ([]byte, error)
- func ValidateQuery(fieldType string, queryType QueryType) error
- type Agg
- type Aggs
- type AliasAction
- type AliasBuilder
- func (b *AliasBuilder) Add(index, alias string) *AliasBuilder
- func (b *AliasBuilder) AddHidden(index, alias string) *AliasBuilder
- func (b *AliasBuilder) AddWithConfig(index, alias string, config AliasConfig) *AliasBuilder
- func (b *AliasBuilder) AddWithFilter(index, alias string, filter map[string]interface{}) *AliasBuilder
- func (b *AliasBuilder) AddWithRouting(index, alias, routing string) *AliasBuilder
- func (b *AliasBuilder) AddWriteIndex(index, alias string) *AliasBuilder
- func (b *AliasBuilder) Build() (map[string]interface{}, error)
- func (b *AliasBuilder) BuildWithErrors() (map[string]interface{}, []error)
- func (b *AliasBuilder) Ensure() error
- func (b *AliasBuilder) Remove(index, alias string) *AliasBuilder
- func (b *AliasBuilder) RemoveIndex(index string) *AliasBuilder
- func (b *AliasBuilder) Switch(alias, fromIndex, toIndex string) *AliasBuilder
- func (b *AliasBuilder) SwitchWriteIndex(alias, fromIndex, toIndex string) *AliasBuilder
- type AliasConfig
- type AliasInfo
- type AnalysisSettings
- type Bool
- type BoolBuilder
- func (b *BoolBuilder) Build() Query
- func (b *BoolBuilder) BuildWithErrors() (Query, []error)
- func (b *BoolBuilder) Errors() []error
- func (b *BoolBuilder) FilterBool(nested *BoolBuilder) *BoolBuilder
- func (b *BoolBuilder) FilterCIDR(field string, cidr string) *BoolBuilder
- func (b *BoolBuilder) FilterCIDRs(field string, cidrs ...string) *BoolBuilder
- func (b *BoolBuilder) FilterExists(field string) *BoolBuilder
- func (b *BoolBuilder) FilterFuzzy(field string, value string, fuzziness ...string) *BoolBuilder
- func (b *BoolBuilder) FilterIDs(ids ...interface{}) *BoolBuilder
- func (b *BoolBuilder) FilterIPRangeContains(field string, ip string) *BoolBuilder
- func (b *BoolBuilder) FilterIPRangeIntersects(field string, fromIP, toIP string) *BoolBuilder
- func (b *BoolBuilder) FilterIPRangeWithin(field string, fromIP, toIP string) *BoolBuilder
- func (b *BoolBuilder) FilterKNN(field string, vector []float32, k int) *BoolBuilder
- func (b *BoolBuilder) FilterKNNWithFilter(field string, vector []float32, k int, filter Query) *BoolBuilder
- func (b *BoolBuilder) FilterKNNWithMaxDistance(field string, vector []float32, k int, maxDistance float64) *BoolBuilder
- func (b *BoolBuilder) FilterKNNWithMinScore(field string, vector []float32, k int, minScore float64) *BoolBuilder
- func (b *BoolBuilder) FilterKNNWithOptions(field string, vector []float32, k int, opts KNNQueryOptions) *BoolBuilder
- func (b *BoolBuilder) FilterMatch(field string, value string) *BoolBuilder
- func (b *BoolBuilder) FilterMatchPhrase(field string, value string) *BoolBuilder
- func (b *BoolBuilder) FilterMatchPhrasePrefix(field string, value string) *BoolBuilder
- func (b *BoolBuilder) FilterMultiMatch(query string, fields []string, matchType ...string) *BoolBuilder
- func (b *BoolBuilder) FilterPrefix(field string, prefix string) *BoolBuilder
- func (b *BoolBuilder) FilterQuery(queries ...Query) *BoolBuilder
- func (b *BoolBuilder) FilterQueryString(query string, defaultOperator ...string) *BoolBuilder
- func (b *BoolBuilder) FilterRange(field string, op string, value interface{}) *BoolBuilder
- func (b *BoolBuilder) FilterRegexp(field string, pattern string) *BoolBuilder
- func (b *BoolBuilder) FilterTerm(field string, value interface{}) *BoolBuilder
- func (b *BoolBuilder) FilterTerms(field string, values ...interface{}) *BoolBuilder
- func (b *BoolBuilder) FilterWildcard(field string, pattern string) *BoolBuilder
- func (b *BoolBuilder) HasErrors() bool
- func (b *BoolBuilder) MinimumShouldMatch(value interface{}) *BoolBuilder
- func (b *BoolBuilder) MustBool(nested *BoolBuilder) *BoolBuilder
- func (b *BoolBuilder) MustCIDR(field string, cidr string) *BoolBuilder
- func (b *BoolBuilder) MustCIDRs(field string, cidrs ...string) *BoolBuilder
- func (b *BoolBuilder) MustExists(field string) *BoolBuilder
- func (b *BoolBuilder) MustFuzzy(field string, value string, fuzziness ...string) *BoolBuilder
- func (b *BoolBuilder) MustIPRangeContains(field string, ip string) *BoolBuilder
- func (b *BoolBuilder) MustIPRangeIntersects(field string, fromIP, toIP string) *BoolBuilder
- func (b *BoolBuilder) MustIPRangeWithin(field string, fromIP, toIP string) *BoolBuilder
- func (b *BoolBuilder) MustKNN(field string, vector []float32, k int) *BoolBuilder
- func (b *BoolBuilder) MustKNNWithFilter(field string, vector []float32, k int, filter Query) *BoolBuilder
- func (b *BoolBuilder) MustKNNWithMaxDistance(field string, vector []float32, k int, maxDistance float64) *BoolBuilder
- func (b *BoolBuilder) MustKNNWithMinScore(field string, vector []float32, k int, minScore float64) *BoolBuilder
- func (b *BoolBuilder) MustKNNWithOptions(field string, vector []float32, k int, opts KNNQueryOptions) *BoolBuilder
- func (b *BoolBuilder) MustMatch(field string, value string) *BoolBuilder
- func (b *BoolBuilder) MustMatchPhrase(field string, value string) *BoolBuilder
- func (b *BoolBuilder) MustMatchPhrasePrefix(field string, value string) *BoolBuilder
- func (b *BoolBuilder) MustMultiMatch(query string, fields []string, matchType ...string) *BoolBuilder
- func (b *BoolBuilder) MustNotBool(nested *BoolBuilder) *BoolBuilder
- func (b *BoolBuilder) MustNotCIDR(field string, cidr string) *BoolBuilder
- func (b *BoolBuilder) MustNotCIDRs(field string, cidrs ...string) *BoolBuilder
- func (b *BoolBuilder) MustNotExists(field string) *BoolBuilder
- func (b *BoolBuilder) MustNotFuzzy(field string, value string, fuzziness ...string) *BoolBuilder
- func (b *BoolBuilder) MustNotIDs(ids ...interface{}) *BoolBuilder
- func (b *BoolBuilder) MustNotIPRangeContains(field string, ip string) *BoolBuilder
- func (b *BoolBuilder) MustNotIPRangeIntersects(field string, fromIP, toIP string) *BoolBuilder
- func (b *BoolBuilder) MustNotIPRangeWithin(field string, fromIP, toIP string) *BoolBuilder
- func (b *BoolBuilder) MustNotKNN(field string, vector []float32, k int) *BoolBuilder
- func (b *BoolBuilder) MustNotMatch(field string, value string) *BoolBuilder
- func (b *BoolBuilder) MustNotMatchPhrase(field string, value string) *BoolBuilder
- func (b *BoolBuilder) MustNotMatchPhrasePrefix(field string, value string) *BoolBuilder
- func (b *BoolBuilder) MustNotMultiMatch(query string, fields []string, matchType ...string) *BoolBuilder
- func (b *BoolBuilder) MustNotPrefix(field string, prefix string) *BoolBuilder
- func (b *BoolBuilder) MustNotQuery(queries ...Query) *BoolBuilder
- func (b *BoolBuilder) MustNotQueryString(query string, defaultOperator ...string) *BoolBuilder
- func (b *BoolBuilder) MustNotRange(field string, op string, value interface{}) *BoolBuilder
- func (b *BoolBuilder) MustNotRegexp(field string, pattern string) *BoolBuilder
- func (b *BoolBuilder) MustNotTerm(field string, value interface{}) *BoolBuilder
- func (b *BoolBuilder) MustNotTerms(field string, values ...interface{}) *BoolBuilder
- func (b *BoolBuilder) MustNotWildcard(field string, pattern string) *BoolBuilder
- func (b *BoolBuilder) MustPrefix(field string, prefix string) *BoolBuilder
- func (b *BoolBuilder) MustQuery(queries ...Query) *BoolBuilder
- func (b *BoolBuilder) MustQueryString(query string, defaultOperator ...string) *BoolBuilder
- func (b *BoolBuilder) MustRange(field string, op string, value interface{}) *BoolBuilder
- func (b *BoolBuilder) MustRegexp(field string, pattern string) *BoolBuilder
- func (b *BoolBuilder) MustTerm(field string, value interface{}) *BoolBuilder
- func (b *BoolBuilder) MustTerms(field string, values ...interface{}) *BoolBuilder
- func (b *BoolBuilder) MustWildcard(field string, pattern string) *BoolBuilder
- func (b *BoolBuilder) ShouldBool(nested *BoolBuilder) *BoolBuilder
- func (b *BoolBuilder) ShouldCIDR(field string, cidr string) *BoolBuilder
- func (b *BoolBuilder) ShouldCIDRs(field string, cidrs ...string) *BoolBuilder
- func (b *BoolBuilder) ShouldExists(field string) *BoolBuilder
- func (b *BoolBuilder) ShouldFuzzy(field string, value string, fuzziness ...string) *BoolBuilder
- func (b *BoolBuilder) ShouldIPRangeContains(field string, ip string) *BoolBuilder
- func (b *BoolBuilder) ShouldIPRangeIntersects(field string, fromIP, toIP string) *BoolBuilder
- func (b *BoolBuilder) ShouldIPRangeWithin(field string, fromIP, toIP string) *BoolBuilder
- func (b *BoolBuilder) ShouldKNN(field string, vector []float32, k int) *BoolBuilder
- func (b *BoolBuilder) ShouldKNNWithFilter(field string, vector []float32, k int, filter Query) *BoolBuilder
- func (b *BoolBuilder) ShouldKNNWithMaxDistance(field string, vector []float32, k int, maxDistance float64) *BoolBuilder
- func (b *BoolBuilder) ShouldKNNWithMinScore(field string, vector []float32, k int, minScore float64) *BoolBuilder
- func (b *BoolBuilder) ShouldKNNWithOptions(field string, vector []float32, k int, opts KNNQueryOptions) *BoolBuilder
- func (b *BoolBuilder) ShouldMatch(field string, value string) *BoolBuilder
- func (b *BoolBuilder) ShouldMatchPhrase(field string, value string) *BoolBuilder
- func (b *BoolBuilder) ShouldMatchPhrasePrefix(field string, value string) *BoolBuilder
- func (b *BoolBuilder) ShouldMultiMatch(query string, fields []string, matchType ...string) *BoolBuilder
- func (b *BoolBuilder) ShouldPrefix(field string, prefix string) *BoolBuilder
- func (b *BoolBuilder) ShouldQuery(queries ...Query) *BoolBuilder
- func (b *BoolBuilder) ShouldQueryString(query string, defaultOperator ...string) *BoolBuilder
- func (b *BoolBuilder) ShouldRange(field string, op string, value interface{}) *BoolBuilder
- func (b *BoolBuilder) ShouldRegexp(field string, pattern string) *BoolBuilder
- func (b *BoolBuilder) ShouldTerm(field string, value interface{}) *BoolBuilder
- func (b *BoolBuilder) ShouldTerms(field string, values ...interface{}) *BoolBuilder
- func (b *BoolBuilder) ShouldWildcard(field string, pattern string) *BoolBuilder
- type BulkIndexItem
- type BulkItem
- type BulkItemError
- type BulkOperation
- type BulkQueue
- func (bq *BulkQueue) Add(index string, doc any)
- func (bq *BulkQueue) AddBatch(index string, docs []any)
- func (bq *BulkQueue) AddBatchWithIDs(index string, docs map[string]any)
- func (bq *BulkQueue) AddCreate(index, docID string, doc any)
- func (bq *BulkQueue) AddDelete(index, docID string)
- func (bq *BulkQueue) AddItem(item BulkItem)
- func (bq *BulkQueue) AddItems(items []BulkItem)
- func (bq *BulkQueue) AddUpdate(index, docID string, doc any)
- func (bq *BulkQueue) AddWithID(index, docID string, doc any)
- func (bq *BulkQueue) Clear()
- func (bq *BulkQueue) Config() BulkQueueConfig
- func (bq *BulkQueue) Flush() error
- func (bq *BulkQueue) IsRunning() bool
- func (bq *BulkQueue) Size() int
- func (bq *BulkQueue) Stop()
- type BulkQueueConfig
- type BulkResponse
- type Cardinality
- type Collapse
- type ComponentTemplateBuilder
- func (b *ComponentTemplateBuilder) AddField(name string, fieldType string) *ComponentTemplateBuilder
- func (b *ComponentTemplateBuilder) EnableKNN() *ComponentTemplateBuilder
- func (b *ComponentTemplateBuilder) Ensure() error
- func (b *ComponentTemplateBuilder) Mapping(properties map[string]interface{}) *ComponentTemplateBuilder
- func (b *ComponentTemplateBuilder) Meta(meta map[string]interface{}) *ComponentTemplateBuilder
- func (b *ComponentTemplateBuilder) Replicas(n int) *ComponentTemplateBuilder
- func (b *ComponentTemplateBuilder) Settings(settings map[string]interface{}) *ComponentTemplateBuilder
- func (b *ComponentTemplateBuilder) Shards(n int) *ComponentTemplateBuilder
- func (b *ComponentTemplateBuilder) Version(version int64) *ComponentTemplateBuilder
- type ConflictStrategy
- type DateRange
- type ExtendedStats
- type FieldInfo
- type FieldMapper
- type FieldTypeCategory
- type FieldTypeInfo
- type GeoDistance
- type Grid
- type Histogram
- type Hit
- type HitRaw
- type HitSource
- type Hits
- type ISMAction
- type ISMAllocationAction
- type ISMCloseAction
- type ISMConditions
- type ISMCronCondition
- type ISMDeleteAction
- type ISMExplainResult
- type ISMForceMergeAction
- type ISMIndexPriorityAction
- type ISMNotificationAction
- type ISMOpenAction
- type ISMPolicy
- type ISMPolicyBuilder
- func (b *ISMPolicyBuilder) AddState(name string) *ISMStateBuilder
- func (b *ISMPolicyBuilder) Build() (ISMPolicy, error)
- func (b *ISMPolicyBuilder) BuildWithErrors() (ISMPolicy, []error)
- func (b *ISMPolicyBuilder) DefaultState(state string) *ISMPolicyBuilder
- func (b *ISMPolicyBuilder) Description(desc string) *ISMPolicyBuilder
- func (b *ISMPolicyBuilder) Ensure() error
- func (b *ISMPolicyBuilder) ISMTemplate(patterns []string, priority int) *ISMPolicyBuilder
- type ISMReadOnlyAction
- type ISMReplicaCountAction
- type ISMRetry
- type ISMRolloverAction
- type ISMShrinkAction
- type ISMSnapshotAction
- type ISMState
- type ISMStateBuilder
- func (s *ISMStateBuilder) AllocationAction(require, include, exclude map[string]string) *ISMStateBuilder
- func (s *ISMStateBuilder) CloseAction() *ISMStateBuilder
- func (s *ISMStateBuilder) CustomAction(action map[string]interface{}) *ISMStateBuilder
- func (s *ISMStateBuilder) DeleteAction() *ISMStateBuilder
- func (s *ISMStateBuilder) Done() *ISMPolicyBuilder
- func (s *ISMStateBuilder) ForceMergeAction(maxSegments int) *ISMStateBuilder
- func (s *ISMStateBuilder) IndexPriorityAction(priority int) *ISMStateBuilder
- func (s *ISMStateBuilder) OpenAction() *ISMStateBuilder
- func (s *ISMStateBuilder) ReadOnlyAction() *ISMStateBuilder
- func (s *ISMStateBuilder) ReplicaCountAction(replicas int) *ISMStateBuilder
- func (s *ISMStateBuilder) RolloverAction(conditions RolloverConditions) *ISMStateBuilder
- func (s *ISMStateBuilder) ShrinkAction(numShards int) *ISMStateBuilder
- func (s *ISMStateBuilder) SnapshotAction(repository, snapshot string) *ISMStateBuilder
- func (s *ISMStateBuilder) TransitionTo(stateName string) *ISMTransitionBuilder
- type ISMTemplate
- type ISMTransition
- type ISMTransitionBuilder
- func (t *ISMTransitionBuilder) AfterMinAge(age string) *ISMTransitionBuilder
- func (t *ISMTransitionBuilder) AfterMinDocs(docs int64) *ISMTransitionBuilder
- func (t *ISMTransitionBuilder) AfterMinSize(size string) *ISMTransitionBuilder
- func (t *ISMTransitionBuilder) Done() *ISMStateBuilder
- func (t *ISMTransitionBuilder) OnCron(expr, timezone string) *ISMTransitionBuilder
- type IndexBuilder
- func (b *IndexBuilder) AddBooleanField(name string) *IndexBuilder
- func (b *IndexBuilder) AddDateField(name string, format string) *IndexBuilder
- func (b *IndexBuilder) AddDoubleField(name string) *IndexBuilder
- func (b *IndexBuilder) AddField(name string, fieldType string) *IndexBuilder
- func (b *IndexBuilder) AddFlatObjectField(name string) *IndexBuilder
- func (b *IndexBuilder) AddFloatField(name string) *IndexBuilder
- func (b *IndexBuilder) AddGeoPointField(name string) *IndexBuilder
- func (b *IndexBuilder) AddIPField(name string) *IndexBuilder
- func (b *IndexBuilder) AddIntegerField(name string) *IndexBuilder
- func (b *IndexBuilder) AddKNNVectorField(name string, dimension int, method *KNNMethod) *IndexBuilder
- func (b *IndexBuilder) AddKeywordField(name string) *IndexBuilder
- func (b *IndexBuilder) AddLongField(name string) *IndexBuilder
- func (b *IndexBuilder) AddNestedField(name string, properties map[string]interface{}) *IndexBuilder
- func (b *IndexBuilder) AddObjectField(name string, properties map[string]interface{}) *IndexBuilder
- func (b *IndexBuilder) AddProperty(name string, property MappingProperty) *IndexBuilder
- func (b *IndexBuilder) AddTextField(name string, analyzer string) *IndexBuilder
- func (b *IndexBuilder) Alias(alias string) *IndexBuilder
- func (b *IndexBuilder) AliasWithConfig(alias string, config AliasConfig) *IndexBuilder
- func (b *IndexBuilder) Analysis(analysis *AnalysisSettings) *IndexBuilder
- func (b *IndexBuilder) Build() (IndexCreateRequest, error)
- func (b *IndexBuilder) BuildWithErrors() (IndexCreateRequest, []error)
- func (b *IndexBuilder) CustomSetting(key string, value interface{}) *IndexBuilder
- func (b *IndexBuilder) DynamicMapping(dynamic string) *IndexBuilder
- func (b *IndexBuilder) EnableKNN() *IndexBuilder
- func (b *IndexBuilder) Ensure() error
- func (b *IndexBuilder) KNNAlgoParamEFSearch(ef int) *IndexBuilder
- func (b *IndexBuilder) Mapping(properties map[string]interface{}) *IndexBuilder
- func (b *IndexBuilder) MaxResultWindow(size int) *IndexBuilder
- func (b *IndexBuilder) RefreshInterval(interval string) *IndexBuilder
- func (b *IndexBuilder) Replicas(n int) *IndexBuilder
- func (b *IndexBuilder) Shards(n int) *IndexBuilder
- func (b *IndexBuilder) WriteAlias(alias string) *IndexBuilder
- type IndexCreateRequest
- type IndexInfo
- type IndexSettings
- type IndexSettingsUpdater
- func (u *IndexSettingsUpdater) CustomSetting(key string, value interface{}) *IndexSettingsUpdater
- func (u *IndexSettingsUpdater) MaxResultWindow(size int) *IndexSettingsUpdater
- func (u *IndexSettingsUpdater) RefreshInterval(interval string) *IndexSettingsUpdater
- func (u *IndexSettingsUpdater) Replicas(n int) *IndexSettingsUpdater
- func (u *IndexSettingsUpdater) Update() error
- type IndexStats
- type IndexTemplate
- type KNNMethod
- type KNNMethodParameters
- type KNNQuery
- type KNNQueryOptions
- type KNNRescoreContext
- type MLInferenceResult
- type MLModelConfig
- type MLModelGroup
- type MLModelInfo
- type MLModelInnerConfig
- type MLOutputData
- type MLPredictRequest
- type MLPredictResponse
- type MLTaskInfo
- type MapperOption
- type MappingBuilder
- func (b *MappingBuilder) AddBooleanField(name string) *MappingBuilder
- func (b *MappingBuilder) AddDateField(name string, format string) *MappingBuilder
- func (b *MappingBuilder) AddDoubleField(name string) *MappingBuilder
- func (b *MappingBuilder) AddField(name string, fieldType string) *MappingBuilder
- func (b *MappingBuilder) AddFloatField(name string) *MappingBuilder
- func (b *MappingBuilder) AddIntegerField(name string) *MappingBuilder
- func (b *MappingBuilder) AddKNNVectorField(name string, dimension int, method *KNNMethod) *MappingBuilder
- func (b *MappingBuilder) AddKeywordField(name string) *MappingBuilder
- func (b *MappingBuilder) AddLongField(name string) *MappingBuilder
- func (b *MappingBuilder) AddNestedField(name string, properties map[string]MappingProperty) *MappingBuilder
- func (b *MappingBuilder) AddObjectField(name string, properties map[string]MappingProperty) *MappingBuilder
- func (b *MappingBuilder) AddProperty(name string, property MappingProperty) *MappingBuilder
- func (b *MappingBuilder) AddTextField(name string, analyzer string) *MappingBuilder
- func (b *MappingBuilder) Build() (map[string]interface{}, error)
- func (b *MappingBuilder) BuildWithErrors() (map[string]interface{}, []error)
- func (b *MappingBuilder) Ensure() error
- type MappingCache
- type MappingProperty
- type Match
- type MatchBoolPrefix
- type MatchPhrase
- type MatchPhrasePrefix
- type MergedMapping
- type MovingAvg
- type MultiMatch
- type MultiTerms
- type PercentileRanks
- type PipelineAgg
- type Query
- func And(queries ...Query) Query
- func CIDRQuery(field string, cidr string) Query
- func CIDRsQuery(field string, cidrs ...string) Query
- func ExistsQuery(field string) Query
- func FuzzyQuery(field string, value string, fuzziness ...string) Query
- func IDsQuery(ids []interface{}) Query
- func IPRangeContainsQuery(field string, ip string) Query
- func IPRangeIntersectsQuery(field string, fromIP, toIP string) Query
- func IPRangeWithinQuery(field string, fromIP, toIP string) Query
- func MatchPhrasePrefixQuery(field string, query string) Query
- func MatchPhraseQuery(field string, query string) Query
- func MatchQuery(field string, query string) Query
- func MultiMatchQuery(query string, fields []string) Query
- func NewKNNQuery(field string, vector []float32, k int) Query
- func NewKNNQueryWithFilter(field string, vector []float32, k int, filter Query) Query
- func NewKNNQueryWithMaxDistance(field string, vector []float32, k int, maxDistance float64) Query
- func NewKNNQueryWithMinScore(field string, vector []float32, k int, minScore float64) Query
- func NewKNNQueryWithOptions(field string, vector []float32, k int, opts KNNQueryOptions) Query
- func Not(queries ...Query) Query
- func Or(queries ...Query) Query
- func PrefixQuery(field string, prefix string) Query
- func QueryStringQuery(query string, defaultField ...string) Query
- func RangeGt(field string, value interface{}) Query
- func RangeGte(field string, value interface{}) Query
- func RangeLt(field string, value interface{}) Query
- func RangeLte(field string, value interface{}) Query
- func RangeQuery(field string, operator string, value interface{}) Query
- func RangeQueryBetween(field string, gte, lte interface{}) Query
- func RegexpQuery(field string, regexp string) Query
- func SimpleQueryStringQuery(query string, fields ...string) Query
- func TermQuery(field string, value interface{}) Query
- func TermsQuery(field string, values []interface{}) Query
- func WildcardQuery(field string, pattern string) Query
- type QueryBuilder
- func (b *QueryBuilder) AdjacencyMatrixAgg(name string, filters map[string]interface{}) *QueryBuilder
- func (b *QueryBuilder) Agg(name string, agg Aggs) *QueryBuilder
- func (b *QueryBuilder) AvgAgg(name string, field string) *QueryBuilder
- func (b *QueryBuilder) AvgBucketAgg(name string, bucketsPath string) *QueryBuilder
- func (b *QueryBuilder) Bool() *BoolBuilder
- func (b *QueryBuilder) BucketSortAgg(name string, sort []map[string]interface{}, size int) *QueryBuilder
- func (b *QueryBuilder) Build() SearchRequest
- func (b *QueryBuilder) BuildWithErrors() (SearchRequest, []error)
- func (b *QueryBuilder) CIDR(field string, cidr string) *QueryBuilder
- func (b *QueryBuilder) CIDRs(field string, cidrs ...string) *QueryBuilder
- func (b *QueryBuilder) CardinalityAgg(name string, field string) *QueryBuilder
- func (b *QueryBuilder) Collapse(field string) *QueryBuilder
- func (b *QueryBuilder) CumulativeSumAgg(name string, bucketsPath string) *QueryBuilder
- func (b *QueryBuilder) DateHistogramAgg(name string, field string, interval string) *QueryBuilder
- func (b *QueryBuilder) DateRangeAgg(name string, field string, format string, ranges []map[string]interface{}) *QueryBuilder
- func (b *QueryBuilder) DerivativeAgg(name string, bucketsPath string) *QueryBuilder
- func (b *QueryBuilder) DiversifiedSamplerAgg(name string, field string, shardSize int) *QueryBuilder
- func (b *QueryBuilder) ExcludeSource(fields ...string) *QueryBuilder
- func (b *QueryBuilder) Exists(field string) *QueryBuilder
- func (b *QueryBuilder) ExtendedStatsAgg(name string, field string, sigma int64) *QueryBuilder
- func (b *QueryBuilder) ExtendedStatsBucketAgg(name string, bucketsPath string) *QueryBuilder
- func (b *QueryBuilder) Filter(queries ...Query) *QueryBuilder
- func (b *QueryBuilder) FilterAgg(name string, filter Query) *QueryBuilder
- func (b *QueryBuilder) FilterBool(nested *BoolBuilder) *QueryBuilder
- func (b *QueryBuilder) FiltersAgg(name string, filters map[string]interface{}) *QueryBuilder
- func (b *QueryBuilder) From(from int64) *QueryBuilder
- func (b *QueryBuilder) Fuzzy(field string, value string, fuzziness ...string) *QueryBuilder
- func (b *QueryBuilder) GeoDistanceAgg(name string, field string, origin interface{}, ranges []map[string]interface{}) *QueryBuilder
- func (b *QueryBuilder) GeohashGridAgg(name string, field string, precision int) *QueryBuilder
- func (b *QueryBuilder) GeohexGridAgg(name string, field string, precision int) *QueryBuilder
- func (b *QueryBuilder) GeotileGridAgg(name string, field string, precision int) *QueryBuilder
- func (b *QueryBuilder) GetMappingConflicts() []FieldInfo
- func (b *QueryBuilder) GlobalAgg(name string) *QueryBuilder
- func (b *QueryBuilder) HistogramAgg(name string, field string, interval float64) *QueryBuilder
- func (b *QueryBuilder) IDs(ids ...interface{}) *QueryBuilder
- func (b *QueryBuilder) IPRangeAgg(name string, field string, ranges []map[string]interface{}) *QueryBuilder
- func (b *QueryBuilder) IPRangeContains(field string, ip string) *QueryBuilder
- func (b *QueryBuilder) IPRangeIntersects(field string, fromIP, toIP string) *QueryBuilder
- func (b *QueryBuilder) IPRangeWithin(field string, fromIP, toIP string) *QueryBuilder
- func (b *QueryBuilder) IncludeSource(fields ...string) *QueryBuilder
- func (b *QueryBuilder) KNN(field string, vector []float32, k int) *QueryBuilder
- func (b *QueryBuilder) KNNWithFilter(field string, vector []float32, k int, filter Query) *QueryBuilder
- func (b *QueryBuilder) KNNWithMaxDistance(field string, vector []float32, k int, maxDistance float64) *QueryBuilder
- func (b *QueryBuilder) KNNWithMinScore(field string, vector []float32, k int, minScore float64) *QueryBuilder
- func (b *QueryBuilder) KNNWithOptions(field string, vector []float32, k int, opts KNNQueryOptions) *QueryBuilder
- func (b *QueryBuilder) Match(field string, value string) *QueryBuilder
- func (b *QueryBuilder) MatchAll() *QueryBuilder
- func (b *QueryBuilder) MatchPhrase(field string, value string) *QueryBuilder
- func (b *QueryBuilder) MatchPhrasePrefix(field string, value string) *QueryBuilder
- func (b *QueryBuilder) MatrixStatsAgg(name string, fields []string) *QueryBuilder
- func (b *QueryBuilder) MaxAgg(name string, field string) *QueryBuilder
- func (b *QueryBuilder) MaxBucketAgg(name string, bucketsPath string) *QueryBuilder
- func (b *QueryBuilder) MinAgg(name string, field string) *QueryBuilder
- func (b *QueryBuilder) MinBucketAgg(name string, bucketsPath string) *QueryBuilder
- func (b *QueryBuilder) MinimumShouldMatch(value interface{}) *QueryBuilder
- func (b *QueryBuilder) MovingAvgAgg(name string, bucketsPath string, window int, model string) *QueryBuilder
- func (b *QueryBuilder) MultiMatch(query string, fields []string, matchType ...string) *QueryBuilder
- func (b *QueryBuilder) MultiTermsAgg(name string, terms []Agg, order map[string]string) *QueryBuilder
- func (b *QueryBuilder) Must(queries ...Query) *QueryBuilder
- func (b *QueryBuilder) MustBool(nested *BoolBuilder) *QueryBuilder
- func (b *QueryBuilder) MustNot(queries ...Query) *QueryBuilder
- func (b *QueryBuilder) MustNotBool(nested *BoolBuilder) *QueryBuilder
- func (b *QueryBuilder) NestedAgg(name string, path string) *QueryBuilder
- func (b *QueryBuilder) PercentileRanksAgg(name string, field string, values []int64) *QueryBuilder
- func (b *QueryBuilder) PercentilesAgg(name string, field string) *QueryBuilder
- func (b *QueryBuilder) Prefix(field string, prefix string) *QueryBuilder
- func (b *QueryBuilder) QueryString(query string, defaultOperator ...string) *QueryBuilder
- func (b *QueryBuilder) Range(field string, operator string, value interface{}) *QueryBuilder
- func (b *QueryBuilder) RangeAgg(name string, field string, ranges []map[string]interface{}) *QueryBuilder
- func (b *QueryBuilder) Regexp(field string, pattern string) *QueryBuilder
- func (b *QueryBuilder) ReverseNestedAgg(name string) *QueryBuilder
- func (b *QueryBuilder) SamplerAgg(name string, shardSize int) *QueryBuilder
- func (b *QueryBuilder) ScriptFields(scripts interface{}) *QueryBuilder
- func (b *QueryBuilder) SearchAfter(values []any) *QueryBuilder
- func (b *QueryBuilder) SerialDiffAgg(name string, bucketsPath string, lag int) *QueryBuilder
- func (b *QueryBuilder) SetSource(source *Source) *QueryBuilder
- func (b *QueryBuilder) Should(queries ...Query) *QueryBuilder
- func (b *QueryBuilder) ShouldBool(nested *BoolBuilder) *QueryBuilder
- func (b *QueryBuilder) SignificantTermsAgg(name string, field string) *QueryBuilder
- func (b *QueryBuilder) SignificantTextAgg(name string, field string, opts map[string]interface{}) *QueryBuilder
- func (b *QueryBuilder) SimpleQueryString(query string, fields ...string) *QueryBuilder
- func (b *QueryBuilder) Size(size int64) *QueryBuilder
- func (b *QueryBuilder) Sort(field string, order string) *QueryBuilder
- func (b *QueryBuilder) StatsAgg(name string, field string) *QueryBuilder
- func (b *QueryBuilder) StatsBucketAgg(name string, bucketsPath string) *QueryBuilder
- func (b *QueryBuilder) StoredFields(fields ...string) *QueryBuilder
- func (b *QueryBuilder) SubAgg(parentName string, childName string, childAgg Aggs) *QueryBuilder
- func (b *QueryBuilder) SumAgg(name string, field string) *QueryBuilder
- func (b *QueryBuilder) SumBucketAgg(name string, bucketsPath string) *QueryBuilder
- func (b *QueryBuilder) Term(field string, value interface{}) *QueryBuilder
- func (b *QueryBuilder) Terms(field string, values []interface{}) *QueryBuilder
- func (b *QueryBuilder) TermsAgg(name string, field string, size int64) *QueryBuilder
- func (b *QueryBuilder) TopHitsAgg(name string, size int64) *QueryBuilder
- func (b *QueryBuilder) ValueCountAgg(name string, field string) *QueryBuilder
- func (b *QueryBuilder) Version(enabled bool) *QueryBuilder
- func (b *QueryBuilder) Wildcard(field string, pattern string) *QueryBuilder
- type QueryString
- type QueryType
- type Range
- type RolloverBuilder
- func (b *RolloverBuilder) Aliases(aliases map[string]interface{}) *RolloverBuilder
- func (b *RolloverBuilder) Build() (map[string]interface{}, error)
- func (b *RolloverBuilder) DryRun() *RolloverBuilder
- func (b *RolloverBuilder) Execute() (*RolloverResult, error)
- func (b *RolloverBuilder) Mappings(mappings map[string]interface{}) *RolloverBuilder
- func (b *RolloverBuilder) MaxAge(age string) *RolloverBuilder
- func (b *RolloverBuilder) MaxDocs(docs int64) *RolloverBuilder
- func (b *RolloverBuilder) MaxPrimaryShardDocs(docs int64) *RolloverBuilder
- func (b *RolloverBuilder) MaxPrimaryShardSize(size string) *RolloverBuilder
- func (b *RolloverBuilder) MaxSize(size string) *RolloverBuilder
- func (b *RolloverBuilder) MinAge(age string) *RolloverBuilder
- func (b *RolloverBuilder) MinDocs(docs int64) *RolloverBuilder
- func (b *RolloverBuilder) MinPrimaryShardDocs(docs int64) *RolloverBuilder
- func (b *RolloverBuilder) MinPrimaryShardSize(size string) *RolloverBuilder
- func (b *RolloverBuilder) MinSize(size string) *RolloverBuilder
- func (b *RolloverBuilder) NewIndexName(name string) *RolloverBuilder
- func (b *RolloverBuilder) Settings(settings map[string]interface{}) *RolloverBuilder
- type RolloverConditions
- type RolloverResult
- type SearchRequest
- type SearchResult
- type SearchResultRaw
- type SerialDiff
- type Shards
- type SimpleQueryString
- type Source
- type TemplateAliasConfig
- type TemplateBuilder
- func (b *TemplateBuilder) AddDateField(name string, format string) *TemplateBuilder
- func (b *TemplateBuilder) AddField(name string, fieldType string) *TemplateBuilder
- func (b *TemplateBuilder) AddKNNVectorField(name string, dimension int, method *KNNMethod) *TemplateBuilder
- func (b *TemplateBuilder) AddKeywordField(name string) *TemplateBuilder
- func (b *TemplateBuilder) AddNestedField(name string, properties map[string]interface{}) *TemplateBuilder
- func (b *TemplateBuilder) AddTextField(name string, analyzer string) *TemplateBuilder
- func (b *TemplateBuilder) Alias(alias string) *TemplateBuilder
- func (b *TemplateBuilder) AliasWithConfig(alias string, config TemplateAliasConfig) *TemplateBuilder
- func (b *TemplateBuilder) Build() (IndexTemplate, error)
- func (b *TemplateBuilder) BuildWithErrors() (IndexTemplate, []error)
- func (b *TemplateBuilder) ComposedOf(components ...string) *TemplateBuilder
- func (b *TemplateBuilder) CustomSetting(key string, value interface{}) *TemplateBuilder
- func (b *TemplateBuilder) DynamicMapping(dynamic string) *TemplateBuilder
- func (b *TemplateBuilder) EnableKNN() *TemplateBuilder
- func (b *TemplateBuilder) Ensure() error
- func (b *TemplateBuilder) IndexPatterns(patterns ...string) *TemplateBuilder
- func (b *TemplateBuilder) KNNAlgoParamEFSearch(ef int) *TemplateBuilder
- func (b *TemplateBuilder) Mapping(properties map[string]interface{}) *TemplateBuilder
- func (b *TemplateBuilder) Meta(meta map[string]interface{}) *TemplateBuilder
- func (b *TemplateBuilder) Priority(priority int) *TemplateBuilder
- func (b *TemplateBuilder) RefreshInterval(interval string) *TemplateBuilder
- func (b *TemplateBuilder) Replicas(n int) *TemplateBuilder
- func (b *TemplateBuilder) Settings(settings map[string]interface{}) *TemplateBuilder
- func (b *TemplateBuilder) Shards(n int) *TemplateBuilder
- func (b *TemplateBuilder) Version(version int64) *TemplateBuilder
- func (b *TemplateBuilder) WriteAlias(alias string) *TemplateBuilder
- type TemplateContent
- type Terms
- type TopHits
- type Total
- type Update
Constants ¶
const ( // EntityPrefix is the prefix for entity indices. EntityPrefix string = "entity" // RelationPrefix is the prefix for relationship indices. RelationPrefix string = "relation" // CommentPrefix is the prefix for commentary indices. CommentPrefix string = "comment" // ConsolidatedPrefix is the prefix for consolidated indices. ConsolidatedPrefix string = "consolidated" // HistoryPrefix is the prefix for historic indices. HistoryPrefix string = "history" )
const ( MLModelStateDeployed = "DEPLOYED" MLModelStateRegistered = "REGISTERED" MLModelStateDeploying = "DEPLOYING" MLModelStateDeployFailed = "DEPLOY_FAILED" MLModelStateUndeployed = "UNDEPLOYED" )
MLModelState constants
const ( MLTaskStateCreated = "CREATED" MLTaskStateRunning = "RUNNING" MLTaskStateCompleted = "COMPLETED" MLTaskStateFailed = "FAILED" MLTaskStateCancelled = "CANCELLED" )
MLTaskState constants
Variables ¶
This section is empty.
Functions ¶
func AliasExists ¶
AliasExists checks if an alias exists
func ApplyISMPolicy ¶
ApplyISMPolicy applies an ISM policy to an index
func BoolPtr ¶
BoolPtr is a helper to create a pointer to a bool value. Useful for setting optional KNN query parameters.
func BuildCurrentIndex ¶
BuildCurrentIndex returns a string representing the current index based on the given elements.
func BuildIndex ¶
BuildIndex returns a string representing an index based on the given date and elements.
func BuildIndexPattern ¶
BuildIndexPattern returns a string representing an index pattern based on the given elements.
func BuildInitialRolloverIndex ¶
BuildInitialRolloverIndex returns the first rollover index name for a prefix. Example: BuildInitialRolloverIndex("messages") returns "messages-000001"
func BuildRolloverIndex ¶
BuildRolloverIndex returns a rollover index name with the given sequence number. Example: BuildRolloverIndex("messages", 1) returns "messages-000001"
func BulkIndex ¶
func BulkIndex(ctx context.Context, items []BulkIndexItem) error
BulkIndex performs bulk index/delete operations
func CloseIndex ¶
CloseIndex closes an index
func Connect ¶
Connect establishes a singleton connection to OpenSearch. Only the first successful call takes effect; later calls return the existing connection. The connection uses TLS with certificate verification disabled.
func CreateMLModelGroup ¶
CreateMLModelGroup creates a new model group for organizing ML models
func DeleteAlias ¶
DeleteAlias removes an alias from an index
func DeleteISMPolicy ¶
DeleteISMPolicy deletes an ISM policy
func DeleteIndex ¶
DeleteIndex deletes an index
func DeleteIndexTemplate ¶
DeleteIndexTemplate deletes an index template
func DeleteMLModel ¶
DeleteMLModel deletes a model by ID
func DeleteMLModelGroup ¶
DeleteMLModelGroup deletes a model group by ID
func DeployMLModel ¶
DeployMLModel deploys a registered model Returns the task ID for async deployment
func Float64Ptr ¶
Float64Ptr is a helper to create a pointer to a float64 value. Useful for setting optional KNN query parameters.
func GetAllFieldTypes ¶
func GetAllFieldTypes() []string
GetAllFieldTypes returns all registered field type names
func GetCurrentWriteIndex ¶
GetCurrentWriteIndex returns the current write index for an alias
func GetIndexSettings ¶
GetIndexSettings retrieves the settings of an index
func GetIndicesForAlias ¶
GetIndicesForAlias returns all indices that have the given alias
func GetMostPermissiveType ¶
GetMostPermissiveType returns the type with highest priority from a list
func GetRolloverSequence ¶
GetRolloverSequence returns the sequence number from a rollover index name. Returns 0 if the index name doesn't follow the rollover convention.
func GetTypePriority ¶
GetTypePriority returns the priority for conflict resolution
func GetWriteIndex ¶
GetWriteIndex returns the write index for an alias
func ISMPolicyExists ¶
ISMPolicyExists checks if an ISM policy exists
func IndexDoc ¶
IndexDoc indexes a document in OpenSearch. It takes a document, an index name, and an ID as input parameters. The document is marshalled to JSON and sent to OpenSearch for indexing. Returns an error if there is an issue with marshalling the document to JSON, if there is an issue with the request to OpenSearch, or if the response status code is not 200, 201, or 202.
func IndexExists ¶
IndexExists checks if an index exists
func IndexTemplateExists ¶
IndexTemplateExists checks if an index template exists
func IntPtr ¶
IntPtr is a helper to create a pointer to an int value. Useful for setting optional KNN query parameters.
func IsAggregatable ¶
IsAggregatable returns true if the type supports aggregations
func IsRangeType ¶
IsRangeType returns true if the type supports range queries
func IsRolloverIndex ¶
IsRolloverIndex checks if an index name follows the rollover naming convention.
func IsSortable ¶
IsSortable returns true if the type supports sorting
func IsTermType ¶
IsTermType returns true if the type supports term/exact queries
func IsTextType ¶
IsTextType returns true if the type supports full-text match queries
func MLPredict ¶
MLPredict generates text embeddings for multiple texts using a deployed model POST /_plugins/_ml/_predict/text_embedding/{model_id}
func MLPredictBatch ¶
func MLPredictBatch(ctx context.Context, modelID string, texts []string, batchSize int) ([][]float32, error)
MLPredictBatch generates embeddings for texts in batches Useful for large numbers of texts that need to be processed in smaller chunks
func MLPredictGeneric ¶
func MLPredictGeneric(ctx context.Context, modelID string, input map[string]interface{}) (map[string]interface{}, error)
MLPredictGeneric performs a generic prediction with custom input POST /_plugins/_ml/models/{model_id}/_predict
func MLPredictSingle ¶
MLPredictSingle generates a text embedding for a single text
func NeedsKeywordSubfield ¶
NeedsKeywordSubfield returns true if the type needs .keyword for term queries
func NextRolloverIndex ¶
NextRolloverIndex returns the next rollover index name in sequence. Example: NextRolloverIndex("messages-000001") returns ("messages-000002", nil)
func ParseRolloverIndex ¶
ParseRolloverIndex parses a rollover index name and returns its components. Example: ParseRolloverIndex("messages-000001") returns ("messages", 1, nil)
func RefreshIndex ¶
RefreshIndex refreshes one or more indices
func RegisterFieldType ¶
func RegisterFieldType(info FieldTypeInfo)
RegisterFieldType allows registering custom field types
func RegisterMLModel ¶
func RegisterMLModel(ctx context.Context, cfg *MLModelConfig) (modelID string, taskID string, err error)
RegisterMLModel registers a new ML model Returns the model ID and task ID for async registration
func RemoveISMPolicy ¶
RemoveISMPolicy removes an ISM policy from an index
func SetupRolloverAlias ¶
func SetupRolloverAlias(ctx context.Context, indexPrefix, alias, processName string, setupFunc func(*IndexBuilder) *IndexBuilder) error
SetupRolloverAlias creates the initial index and alias for rollover This is idempotent - if the alias already exists, it does nothing The setupFunc parameter is called with a new IndexBuilder for configuration
func UndeployMLModel ¶
UndeployMLModel undeploys a deployed model
func UpdateByQuery ¶ added in v1.1.6
func UpdateByQuery(ctx context.Context, indices []string, body map[string]interface{}) ([]byte, error)
UpdateByQuery performs an update on documents matching a query.
func ValidateQuery ¶
ValidateQuery checks if a query is valid for the given field type
Types ¶
type Aggs ¶
type Aggs struct {
Aggs map[string]Aggs `json:"aggs,omitempty"`
Avg *Agg `json:"avg,omitempty"`
Sum *Agg `json:"sum,omitempty"`
Min *Agg `json:"min,omitempty"`
Max *Agg `json:"max,omitempty"`
Cardinality *Cardinality `json:"cardinality,omitempty"`
ValueCount *Agg `json:"value_count,omitempty"`
Stats *Agg `json:"stats,omitempty"`
ExtendedStats *ExtendedStats `json:"extended_stats,omitempty"`
MatrixStats map[string][]string `json:"matrix_stats,omitempty"`
Percentiles *Agg `json:"percentiles,omitempty"`
PercentileRanks *PercentileRanks `json:"percentile_ranks,omitempty"`
TopHits *TopHits `json:"top_hits,omitempty"`
Terms *Terms `json:"terms,omitempty"`
MultiTerms *MultiTerms `json:"multi_terms,omitempty"`
Sampler map[string]interface{} `json:"sampler,omitempty"`
DiversifiedSampler map[string]interface{} `json:"diversified_sampler,omitempty"`
SignificantTerms *Agg `json:"significant_terms,omitempty"`
SignificantText map[string]interface{} `json:"significant_text,omitempty"`
Histogram *Histogram `json:"histogram,omitempty"`
DateHistogram *Histogram `json:"date_histogram,omitempty"`
Range *Range `json:"range,omitempty"`
DateRange *DateRange `json:"date_range,omitempty"`
IPRange *Range `json:"ip_range,omitempty"`
Filter map[string]interface{} `json:"filter,omitempty"`
Filters map[string]interface{} `json:"filters,omitempty"`
Global interface{} `json:"global,omitempty"`
Nested map[string]string `json:"nested,omitempty"`
ReverseNested interface{} `json:"reverse_nested,omitempty"`
SumBucket *PipelineAgg `json:"sum_bucket,omitempty"`
AvgBucket *PipelineAgg `json:"avg_bucket,omitempty"`
MinBucket *PipelineAgg `json:"min_bucket,omitempty"`
MaxBucket *PipelineAgg `json:"max_bucket,omitempty"`
StatsBucket *PipelineAgg `json:"stats_bucket,omitempty"`
ExtendedStatsBucket *PipelineAgg `json:"extended_stats_bucket,omitempty"`
BucketSort map[string]interface{} `json:"bucket_sort,omitempty"`
CumulativeSum *PipelineAgg `json:"cumulative_sum,omitempty"`
Derivative *PipelineAgg `json:"derivative,omitempty"`
MovingAvg *MovingAvg `json:"moving_avg,omitempty"`
SerialDiff *SerialDiff `json:"serial_diff,omitempty"`
GeoDistance *GeoDistance `json:"geo_distance,omitempty"`
GeohashGrid *Grid `json:"geohash_grid,omitempty"`
GeohexGrid *Grid `json:"geohex_grid,omitempty"`
GeotileGrid *Grid `json:"geotile_grid,omitempty"`
AdjacencyMatrix map[string]interface{} `json:"adjacency_matrix,omitempty"`
}
Aggs represents aggregation configurations for OpenSearch queries.
type AliasAction ¶
type AliasAction struct {
ActionType string `json:"-"` // "add" or "remove"
Index string `json:"index,omitempty"`
Alias string `json:"alias,omitempty"`
Indices []string `json:"indices,omitempty"`
Filter map[string]interface{} `json:"filter,omitempty"`
Routing string `json:"routing,omitempty"`
IsWriteIndex *bool `json:"is_write_index,omitempty"`
IsHidden *bool `json:"is_hidden,omitempty"`
}
AliasAction represents a single alias action (add or remove)
type AliasBuilder ¶
type AliasBuilder struct {
// contains filtered or unexported fields
}
AliasBuilder provides a fluent API for alias operations
func NewAliasBuilder ¶
func NewAliasBuilder(ctx context.Context, processName string) *AliasBuilder
NewAliasBuilder creates a new alias builder
func (*AliasBuilder) Add ¶
func (b *AliasBuilder) Add(index, alias string) *AliasBuilder
Add adds an alias to an index
func (*AliasBuilder) AddHidden ¶
func (b *AliasBuilder) AddHidden(index, alias string) *AliasBuilder
AddHidden adds a hidden alias
func (*AliasBuilder) AddWithConfig ¶
func (b *AliasBuilder) AddWithConfig(index, alias string, config AliasConfig) *AliasBuilder
AddWithConfig adds an alias with full configuration
func (*AliasBuilder) AddWithFilter ¶
func (b *AliasBuilder) AddWithFilter(index, alias string, filter map[string]interface{}) *AliasBuilder
AddWithFilter adds an alias with a filter
func (*AliasBuilder) AddWithRouting ¶
func (b *AliasBuilder) AddWithRouting(index, alias, routing string) *AliasBuilder
AddWithRouting adds an alias with routing
func (*AliasBuilder) AddWriteIndex ¶
func (b *AliasBuilder) AddWriteIndex(index, alias string) *AliasBuilder
AddWriteIndex adds an alias as the write index
func (*AliasBuilder) Build ¶
func (b *AliasBuilder) Build() (map[string]interface{}, error)
Build returns the alias update request body
func (*AliasBuilder) BuildWithErrors ¶
func (b *AliasBuilder) BuildWithErrors() (map[string]interface{}, []error)
BuildWithErrors returns the request body and any accumulated errors
func (*AliasBuilder) Ensure ¶
func (b *AliasBuilder) Ensure() error
Ensure executes the alias actions (idempotent atomic operation)
func (*AliasBuilder) Remove ¶
func (b *AliasBuilder) Remove(index, alias string) *AliasBuilder
Remove removes an alias from an index
func (*AliasBuilder) RemoveIndex ¶
func (b *AliasBuilder) RemoveIndex(index string) *AliasBuilder
RemoveIndex removes all aliases from an index
func (*AliasBuilder) Switch ¶
func (b *AliasBuilder) Switch(alias, fromIndex, toIndex string) *AliasBuilder
Switch atomically switches an alias from one index to another
func (*AliasBuilder) SwitchWriteIndex ¶
func (b *AliasBuilder) SwitchWriteIndex(alias, fromIndex, toIndex string) *AliasBuilder
SwitchWriteIndex atomically switches the writing index for an alias
type AliasConfig ¶
type AliasConfig struct {
Filter map[string]interface{} `json:"filter,omitempty"`
Routing string `json:"routing,omitempty"`
SearchRouting string `json:"search_routing,omitempty"`
IndexRouting string `json:"index_routing,omitempty"`
IsWriteIndex *bool `json:"is_write_index,omitempty"`
IsHidden *bool `json:"is_hidden,omitempty"`
}
AliasConfig represents a configuration for an alias
type AliasInfo ¶
type AliasInfo struct {
Alias string
Index string
Config AliasConfig
}
AliasInfo represents information about an alias
type AnalysisSettings ¶
type AnalysisSettings struct {
Analyzer map[string]interface{} `json:"analyzer,omitempty"`
Tokenizer map[string]interface{} `json:"tokenizer,omitempty"`
Filter map[string]interface{} `json:"filter,omitempty"`
CharFilter map[string]interface{} `json:"char_filter,omitempty"`
Normalizer map[string]interface{} `json:"normalizer,omitempty"`
}
AnalysisSettings represents custom analyzers, tokenizers, and filters
type Bool ¶
type Bool struct {
Must []Query `json:"must,omitempty"`
Filter []Query `json:"filter,omitempty"`
Should []Query `json:"should,omitempty"`
MustNot []Query `json:"must_not,omitempty"`
MinimumShouldMatch interface{} `json:"minimum_should_match,omitempty"`
}
Bool represents a boolean query with must, should, filter, and must_not clauses.
type BoolBuilder ¶
type BoolBuilder struct {
// contains filtered or unexported fields
}
BoolBuilder builds bool queries with field resolution at all nesting levels
func NewBoolBuilder ¶
func NewBoolBuilder(ctx context.Context, indices []string, processName string) *BoolBuilder
NewBoolBuilder creates a bool builder with field resolution using default mapper
func NewBoolBuilderWithMapper ¶
func NewBoolBuilderWithMapper(ctx context.Context, indices []string, mapper *FieldMapper, processName string) *BoolBuilder
NewBoolBuilderWithMapper creates a bool builder with custom mapper
func (*BoolBuilder) BuildWithErrors ¶
func (b *BoolBuilder) BuildWithErrors() (Query, []error)
BuildWithErrors returns the Query and any errors encountered
func (*BoolBuilder) Errors ¶
func (b *BoolBuilder) Errors() []error
Errors returns all errors encountered during building
func (*BoolBuilder) FilterBool ¶
func (b *BoolBuilder) FilterBool(nested *BoolBuilder) *BoolBuilder
FilterBool adds a nested bool query to filter clause
func (*BoolBuilder) FilterCIDR ¶
func (b *BoolBuilder) FilterCIDR(field string, cidr string) *BoolBuilder
FilterCIDR adds a CIDR query to filter clause for "ip" type fields
func (*BoolBuilder) FilterCIDRs ¶
func (b *BoolBuilder) FilterCIDRs(field string, cidrs ...string) *BoolBuilder
FilterCIDRs adds a terms query with multiple CIDRs to filter clause for "ip" type fields
func (*BoolBuilder) FilterExists ¶
func (b *BoolBuilder) FilterExists(field string) *BoolBuilder
FilterExists adds an exists query to filter clause
func (*BoolBuilder) FilterFuzzy ¶
func (b *BoolBuilder) FilterFuzzy(field string, value string, fuzziness ...string) *BoolBuilder
FilterFuzzy adds a fuzzy query to filter clause
func (*BoolBuilder) FilterIDs ¶
func (b *BoolBuilder) FilterIDs(ids ...interface{}) *BoolBuilder
FilterIDs adds an IDs query to filter clause
func (*BoolBuilder) FilterIPRangeContains ¶
func (b *BoolBuilder) FilterIPRangeContains(field string, ip string) *BoolBuilder
FilterIPRangeContains adds a query to filter clause that matches ip_range fields containing the given IP
func (*BoolBuilder) FilterIPRangeIntersects ¶
func (b *BoolBuilder) FilterIPRangeIntersects(field string, fromIP, toIP string) *BoolBuilder
FilterIPRangeIntersects adds a query to filter clause that matches ip_range fields overlapping with the given range
func (*BoolBuilder) FilterIPRangeWithin ¶
func (b *BoolBuilder) FilterIPRangeWithin(field string, fromIP, toIP string) *BoolBuilder
FilterIPRangeWithin adds a query to filter clause that matches ip_range fields entirely within the given range
func (*BoolBuilder) FilterKNN ¶
func (b *BoolBuilder) FilterKNN(field string, vector []float32, k int) *BoolBuilder
FilterKNN adds a basic k-NN query to filter clause
func (*BoolBuilder) FilterKNNWithFilter ¶
func (b *BoolBuilder) FilterKNNWithFilter(field string, vector []float32, k int, filter Query) *BoolBuilder
FilterKNNWithFilter adds a k-NN query with filter to filter clause
func (*BoolBuilder) FilterKNNWithMaxDistance ¶
func (b *BoolBuilder) FilterKNNWithMaxDistance(field string, vector []float32, k int, maxDistance float64) *BoolBuilder
FilterKNNWithMaxDistance adds a k-NN query with max distance threshold to filter clause
func (*BoolBuilder) FilterKNNWithMinScore ¶
func (b *BoolBuilder) FilterKNNWithMinScore(field string, vector []float32, k int, minScore float64) *BoolBuilder
FilterKNNWithMinScore adds a k-NN query with min score threshold to filter clause
func (*BoolBuilder) FilterKNNWithOptions ¶
func (b *BoolBuilder) FilterKNNWithOptions(field string, vector []float32, k int, opts KNNQueryOptions) *BoolBuilder
FilterKNNWithOptions adds a k-NN query with full options to filter clause
func (*BoolBuilder) FilterMatch ¶
func (b *BoolBuilder) FilterMatch(field string, value string) *BoolBuilder
FilterMatch adds a match query to filter clause
func (*BoolBuilder) FilterMatchPhrase ¶
func (b *BoolBuilder) FilterMatchPhrase(field string, value string) *BoolBuilder
FilterMatchPhrase adds a match_phrase query to filter clause
func (*BoolBuilder) FilterMatchPhrasePrefix ¶
func (b *BoolBuilder) FilterMatchPhrasePrefix(field string, value string) *BoolBuilder
FilterMatchPhrasePrefix adds a match_phrase_prefix query to filter clause
func (*BoolBuilder) FilterMultiMatch ¶
func (b *BoolBuilder) FilterMultiMatch(query string, fields []string, matchType ...string) *BoolBuilder
FilterMultiMatch adds a multi_match query to filter clause
func (*BoolBuilder) FilterPrefix ¶
func (b *BoolBuilder) FilterPrefix(field string, prefix string) *BoolBuilder
FilterPrefix adds a prefix query to filter clause
func (*BoolBuilder) FilterQuery ¶
func (b *BoolBuilder) FilterQuery(queries ...Query) *BoolBuilder
FilterQuery adds raw Query objects to filter clause
func (*BoolBuilder) FilterQueryString ¶
func (b *BoolBuilder) FilterQueryString(query string, defaultOperator ...string) *BoolBuilder
FilterQueryString adds a query_string query to filter clause
func (*BoolBuilder) FilterRange ¶
func (b *BoolBuilder) FilterRange(field string, op string, value interface{}) *BoolBuilder
FilterRange adds a range query to filter clause
func (*BoolBuilder) FilterRegexp ¶
func (b *BoolBuilder) FilterRegexp(field string, pattern string) *BoolBuilder
FilterRegexp adds a regexp query to filter clause
func (*BoolBuilder) FilterTerm ¶
func (b *BoolBuilder) FilterTerm(field string, value interface{}) *BoolBuilder
FilterTerm adds a term query to filter clause
func (*BoolBuilder) FilterTerms ¶
func (b *BoolBuilder) FilterTerms(field string, values ...interface{}) *BoolBuilder
FilterTerms adds a terms query to filter clause
func (*BoolBuilder) FilterWildcard ¶
func (b *BoolBuilder) FilterWildcard(field string, pattern string) *BoolBuilder
FilterWildcard adds a wildcard query to filter clause
func (*BoolBuilder) HasErrors ¶
func (b *BoolBuilder) HasErrors() bool
HasErrors returns true if errors were encountered during building
func (*BoolBuilder) MinimumShouldMatch ¶
func (b *BoolBuilder) MinimumShouldMatch(value interface{}) *BoolBuilder
MinimumShouldMatch sets the minimum number of should clauses that must match
func (*BoolBuilder) MustBool ¶
func (b *BoolBuilder) MustBool(nested *BoolBuilder) *BoolBuilder
MustBool adds a nested bool query to must clause
func (*BoolBuilder) MustCIDR ¶
func (b *BoolBuilder) MustCIDR(field string, cidr string) *BoolBuilder
MustCIDR adds a CIDR query to must clause for "ip" type fields Example: MustCIDR("client_ip", "192.168.0.0/16")
func (*BoolBuilder) MustCIDRs ¶
func (b *BoolBuilder) MustCIDRs(field string, cidrs ...string) *BoolBuilder
MustCIDRs adds a terms query with multiple CIDRs to must clause for "ip" type fields Example: MustCIDRs("client_ip", "192.168.0.0/24", "10.0.0.0/8")
func (*BoolBuilder) MustExists ¶
func (b *BoolBuilder) MustExists(field string) *BoolBuilder
MustExists adds an exists query to must clause
func (*BoolBuilder) MustFuzzy ¶
func (b *BoolBuilder) MustFuzzy(field string, value string, fuzziness ...string) *BoolBuilder
MustFuzzy adds a fuzzy query to must clause
func (*BoolBuilder) MustIPRangeContains ¶
func (b *BoolBuilder) MustIPRangeContains(field string, ip string) *BoolBuilder
MustIPRangeContains adds a query to must clause that matches ip_range fields containing the given IP Example: MustIPRangeContains("allowed_ips", "192.168.1.50") matches ranges like 192.168.0.0/16
func (*BoolBuilder) MustIPRangeIntersects ¶
func (b *BoolBuilder) MustIPRangeIntersects(field string, fromIP, toIP string) *BoolBuilder
MustIPRangeIntersects adds a query to must clause that matches ip_range fields overlapping with the given range Example: MustIPRangeIntersects("blocked_ranges", "192.168.0.0", "192.168.255.255")
func (*BoolBuilder) MustIPRangeWithin ¶
func (b *BoolBuilder) MustIPRangeWithin(field string, fromIP, toIP string) *BoolBuilder
MustIPRangeWithin adds a query to must clause that matches ip_range fields entirely within the given range Example: MustIPRangeWithin("subnet", "10.0.0.0", "10.255.255.255") matches 10.0.0.0/24, 10.1.0.0/16, etc.
func (*BoolBuilder) MustKNN ¶
func (b *BoolBuilder) MustKNN(field string, vector []float32, k int) *BoolBuilder
MustKNN adds a basic k-NN query to must clause field: the knn_vector field name vector: the query vector (must match the field's dimension) k: number of nearest neighbors to return
func (*BoolBuilder) MustKNNWithFilter ¶
func (b *BoolBuilder) MustKNNWithFilter(field string, vector []float32, k int, filter Query) *BoolBuilder
MustKNNWithFilter adds a k-NN query with filter to must clause
func (*BoolBuilder) MustKNNWithMaxDistance ¶
func (b *BoolBuilder) MustKNNWithMaxDistance(field string, vector []float32, k int, maxDistance float64) *BoolBuilder
MustKNNWithMaxDistance adds a k-NN query with max distance threshold to must clause
func (*BoolBuilder) MustKNNWithMinScore ¶
func (b *BoolBuilder) MustKNNWithMinScore(field string, vector []float32, k int, minScore float64) *BoolBuilder
MustKNNWithMinScore adds a k-NN query with min score threshold to must clause
func (*BoolBuilder) MustKNNWithOptions ¶
func (b *BoolBuilder) MustKNNWithOptions(field string, vector []float32, k int, opts KNNQueryOptions) *BoolBuilder
MustKNNWithOptions adds a k-NN query with full options to must clause
func (*BoolBuilder) MustMatch ¶
func (b *BoolBuilder) MustMatch(field string, value string) *BoolBuilder
MustMatch adds a match query to must clause
func (*BoolBuilder) MustMatchPhrase ¶
func (b *BoolBuilder) MustMatchPhrase(field string, value string) *BoolBuilder
MustMatchPhrase adds a match_phrase query to must clause
func (*BoolBuilder) MustMatchPhrasePrefix ¶
func (b *BoolBuilder) MustMatchPhrasePrefix(field string, value string) *BoolBuilder
MustMatchPhrasePrefix adds a match_phrase_prefix query to must clause
func (*BoolBuilder) MustMultiMatch ¶
func (b *BoolBuilder) MustMultiMatch(query string, fields []string, matchType ...string) *BoolBuilder
MustMultiMatch adds a multi_match query to must clause
func (*BoolBuilder) MustNotBool ¶
func (b *BoolBuilder) MustNotBool(nested *BoolBuilder) *BoolBuilder
MustNotBool adds a nested bool query to must_not clause
func (*BoolBuilder) MustNotCIDR ¶
func (b *BoolBuilder) MustNotCIDR(field string, cidr string) *BoolBuilder
MustNotCIDR adds a CIDR query to must_not clause for "ip" type fields
func (*BoolBuilder) MustNotCIDRs ¶
func (b *BoolBuilder) MustNotCIDRs(field string, cidrs ...string) *BoolBuilder
MustNotCIDRs adds a terms query with multiple CIDRs to must_not clause for "ip" type fields
func (*BoolBuilder) MustNotExists ¶
func (b *BoolBuilder) MustNotExists(field string) *BoolBuilder
MustNotExists adds an exists query to must_not clause
func (*BoolBuilder) MustNotFuzzy ¶
func (b *BoolBuilder) MustNotFuzzy(field string, value string, fuzziness ...string) *BoolBuilder
MustNotFuzzy adds a fuzzy query to must_not clause
func (*BoolBuilder) MustNotIDs ¶
func (b *BoolBuilder) MustNotIDs(ids ...interface{}) *BoolBuilder
MustNotIDs adds an IDs query to must_not clause
func (*BoolBuilder) MustNotIPRangeContains ¶
func (b *BoolBuilder) MustNotIPRangeContains(field string, ip string) *BoolBuilder
MustNotIPRangeContains adds a query to must_not clause that matches ip_range fields containing the given IP
func (*BoolBuilder) MustNotIPRangeIntersects ¶
func (b *BoolBuilder) MustNotIPRangeIntersects(field string, fromIP, toIP string) *BoolBuilder
MustNotIPRangeIntersects adds a query to must_not clause that matches ip_range fields overlapping with the given range
func (*BoolBuilder) MustNotIPRangeWithin ¶
func (b *BoolBuilder) MustNotIPRangeWithin(field string, fromIP, toIP string) *BoolBuilder
MustNotIPRangeWithin adds a query to must_not clause that matches ip_range fields entirely within the given range
func (*BoolBuilder) MustNotKNN ¶
func (b *BoolBuilder) MustNotKNN(field string, vector []float32, k int) *BoolBuilder
MustNotKNN adds a basic k-NN query to must_not clause
func (*BoolBuilder) MustNotMatch ¶
func (b *BoolBuilder) MustNotMatch(field string, value string) *BoolBuilder
MustNotMatch adds a match query to must_not clause
func (*BoolBuilder) MustNotMatchPhrase ¶
func (b *BoolBuilder) MustNotMatchPhrase(field string, value string) *BoolBuilder
MustNotMatchPhrase adds a match_phrase query to must_not clause
func (*BoolBuilder) MustNotMatchPhrasePrefix ¶
func (b *BoolBuilder) MustNotMatchPhrasePrefix(field string, value string) *BoolBuilder
MustNotMatchPhrasePrefix adds a match_phrase_prefix query to must_not clause
func (*BoolBuilder) MustNotMultiMatch ¶
func (b *BoolBuilder) MustNotMultiMatch(query string, fields []string, matchType ...string) *BoolBuilder
MustNotMultiMatch adds a multi_match query to must_not clause
func (*BoolBuilder) MustNotPrefix ¶
func (b *BoolBuilder) MustNotPrefix(field string, prefix string) *BoolBuilder
MustNotPrefix adds a prefix query to must_not clause
func (*BoolBuilder) MustNotQuery ¶
func (b *BoolBuilder) MustNotQuery(queries ...Query) *BoolBuilder
MustNotQuery adds raw Query objects to must_not clause
func (*BoolBuilder) MustNotQueryString ¶
func (b *BoolBuilder) MustNotQueryString(query string, defaultOperator ...string) *BoolBuilder
MustNotQueryString adds a query_string query to must_not clause
func (*BoolBuilder) MustNotRange ¶
func (b *BoolBuilder) MustNotRange(field string, op string, value interface{}) *BoolBuilder
MustNotRange adds a range query to must_not clause
func (*BoolBuilder) MustNotRegexp ¶
func (b *BoolBuilder) MustNotRegexp(field string, pattern string) *BoolBuilder
MustNotRegexp adds a regexp query to must_not clause
func (*BoolBuilder) MustNotTerm ¶
func (b *BoolBuilder) MustNotTerm(field string, value interface{}) *BoolBuilder
MustNotTerm adds a term query to must_not clause
func (*BoolBuilder) MustNotTerms ¶
func (b *BoolBuilder) MustNotTerms(field string, values ...interface{}) *BoolBuilder
MustNotTerms adds a terms query to must_not clause
func (*BoolBuilder) MustNotWildcard ¶
func (b *BoolBuilder) MustNotWildcard(field string, pattern string) *BoolBuilder
MustNotWildcard adds a wildcard query to must_not clause
func (*BoolBuilder) MustPrefix ¶
func (b *BoolBuilder) MustPrefix(field string, prefix string) *BoolBuilder
MustPrefix adds a prefix query to must clause
func (*BoolBuilder) MustQuery ¶
func (b *BoolBuilder) MustQuery(queries ...Query) *BoolBuilder
MustQuery adds raw Query objects to must clause
func (*BoolBuilder) MustQueryString ¶
func (b *BoolBuilder) MustQueryString(query string, defaultOperator ...string) *BoolBuilder
MustQueryString adds a query_string query to must clause
func (*BoolBuilder) MustRange ¶
func (b *BoolBuilder) MustRange(field string, op string, value interface{}) *BoolBuilder
MustRange adds a range query to must clause
func (*BoolBuilder) MustRegexp ¶
func (b *BoolBuilder) MustRegexp(field string, pattern string) *BoolBuilder
MustRegexp adds a regexp query to must clause
func (*BoolBuilder) MustTerm ¶
func (b *BoolBuilder) MustTerm(field string, value interface{}) *BoolBuilder
MustTerm adds a term query to must clause
func (*BoolBuilder) MustTerms ¶
func (b *BoolBuilder) MustTerms(field string, values ...interface{}) *BoolBuilder
MustTerms adds a terms query to must clause
func (*BoolBuilder) MustWildcard ¶
func (b *BoolBuilder) MustWildcard(field string, pattern string) *BoolBuilder
MustWildcard adds a wildcard query to must clause
func (*BoolBuilder) ShouldBool ¶
func (b *BoolBuilder) ShouldBool(nested *BoolBuilder) *BoolBuilder
ShouldBool adds a nested bool query to should clause
func (*BoolBuilder) ShouldCIDR ¶
func (b *BoolBuilder) ShouldCIDR(field string, cidr string) *BoolBuilder
ShouldCIDR adds a CIDR query to should clause for "ip" type fields
func (*BoolBuilder) ShouldCIDRs ¶
func (b *BoolBuilder) ShouldCIDRs(field string, cidrs ...string) *BoolBuilder
ShouldCIDRs adds a terms query with multiple CIDRs to should clause for "ip" type fields
func (*BoolBuilder) ShouldExists ¶
func (b *BoolBuilder) ShouldExists(field string) *BoolBuilder
ShouldExists adds an exists query to should clause
func (*BoolBuilder) ShouldFuzzy ¶
func (b *BoolBuilder) ShouldFuzzy(field string, value string, fuzziness ...string) *BoolBuilder
ShouldFuzzy adds a fuzzy query to should clause
func (*BoolBuilder) ShouldIPRangeContains ¶
func (b *BoolBuilder) ShouldIPRangeContains(field string, ip string) *BoolBuilder
ShouldIPRangeContains adds a query to should clause that matches ip_range fields containing the given IP
func (*BoolBuilder) ShouldIPRangeIntersects ¶
func (b *BoolBuilder) ShouldIPRangeIntersects(field string, fromIP, toIP string) *BoolBuilder
ShouldIPRangeIntersects adds a query to should clause that matches ip_range fields overlapping with the given range
func (*BoolBuilder) ShouldIPRangeWithin ¶
func (b *BoolBuilder) ShouldIPRangeWithin(field string, fromIP, toIP string) *BoolBuilder
ShouldIPRangeWithin adds a query to should clause that matches ip_range fields entirely within the given range
func (*BoolBuilder) ShouldKNN ¶
func (b *BoolBuilder) ShouldKNN(field string, vector []float32, k int) *BoolBuilder
ShouldKNN adds a basic k-NN query to should clause
func (*BoolBuilder) ShouldKNNWithFilter ¶
func (b *BoolBuilder) ShouldKNNWithFilter(field string, vector []float32, k int, filter Query) *BoolBuilder
ShouldKNNWithFilter adds a k-NN query with filter to should clause
func (*BoolBuilder) ShouldKNNWithMaxDistance ¶
func (b *BoolBuilder) ShouldKNNWithMaxDistance(field string, vector []float32, k int, maxDistance float64) *BoolBuilder
ShouldKNNWithMaxDistance adds a k-NN query with max distance threshold to should clause
func (*BoolBuilder) ShouldKNNWithMinScore ¶
func (b *BoolBuilder) ShouldKNNWithMinScore(field string, vector []float32, k int, minScore float64) *BoolBuilder
ShouldKNNWithMinScore adds a k-NN query with min score threshold to should clause
func (*BoolBuilder) ShouldKNNWithOptions ¶
func (b *BoolBuilder) ShouldKNNWithOptions(field string, vector []float32, k int, opts KNNQueryOptions) *BoolBuilder
ShouldKNNWithOptions adds a k-NN query with full options to should clause
func (*BoolBuilder) ShouldMatch ¶
func (b *BoolBuilder) ShouldMatch(field string, value string) *BoolBuilder
ShouldMatch adds a match query to should clause
func (*BoolBuilder) ShouldMatchPhrase ¶
func (b *BoolBuilder) ShouldMatchPhrase(field string, value string) *BoolBuilder
ShouldMatchPhrase adds a match_phrase query to should clause
func (*BoolBuilder) ShouldMatchPhrasePrefix ¶
func (b *BoolBuilder) ShouldMatchPhrasePrefix(field string, value string) *BoolBuilder
ShouldMatchPhrasePrefix adds a match_phrase_prefix query to should clause
func (*BoolBuilder) ShouldMultiMatch ¶
func (b *BoolBuilder) ShouldMultiMatch(query string, fields []string, matchType ...string) *BoolBuilder
ShouldMultiMatch adds a multi_match query to should clause
func (*BoolBuilder) ShouldPrefix ¶
func (b *BoolBuilder) ShouldPrefix(field string, prefix string) *BoolBuilder
ShouldPrefix adds a prefix query to should clause
func (*BoolBuilder) ShouldQuery ¶
func (b *BoolBuilder) ShouldQuery(queries ...Query) *BoolBuilder
ShouldQuery adds raw Query objects to should clause
func (*BoolBuilder) ShouldQueryString ¶
func (b *BoolBuilder) ShouldQueryString(query string, defaultOperator ...string) *BoolBuilder
ShouldQueryString adds a query_string query to should clause
func (*BoolBuilder) ShouldRange ¶
func (b *BoolBuilder) ShouldRange(field string, op string, value interface{}) *BoolBuilder
ShouldRange adds a range query to should clause
func (*BoolBuilder) ShouldRegexp ¶
func (b *BoolBuilder) ShouldRegexp(field string, pattern string) *BoolBuilder
ShouldRegexp adds a regexp query to should clause
func (*BoolBuilder) ShouldTerm ¶
func (b *BoolBuilder) ShouldTerm(field string, value interface{}) *BoolBuilder
ShouldTerm adds a term query to should clause
func (*BoolBuilder) ShouldTerms ¶
func (b *BoolBuilder) ShouldTerms(field string, values ...interface{}) *BoolBuilder
ShouldTerms adds a terms query to should clause
func (*BoolBuilder) ShouldWildcard ¶
func (b *BoolBuilder) ShouldWildcard(field string, pattern string) *BoolBuilder
ShouldWildcard adds a wildcard query to should clause
type BulkIndexItem ¶
BulkIndexItem represents an item for bulk indexing
type BulkItem ¶
type BulkItem struct {
// Index is the target index name.
Index string
// DocumentID is optional; if empty, OpenSearch auto-generates one.
DocumentID string
// Operation is the bulk operation type (create, index, update, delete).
Operation BulkOperation
// Document is the document data (not used for delete operations).
Document any
// Routing is optional routing value for the document.
Routing string
}
BulkItem represents a single item in the bulk queue.
type BulkItemError ¶
type BulkItemError struct {
// Index is the original item index in the batch.
Index int
// Operation is the operation that failed.
Operation string
// DocumentIndex is the target index name.
DocumentIndex string
// DocumentID is the document ID (if provided).
DocumentID string
// Status is the HTTP status code.
Status int
// ErrorType is the OpenSearch error type.
ErrorType string
// ErrorReason is the human-readable error reason.
ErrorReason string
// CauseType is the root cause error type (if available).
CauseType string
// CauseReason is the root cause error reason (if available).
CauseReason string
}
BulkItemError contains error details for a failed bulk item.
type BulkOperation ¶
type BulkOperation string
BulkOperation represents the type of bulk operation to perform.
const ( // BulkOperationCreate creates a document (fails if exists). BulkOperationCreate BulkOperation = "create" // BulkOperationIndex creates or replaces a document. BulkOperationIndex BulkOperation = "index" // BulkOperationUpdate updates an existing document. BulkOperationUpdate BulkOperation = "update" // BulkOperationDelete deletes a document. BulkOperationDelete BulkOperation = "delete" )
type BulkQueue ¶
type BulkQueue struct {
// contains filtered or unexported fields
}
BulkQueue handles bulk operations with automatic batching and flushing.
func NewBulkQueue ¶
func NewBulkQueue(processName string, config BulkQueueConfig) *BulkQueue
NewBulkQueue creates a new BulkQueue that uses the existing singleton connection. The singleton must be initialized with Connect() before calling this function. Returns nil if the connection hasn't been established.
func NewBulkQueueWithDefaults ¶
NewBulkQueueWithDefaults creates a new BulkQueue with default configuration. The singleton must be initialized with Connect() before calling this function. Returns nil if the connection hasn't been established.
func (*BulkQueue) Add ¶
Add adds a single document to the bulk queue with the "index" operation. This is the most common operation that creates or replaces a document.
func (*BulkQueue) AddBatch ¶
AddBatch adds multiple documents to the same index using the "index" operation.
func (*BulkQueue) AddBatchWithIDs ¶
AddBatchWithIDs adds multiple documents with specific IDs to the same index.
func (*BulkQueue) AddCreate ¶
AddCreate adds a document using the "create" operation (fails if document exists).
func (*BulkQueue) AddUpdate ¶
AddUpdate adds a document update operation. The doc should be the partial document or a map with "doc" or "script" fields.
func (*BulkQueue) AddWithID ¶
AddWithID adds a single document with a specific ID to the bulk queue.
func (*BulkQueue) Clear ¶
func (bq *BulkQueue) Clear()
Clear empties the queue without processing. Use with caution.
func (*BulkQueue) Config ¶
func (bq *BulkQueue) Config() BulkQueueConfig
Config returns the current configuration (read-only copy).
func (*BulkQueue) Flush ¶
Flush immediately processes all items in the queue. This is a blocking call that waits for the bulk request to complete.
type BulkQueueConfig ¶
type BulkQueueConfig struct {
// FlushInterval is how often the queue automatically flushes (default: 10s).
FlushInterval time.Duration
// FlushThreshold is the number of items that triggers an automatic flush (default: 0 = disabled).
FlushThreshold int
// MaxRetries is the number of times to retry failed bulk requests (default: 0 = no retry).
MaxRetries int
// RetryDelay is the base delay between retries with exponential backoff (default: 1s).
RetryDelay time.Duration
// OnError is an optional callback for handling bulk errors.
OnError func(failedItems []BulkItem, err error)
// OnSuccess is an optional callback when a bulk request succeeds.
OnSuccess func(successCount int, indexCounts map[string]int)
}
BulkQueueConfig holds configuration for the BulkQueue.
func DefaultBulkQueueConfig ¶
func DefaultBulkQueueConfig() BulkQueueConfig
DefaultBulkQueueConfig returns a BulkQueueConfig with sensible defaults.
type BulkResponse ¶
type BulkResponse struct {
// SuccessCount is the number of successfully processed items.
SuccessCount int
// FailedCount is the number of failed items.
FailedCount int
// IndexCounts maps index names to the number of documents indexed in each.
IndexCounts map[string]int
// Errors contains details about failed items.
Errors []BulkItemError
}
BulkResponse contains the result of a bulk operation.
type Cardinality ¶
type Collapse ¶
type Collapse struct {
Field string `json:"field,omitempty"`
}
Collapse specifies field collapsing (deduplication) settings.
type ComponentTemplateBuilder ¶
type ComponentTemplateBuilder struct {
// contains filtered or unexported fields
}
ComponentTemplateBuilder provides a fluent API for creating component templates
func NewComponentTemplateBuilder ¶
func NewComponentTemplateBuilder(ctx context.Context, name string) *ComponentTemplateBuilder
NewComponentTemplateBuilder creates a new component template builder
func (*ComponentTemplateBuilder) AddField ¶
func (b *ComponentTemplateBuilder) AddField(name string, fieldType string) *ComponentTemplateBuilder
AddField adds a field to the mapping
func (*ComponentTemplateBuilder) EnableKNN ¶
func (b *ComponentTemplateBuilder) EnableKNN() *ComponentTemplateBuilder
EnableKNN enables k-NN support
func (*ComponentTemplateBuilder) Ensure ¶
func (b *ComponentTemplateBuilder) Ensure() error
Ensure creates or updates the component template (idempotent)
func (*ComponentTemplateBuilder) Mapping ¶
func (b *ComponentTemplateBuilder) Mapping(properties map[string]interface{}) *ComponentTemplateBuilder
Mapping sets the mappings
func (*ComponentTemplateBuilder) Meta ¶
func (b *ComponentTemplateBuilder) Meta(meta map[string]interface{}) *ComponentTemplateBuilder
Meta sets template metadata
func (*ComponentTemplateBuilder) Replicas ¶
func (b *ComponentTemplateBuilder) Replicas(n int) *ComponentTemplateBuilder
Replicas sets the number of replica shards
func (*ComponentTemplateBuilder) Settings ¶
func (b *ComponentTemplateBuilder) Settings(settings map[string]interface{}) *ComponentTemplateBuilder
Settings sets the component template settings
func (*ComponentTemplateBuilder) Shards ¶
func (b *ComponentTemplateBuilder) Shards(n int) *ComponentTemplateBuilder
Shards sets the number of primary shards
func (*ComponentTemplateBuilder) Version ¶
func (b *ComponentTemplateBuilder) Version(version int64) *ComponentTemplateBuilder
Version sets the template version
type ConflictStrategy ¶
type ConflictStrategy int
ConflictStrategy determines how to handle field type conflicts across indices
const ( // MostCommon uses the most common type across indices MostCommon ConflictStrategy = iota // MostPermissive uses the most permissive type (text > keyword, long > integer) MostPermissive // Strict returns error on any conflict Strict // MostRecent uses type from the most recent index (by name sort) MostRecent )
type ExtendedStats ¶
type FieldInfo ¶
type FieldInfo struct {
BaseField string // e.g., "type", "attributes.file"
Type string // e.g., "text", "keyword", "integer"
Fields map[string]string // sub-fields: {"keyword": "keyword", "raw": "keyword"}
AllowsMatch bool // true for text fields
AllowsTerm bool // true for keyword/numeric/date/ip
SourceIndices []string // indices where field exists
HasConflict bool // true if type differs across indices
ConflictTypes map[string][]string // type -> [indices with that type]
}
FieldInfo contains information about a field's type and characteristics
type FieldMapper ¶
type FieldMapper struct {
// contains filtered or unexported fields
}
FieldMapper manages mapping cache and field resolution
func NewFieldMapper ¶
func NewFieldMapper(opts ...MapperOption) *FieldMapper
NewFieldMapper creates a new FieldMapper with the given options
func (*FieldMapper) GetMergedMapping ¶
func (f *FieldMapper) GetMergedMapping(ctx context.Context, indexPattern string) (*MergedMapping, error)
GetMergedMapping fetches and merges mappings for all indices matching the pattern
func (*FieldMapper) Invalidate ¶
func (f *FieldMapper) Invalidate(pattern string)
Invalidate removes a pattern from the cache
type FieldTypeCategory ¶
type FieldTypeCategory int
FieldTypeCategory represents a category of OpenSearch field types
const ( CategoryUnknown FieldTypeCategory = iota CategoryText // Full-text searchable types (text, match_only_text) CategoryKeyword // Exact-match string types (keyword, constant_keyword) CategoryNumeric // Numeric types (integer, long, float, etc.) CategoryDate // Date types (date, date_nanos) CategoryBoolean // Boolean type CategoryBinary // Binary data type CategoryIP // IP address type CategoryGeo // Geographic types (geo_point, geo_shape) - require geo queries CategoryCartesian // Cartesian types (xy_point, xy_shape) - require geo queries CategoryRange // Range types (integer_range, date_range, etc.) CategoryObject // Object/nested types CategoryVector // Vector types for ML/k-NN CategoryCompletion // Autocomplete types CategorySpecialized // Specialized types (percolator, rank, etc.) CategoryAlias // Alias type )
func GetFieldTypeCategory ¶
func GetFieldTypeCategory(fieldType string) FieldTypeCategory
GetFieldTypeCategory returns the category for a field type
func (FieldTypeCategory) String ¶
func (c FieldTypeCategory) String() string
String returns a human-readable string for a category
type FieldTypeInfo ¶
type FieldTypeInfo struct {
Name string // OpenSearch type name
Category FieldTypeCategory // Category this type belongs to
AllowsMatch bool // Can use match/full-text queries
AllowsTerm bool // Can use term/exact queries
AllowsRange bool // Can use range queries
AllowsSort bool // Can be used for sorting
AllowsAgg bool // Can be used for aggregations
NeedsKeyword bool // Needs .keyword for term queries (text types)
Priority int // Priority for conflict resolution
}
FieldTypeInfo contains metadata about a field type
func GetFieldTypeInfo ¶
func GetFieldTypeInfo(fieldType string) (FieldTypeInfo, bool)
GetFieldTypeInfo returns metadata about a field type
type GeoDistance ¶
type GeoDistance struct {
Origin interface{} `json:"origin,omitempty"`
Range
}
type Histogram ¶
type Histogram struct {
Field string `json:"field,omitempty"`
Interval interface{} `json:"interval,omitempty"`
}
type Hit ¶
type Hit struct {
Index string `json:"_index"`
ID string `json:"_id"`
Version int64 `json:"_version"`
Score interface{} `json:"_score"`
Source HitSource `json:"_source"`
Fields map[string]interface{} `json:"fields"`
Sort []any `json:"sort"`
Found bool `json:"found,omitempty"`
}
Hit represents a single search result document.
type HitRaw ¶
type HitRaw struct {
ID string
Index string
Score float64
Source json.RawMessage
}
HitRaw represents a raw search hit
type HitSource ¶
type HitSource map[string]interface{}
HitSource represents the _source field of a search hit as a map.
func (*HitSource) ParseSource ¶
ParseSource parses the HitSource object into a JSON string and then unmarshals it into the provided destination object. The destination object must be a pointer to the desired type.
func (*HitSource) ParseSourceToProtoMessage ¶ added in v1.1.0
func (h *HitSource) ParseSourceToProtoMessage(dest protoreflect.ProtoMessage) error
ParseSourceToProtoMessage serializes the HitSource to JSON and unmarshals it into the provided ProtoMessage.
func (*HitSource) SetSourceFromProtoMessage ¶ added in v1.1.0
func (h *HitSource) SetSourceFromProtoMessage(src protoreflect.ProtoMessage) error
SetSourceFromProtoMessage sets the HitSource object by deserializing a ProtoMessage into its map representation.
type Hits ¶
type Hits struct {
Total Total `json:"total"`
MaxScore interface{} `json:"max_score"`
Hits []Hit `json:"hits"`
}
Hits contain the search hits and metadata.
type ISMAction ¶
type ISMAction struct {
Retry *ISMRetry `json:"retry,omitempty"`
Timeout string `json:"timeout,omitempty"`
Rollover *ISMRolloverAction `json:"rollover,omitempty"`
Delete *ISMDeleteAction `json:"delete,omitempty"`
ForceMerge *ISMForceMergeAction `json:"force_merge,omitempty"`
ReadOnly *ISMReadOnlyAction `json:"read_only,omitempty"`
ReplicaCount *ISMReplicaCountAction `json:"replica_count,omitempty"`
IndexPriority *ISMIndexPriorityAction `json:"index_priority,omitempty"`
Shrink *ISMShrinkAction `json:"shrink,omitempty"`
Snapshot *ISMSnapshotAction `json:"snapshot,omitempty"`
Close *ISMCloseAction `json:"close,omitempty"`
Open *ISMOpenAction `json:"open,omitempty"`
Notification *ISMNotificationAction `json:"notification,omitempty"`
Allocation *ISMAllocationAction `json:"allocation,omitempty"`
Custom map[string]interface{} `json:"custom,omitempty"`
}
ISMAction represents an action in an ISM state
type ISMAllocationAction ¶
type ISMAllocationAction struct {
Require map[string]string `json:"require,omitempty"`
Include map[string]string `json:"include,omitempty"`
Exclude map[string]string `json:"exclude,omitempty"`
WaitFor string `json:"wait_for,omitempty"`
}
ISMAllocationAction configures allocation action
type ISMConditions ¶
type ISMConditions struct {
MinAge string `json:"min_index_age,omitempty"`
MinDocs int64 `json:"min_doc_count,omitempty"`
MinSize string `json:"min_size,omitempty"`
Cron *ISMCronCondition `json:"cron,omitempty"`
}
ISMConditions represents conditions for a transition
type ISMCronCondition ¶
type ISMCronCondition struct {
Expression string `json:"expression"`
Timezone string `json:"timezone"`
}
ISMCronCondition represents a cron-based condition
type ISMExplainResult ¶
type ISMExplainResult struct {
Index string `json:"index"`
IndexUUID string `json:"index_uuid"`
PolicyID string `json:"policy_id"`
PolicySeqNo int64 `json:"policy_seq_no"`
PolicyPrimaryTerm int64 `json:"policy_primary_term"`
RolledOver bool `json:"rolled_over"`
State map[string]interface{} `json:"state"`
Info map[string]interface{} `json:"info"`
}
ISMExplainResult represents the result of an ISM explain request
func ExplainISM ¶
func ExplainISM(ctx context.Context, index string) (*ISMExplainResult, error)
ExplainISM returns the ISM status for an index
type ISMForceMergeAction ¶
type ISMForceMergeAction struct {
MaxNumSegments int `json:"max_num_segments"`
}
ISMForceMergeAction configures force merge action
type ISMIndexPriorityAction ¶
type ISMIndexPriorityAction struct {
Priority int `json:"priority"`
}
ISMIndexPriorityAction configures index priority action
type ISMNotificationAction ¶
type ISMNotificationAction struct {
Destination string `json:"destination"`
MessageTemplate map[string]interface{} `json:"message_template,omitempty"`
}
ISMNotificationAction configures notification action
type ISMPolicy ¶
type ISMPolicy struct {
PolicyID string `json:"policy_id,omitempty"`
Description string `json:"description,omitempty"`
DefaultState string `json:"default_state,omitempty"`
States []ISMState `json:"states"`
ISMTemplate []ISMTemplate `json:"ism_template,omitempty"`
}
ISMPolicy represents an OpenSearch Index State Management policy
func GetISMPolicy ¶
GetISMPolicy retrieves an ISM policy by name
type ISMPolicyBuilder ¶
type ISMPolicyBuilder struct {
// contains filtered or unexported fields
}
ISMPolicyBuilder provides a fluent API for creating ISM policies
func NewISMPolicyBuilder ¶
func NewISMPolicyBuilder(ctx context.Context, name string) *ISMPolicyBuilder
NewISMPolicyBuilder creates a new ISM policy builder
func (*ISMPolicyBuilder) AddState ¶
func (b *ISMPolicyBuilder) AddState(name string) *ISMStateBuilder
AddState adds a state to the policy and returns a state builder
func (*ISMPolicyBuilder) Build ¶
func (b *ISMPolicyBuilder) Build() (ISMPolicy, error)
Build returns the ISM policy
func (*ISMPolicyBuilder) BuildWithErrors ¶
func (b *ISMPolicyBuilder) BuildWithErrors() (ISMPolicy, []error)
BuildWithErrors returns the policy and any accumulated errors
func (*ISMPolicyBuilder) DefaultState ¶
func (b *ISMPolicyBuilder) DefaultState(state string) *ISMPolicyBuilder
DefaultState sets the default state
func (*ISMPolicyBuilder) Description ¶
func (b *ISMPolicyBuilder) Description(desc string) *ISMPolicyBuilder
Description sets the policy description
func (*ISMPolicyBuilder) Ensure ¶
func (b *ISMPolicyBuilder) Ensure() error
Ensure creates or updates the ISM policy (idempotent)
func (*ISMPolicyBuilder) ISMTemplate ¶
func (b *ISMPolicyBuilder) ISMTemplate(patterns []string, priority int) *ISMPolicyBuilder
ISMTemplate adds an ISM template for auto-attaching the policy
type ISMReadOnlyAction ¶
type ISMReadOnlyAction struct{}
ISMReadOnlyAction configures read only action
type ISMReplicaCountAction ¶
type ISMReplicaCountAction struct {
NumberOfReplicas int `json:"number_of_replicas"`
}
ISMReplicaCountAction configures replica count action
type ISMRetry ¶
type ISMRetry struct {
Count int `json:"count"`
Backoff string `json:"backoff,omitempty"` // "exponential", "constant", "linear"
Delay string `json:"delay,omitempty"`
}
ISMRetry configures retry behavior for an action
type ISMRolloverAction ¶
type ISMRolloverAction struct {
MinSize string `json:"min_size,omitempty"`
MinDocs int64 `json:"min_doc_count,omitempty"`
MinAge string `json:"min_index_age,omitempty"`
MinPrimaryShardSize string `json:"min_primary_shard_size,omitempty"`
}
ISMRolloverAction configures rollover action
type ISMShrinkAction ¶
type ISMShrinkAction struct {
NumNewShards int `json:"num_new_shards,omitempty"`
PercentageOfSourceShards float64 `json:"percentage_of_source_shards,omitempty"`
TargetIndexNameTemplate string `json:"target_index_name_template,omitempty"`
}
ISMShrinkAction configures shrink action
type ISMSnapshotAction ¶
type ISMSnapshotAction struct {
Repository string `json:"repository"`
Snapshot string `json:"snapshot"`
}
ISMSnapshotAction configures snapshot action
type ISMState ¶
type ISMState struct {
Name string `json:"name"`
Actions []ISMAction `json:"actions,omitempty"`
Transitions []ISMTransition `json:"transitions,omitempty"`
}
ISMState represents a state in an ISM policy
type ISMStateBuilder ¶
type ISMStateBuilder struct {
// contains filtered or unexported fields
}
ISMStateBuilder provides a fluent API for building ISM states
func (*ISMStateBuilder) AllocationAction ¶
func (s *ISMStateBuilder) AllocationAction(require, include, exclude map[string]string) *ISMStateBuilder
AllocationAction adds an allocation action to the state
func (*ISMStateBuilder) CloseAction ¶
func (s *ISMStateBuilder) CloseAction() *ISMStateBuilder
CloseAction adds a close action to the state
func (*ISMStateBuilder) CustomAction ¶
func (s *ISMStateBuilder) CustomAction(action map[string]interface{}) *ISMStateBuilder
CustomAction adds a custom action to the state
func (*ISMStateBuilder) DeleteAction ¶
func (s *ISMStateBuilder) DeleteAction() *ISMStateBuilder
DeleteAction adds a delete action to the state
func (*ISMStateBuilder) Done ¶
func (s *ISMStateBuilder) Done() *ISMPolicyBuilder
Done finalizes the state and returns to the parent builder
func (*ISMStateBuilder) ForceMergeAction ¶
func (s *ISMStateBuilder) ForceMergeAction(maxSegments int) *ISMStateBuilder
ForceMergeAction adds a force merge action to the state
func (*ISMStateBuilder) IndexPriorityAction ¶
func (s *ISMStateBuilder) IndexPriorityAction(priority int) *ISMStateBuilder
IndexPriorityAction adds an index priority action to the state
func (*ISMStateBuilder) OpenAction ¶
func (s *ISMStateBuilder) OpenAction() *ISMStateBuilder
OpenAction adds an open action to the state
func (*ISMStateBuilder) ReadOnlyAction ¶
func (s *ISMStateBuilder) ReadOnlyAction() *ISMStateBuilder
ReadOnlyAction adds a read only action to the state
func (*ISMStateBuilder) ReplicaCountAction ¶
func (s *ISMStateBuilder) ReplicaCountAction(replicas int) *ISMStateBuilder
ReplicaCountAction adds a replica count action to the state
func (*ISMStateBuilder) RolloverAction ¶
func (s *ISMStateBuilder) RolloverAction(conditions RolloverConditions) *ISMStateBuilder
RolloverAction adds a rollover action to the state
func (*ISMStateBuilder) ShrinkAction ¶
func (s *ISMStateBuilder) ShrinkAction(numShards int) *ISMStateBuilder
ShrinkAction adds a shrink action to the state
func (*ISMStateBuilder) SnapshotAction ¶
func (s *ISMStateBuilder) SnapshotAction(repository, snapshot string) *ISMStateBuilder
SnapshotAction adds a snapshot action to the state
func (*ISMStateBuilder) TransitionTo ¶
func (s *ISMStateBuilder) TransitionTo(stateName string) *ISMTransitionBuilder
TransitionTo adds a transition to another state
type ISMTemplate ¶
type ISMTemplate struct {
IndexPatterns []string `json:"index_patterns"`
Priority int `json:"priority,omitempty"`
}
ISMTemplate represents a template for automatically applying ISM policies
type ISMTransition ¶
type ISMTransition struct {
StateName string `json:"state_name"`
Conditions *ISMConditions `json:"conditions,omitempty"`
}
ISMTransition represents a transition to another state
type ISMTransitionBuilder ¶
type ISMTransitionBuilder struct {
// contains filtered or unexported fields
}
ISMTransitionBuilder provides a fluent API for building ISM transitions
func (*ISMTransitionBuilder) AfterMinAge ¶
func (t *ISMTransitionBuilder) AfterMinAge(age string) *ISMTransitionBuilder
AfterMinAge sets the minimum age condition for the transition
func (*ISMTransitionBuilder) AfterMinDocs ¶
func (t *ISMTransitionBuilder) AfterMinDocs(docs int64) *ISMTransitionBuilder
AfterMinDocs sets the minimum document count condition for the transition
func (*ISMTransitionBuilder) AfterMinSize ¶
func (t *ISMTransitionBuilder) AfterMinSize(size string) *ISMTransitionBuilder
AfterMinSize sets the minimum size condition for the transition
func (*ISMTransitionBuilder) Done ¶
func (t *ISMTransitionBuilder) Done() *ISMStateBuilder
Done finalizes the transition and returns to the state builder
func (*ISMTransitionBuilder) OnCron ¶
func (t *ISMTransitionBuilder) OnCron(expr, timezone string) *ISMTransitionBuilder
OnCron sets a cron-based condition for the transition
type IndexBuilder ¶
type IndexBuilder struct {
// contains filtered or unexported fields
}
IndexBuilder provides a fluent API for creating indices
func NewIndexBuilder ¶
func NewIndexBuilder(ctx context.Context, name string, processName string) *IndexBuilder
NewIndexBuilder creates a new IndexBuilder
func (*IndexBuilder) AddBooleanField ¶
func (b *IndexBuilder) AddBooleanField(name string) *IndexBuilder
AddBooleanField adds a boolean field
func (*IndexBuilder) AddDateField ¶
func (b *IndexBuilder) AddDateField(name string, format string) *IndexBuilder
AddDateField adds a date field with optional format
func (*IndexBuilder) AddDoubleField ¶
func (b *IndexBuilder) AddDoubleField(name string) *IndexBuilder
AddDoubleField adds a double field
func (*IndexBuilder) AddField ¶
func (b *IndexBuilder) AddField(name string, fieldType string) *IndexBuilder
AddField adds a field with a specific type
func (*IndexBuilder) AddFlatObjectField ¶
func (b *IndexBuilder) AddFlatObjectField(name string) *IndexBuilder
AddFlatObjectField adds a flat_object field (for dynamic JSON)
func (*IndexBuilder) AddFloatField ¶
func (b *IndexBuilder) AddFloatField(name string) *IndexBuilder
AddFloatField adds a float field
func (*IndexBuilder) AddGeoPointField ¶
func (b *IndexBuilder) AddGeoPointField(name string) *IndexBuilder
AddGeoPointField adds a geo_point field
func (*IndexBuilder) AddIPField ¶
func (b *IndexBuilder) AddIPField(name string) *IndexBuilder
AddIPField adds an IP address field
func (*IndexBuilder) AddIntegerField ¶
func (b *IndexBuilder) AddIntegerField(name string) *IndexBuilder
AddIntegerField adds an integer field
func (*IndexBuilder) AddKNNVectorField ¶
func (b *IndexBuilder) AddKNNVectorField(name string, dimension int, method *KNNMethod) *IndexBuilder
AddKNNVectorField adds a k-NN vector field
func (*IndexBuilder) AddKeywordField ¶
func (b *IndexBuilder) AddKeywordField(name string) *IndexBuilder
AddKeywordField adds a keyword field
func (*IndexBuilder) AddLongField ¶
func (b *IndexBuilder) AddLongField(name string) *IndexBuilder
AddLongField adds a long field
func (*IndexBuilder) AddNestedField ¶
func (b *IndexBuilder) AddNestedField(name string, properties map[string]interface{}) *IndexBuilder
AddNestedField adds a nested field with properties
func (*IndexBuilder) AddObjectField ¶
func (b *IndexBuilder) AddObjectField(name string, properties map[string]interface{}) *IndexBuilder
AddObjectField adds an object field with nested properties
func (*IndexBuilder) AddProperty ¶
func (b *IndexBuilder) AddProperty(name string, property MappingProperty) *IndexBuilder
AddProperty adds a custom property definition
func (*IndexBuilder) AddTextField ¶
func (b *IndexBuilder) AddTextField(name string, analyzer string) *IndexBuilder
AddTextField adds a text field with optional analyzer
func (*IndexBuilder) Alias ¶
func (b *IndexBuilder) Alias(alias string) *IndexBuilder
Alias adds a simple alias
func (*IndexBuilder) AliasWithConfig ¶
func (b *IndexBuilder) AliasWithConfig(alias string, config AliasConfig) *IndexBuilder
AliasWithConfig adds an alias with configuration
func (*IndexBuilder) Analysis ¶
func (b *IndexBuilder) Analysis(analysis *AnalysisSettings) *IndexBuilder
Analysis sets custom analysis settings
func (*IndexBuilder) Build ¶
func (b *IndexBuilder) Build() (IndexCreateRequest, error)
Build returns the IndexCreateRequest without executing
func (*IndexBuilder) BuildWithErrors ¶
func (b *IndexBuilder) BuildWithErrors() (IndexCreateRequest, []error)
BuildWithErrors returns the IndexCreateRequest and any accumulated errors
func (*IndexBuilder) CustomSetting ¶
func (b *IndexBuilder) CustomSetting(key string, value interface{}) *IndexBuilder
CustomSetting sets a custom index setting
func (*IndexBuilder) DynamicMapping ¶
func (b *IndexBuilder) DynamicMapping(dynamic string) *IndexBuilder
DynamicMapping sets the dynamic mapping behavior
func (*IndexBuilder) EnableKNN ¶
func (b *IndexBuilder) EnableKNN() *IndexBuilder
EnableKNN enables k-NN functionality for the index
func (*IndexBuilder) Ensure ¶
func (b *IndexBuilder) Ensure() error
Ensure creates the index if it doesn't exist (idempotent)
func (*IndexBuilder) KNNAlgoParamEFSearch ¶
func (b *IndexBuilder) KNNAlgoParamEFSearch(ef int) *IndexBuilder
KNNAlgoParamEFSearch sets the ef_search parameter for k-NN
func (*IndexBuilder) Mapping ¶
func (b *IndexBuilder) Mapping(properties map[string]interface{}) *IndexBuilder
Mapping sets the entire mapping properties
func (*IndexBuilder) MaxResultWindow ¶
func (b *IndexBuilder) MaxResultWindow(size int) *IndexBuilder
MaxResultWindow sets the maximum result window size
func (*IndexBuilder) RefreshInterval ¶
func (b *IndexBuilder) RefreshInterval(interval string) *IndexBuilder
RefreshInterval sets the refresh interval
func (*IndexBuilder) Replicas ¶
func (b *IndexBuilder) Replicas(n int) *IndexBuilder
Replicas sets the number of replica shards
func (*IndexBuilder) Shards ¶
func (b *IndexBuilder) Shards(n int) *IndexBuilder
Shards sets the number of primary shards
func (*IndexBuilder) WriteAlias ¶
func (b *IndexBuilder) WriteAlias(alias string) *IndexBuilder
WriteAlias adds an alias marked as the write index
type IndexCreateRequest ¶
type IndexCreateRequest struct {
Settings map[string]interface{} `json:"settings,omitempty"`
Mappings map[string]interface{} `json:"mappings,omitempty"`
Aliases map[string]AliasConfig `json:"aliases,omitempty"`
}
IndexCreateRequest represents the request body for creating an index
type IndexInfo ¶
type IndexInfo struct {
Name string `json:"name"`
Settings map[string]interface{} `json:"settings"`
Mappings map[string]interface{} `json:"mappings"`
Aliases map[string]interface{} `json:"aliases"`
}
IndexInfo represents information about an index
type IndexSettings ¶
type IndexSettings struct {
NumberOfShards *int `json:"number_of_shards,omitempty"`
NumberOfReplicas *int `json:"number_of_replicas,omitempty"`
RefreshInterval string `json:"refresh_interval,omitempty"`
MaxResultWindow *int `json:"max_result_window,omitempty"`
KNN *bool `json:"knn,omitempty"`
KNNAlgoParamEFSearch *int `json:"knn.algo_param.ef_search,omitempty"`
Analysis *AnalysisSettings `json:"analysis,omitempty"`
Custom map[string]interface{} `json:"-"`
}
IndexSettings represents OpenSearch index settings
type IndexSettingsUpdater ¶
type IndexSettingsUpdater struct {
// contains filtered or unexported fields
}
IndexSettingsUpdater provides a fluent API for updating index settings
func NewIndexSettingsUpdater ¶
func NewIndexSettingsUpdater(ctx context.Context, index string) *IndexSettingsUpdater
NewIndexSettingsUpdater creates a new settings updater
func (*IndexSettingsUpdater) CustomSetting ¶
func (u *IndexSettingsUpdater) CustomSetting(key string, value interface{}) *IndexSettingsUpdater
CustomSetting sets a custom setting
func (*IndexSettingsUpdater) MaxResultWindow ¶
func (u *IndexSettingsUpdater) MaxResultWindow(size int) *IndexSettingsUpdater
MaxResultWindow sets the maximum result window size
func (*IndexSettingsUpdater) RefreshInterval ¶
func (u *IndexSettingsUpdater) RefreshInterval(interval string) *IndexSettingsUpdater
RefreshInterval sets the refresh interval
func (*IndexSettingsUpdater) Replicas ¶
func (u *IndexSettingsUpdater) Replicas(n int) *IndexSettingsUpdater
Replicas sets the number of replicas
func (*IndexSettingsUpdater) Update ¶
func (u *IndexSettingsUpdater) Update() error
Update applies the settings changes using the low-level client
type IndexStats ¶
type IndexStats struct {
DocsCount int64 `json:"docs_count"`
DocsDeleted int64 `json:"docs_deleted"`
StoreSizeBytes int64 `json:"store_size_bytes"`
PrimaryShards int `json:"primary_shards"`
ReplicaShards int `json:"replica_shards"`
}
IndexStats represents index statistics
func GetIndexStats ¶
func GetIndexStats(ctx context.Context, name string) (*IndexStats, error)
GetIndexStats retrieves statistics for an index
type IndexTemplate ¶
type IndexTemplate struct {
Name string `json:"-"`
IndexPatterns []string `json:"index_patterns"`
Template TemplateContent `json:"template,omitempty"`
Priority *int `json:"priority,omitempty"`
Version *int64 `json:"version,omitempty"`
Meta map[string]interface{} `json:"_meta,omitempty"`
ComposedOf []string `json:"composed_of,omitempty"`
}
IndexTemplate represents an index template definition
func GetIndexTemplate ¶
func GetIndexTemplate(ctx context.Context, name string) (*IndexTemplate, error)
GetIndexTemplate retrieves an index template by name
func ListIndexTemplates ¶
func ListIndexTemplates(ctx context.Context, pattern string) ([]IndexTemplate, error)
ListIndexTemplates lists all index templates matching a pattern
type KNNMethod ¶
type KNNMethod struct {
Name string `json:"name"` // hnsw, ivf, etc.
SpaceType string `json:"space_type"` // cosinesimil, l2, innerproduct
Engine string `json:"engine"` // nmslib, faiss, lucene
Parameters map[string]interface{} `json:"parameters,omitempty"` // ef_construction, m, etc.
}
KNNMethod configures the k-NN algorithm for vector fields
type KNNMethodParameters ¶
type KNNMethodParameters struct {
// EfSearch controls the size of the dynamic list used during HNSW search.
// Higher values improve accuracy but increase latency.
// Only applicable for HNSW engine.
EfSearch *int `json:"ef_search,omitempty"`
// Nprobe controls the number of clusters to search in IVF-based indices.
// Higher values improve accuracy but increase latency.
// Only applicable for IVF engine.
Nprobe *int `json:"nprobe,omitempty"`
}
KNNMethodParameters contains algorithm-specific parameters for k-NN search.
type KNNQuery ¶
type KNNQuery struct {
// Vector is the query vector to search for similar vectors.
// Must have the same dimension as the knn_vector field in the index.
Vector []float32 `json:"vector"`
// K is the number of nearest neighbors to return.
// In OpenSearch 3.x, exactly ONE of k, min_score, or max_distance must be set.
K int `json:"k,omitempty"`
// Filter is an optional query to pre-filter documents before the k-NN search.
// Only documents matching the filter will be considered for k-NN search.
Filter *Query `json:"filter,omitempty"`
// MinScore specifies the minimum score threshold for results.
// Only results with a score >= min_score are returned.
// Cannot be used with max_distance.
MinScore *float64 `json:"min_score,omitempty"`
// MaxDistance specifies the maximum distance threshold for results.
// Only results within max_distance from the query vector are returned.
// Cannot be used with min_score.
MaxDistance *float64 `json:"max_distance,omitempty"`
// Boost multiplies the score of all results by the boost value.
// Default is 1.0.
Boost *float64 `json:"boost,omitempty"`
// MethodParameters allows fine-tuning of the k-NN algorithm.
// For HNSW: ef_search controls the size of the dynamic list during search.
// For IVF: nprobe controls the number of clusters to search.
MethodParameters *KNNMethodParameters `json:"method_parameters,omitempty"`
// Rescore enables rescoring of the k-NN results.
// When true, results are re-ranked using exact distance calculations.
Rescore *bool `json:"rescore,omitempty"`
// RescoreContext provides additional context for rescoring.
RescoreContext *KNNRescoreContext `json:"rescore_context,omitempty"`
}
KNNQuery represents a k-NN (k-nearest neighbor) vector search query. It searches for the k most similar vectors to the provided query vector.
type KNNQueryOptions ¶
type KNNQueryOptions struct {
// Filter is an optional query to pre-filter documents before k-NN search.
Filter *Query
// MinScore specifies the minimum score threshold. Cannot be used with MaxDistance.
MinScore *float64
// MaxDistance specifies the maximum distance threshold. Cannot be used with MinScore.
MaxDistance *float64
// Boost multiplies the score of all results.
Boost *float64
// EfSearch controls the HNSW search list size (higher = more accurate, slower).
EfSearch *int
// Nprobe controls the number of IVF clusters to search.
Nprobe *int
// Rescore enables rescoring with exact distance calculations.
Rescore *bool
// OversampleFactor controls how many candidates to fetch for rescoring.
OversampleFactor *float64
}
KNNQueryOptions provides optional parameters for k-NN queries.
type KNNRescoreContext ¶
type KNNRescoreContext struct {
// OversampleFactor controls how many candidates to fetch for rescoring.
// A factor of 2.0 means fetch 2x the k value for rescoring.
OversampleFactor *float64 `json:"oversample_factor,omitempty"`
}
KNNRescoreContext provides context for k-NN rescoring.
type MLInferenceResult ¶
type MLInferenceResult struct {
Output []MLOutputData `json:"output"`
}
MLInferenceResult represents a single inference result
type MLModelConfig ¶
type MLModelConfig struct {
Name string `json:"name"`
Version string `json:"version,omitempty"`
ModelFormat string `json:"model_format,omitempty"` // TORCH_SCRIPT, ONNX
ModelGroupID string `json:"model_group_id,omitempty"`
Description string `json:"description,omitempty"`
FunctionName string `json:"function_name,omitempty"` // TEXT_EMBEDDING, etc.
// For pre-trained models from model hub
ModelContentHashValue string `json:"model_content_hash_value,omitempty"`
URL string `json:"url,omitempty"`
// ModelConfig contains model-specific configuration required for pre-trained models
// This includes embedding_dimension, model_type, framework_type, etc.
ModelConfig *MLModelInnerConfig `json:"model_config,omitempty"`
// For remote/connector-based models
ConnectorID string `json:"connector_id,omitempty"`
}
MLModelConfig contains configuration for registering an ML model
type MLModelGroup ¶
type MLModelGroup struct {
ModelGroupID string `json:"model_group_id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
LatestVersion int `json:"latest_version,omitempty"`
Access string `json:"access,omitempty"` // public, private, restricted
CreatedTime int64 `json:"created_time,omitempty"`
}
MLModelGroup represents a model group for organizing models
func GetMLModelGroup ¶
func GetMLModelGroup(ctx context.Context, groupID string) (*MLModelGroup, error)
GetMLModelGroup retrieves a model group by ID
type MLModelInfo ¶
type MLModelInfo struct {
ModelID string `json:"model_id"`
Name string `json:"name"`
ModelGroupID string `json:"model_group_id,omitempty"`
Algorithm string `json:"algorithm,omitempty"`
ModelVersion string `json:"model_version,omitempty"`
ModelFormat string `json:"model_format,omitempty"`
ModelState string `json:"model_state"` // DEPLOYED, REGISTERED, DEPLOYING, DEPLOY_FAILED, etc.
ModelContentSizeInBytes int64 `json:"model_content_size_in_bytes,omitempty"`
Description string `json:"description,omitempty"`
FunctionName string `json:"function_name,omitempty"`
CreatedTime int64 `json:"created_time,omitempty"`
LastUpdatedTime int64 `json:"last_updated_time,omitempty"`
}
MLModelInfo contains information about a registered ML model
func GetMLModel ¶
func GetMLModel(ctx context.Context, modelID string) (*MLModelInfo, error)
GetMLModel retrieves model information by ID
func GetMLModelByName ¶
func GetMLModelByName(ctx context.Context, name string) (*MLModelInfo, error)
GetMLModelByName retrieves a model by name
func SearchMLModels ¶
func SearchMLModels(ctx context.Context, query map[string]interface{}) ([]*MLModelInfo, error)
SearchMLModels searches for models by criteria
type MLModelInnerConfig ¶
type MLModelInnerConfig struct {
// ModelType is the type of model (e.g., "bert", "distilbert")
ModelType string `json:"model_type,omitempty"`
// EmbeddingDimension is the output dimension of the embedding model
EmbeddingDimension int `json:"embedding_dimension,omitempty"`
// FrameworkType is the framework used (e.g., "sentence_transformers", "huggingface_transformers")
FrameworkType string `json:"framework_type,omitempty"`
// AllConfig is a JSON string containing additional model configuration
AllConfig string `json:"all_config,omitempty"`
}
MLModelInnerConfig contains model-specific configuration for pre-trained models
type MLOutputData ¶
type MLOutputData struct {
Name string `json:"name"`
DataType string `json:"data_type"`
Shape []int `json:"shape"`
Data []float32 `json:"data"`
}
MLOutputData represents the output data from inference
type MLPredictRequest ¶
type MLPredictRequest struct {
TextDocs []string `json:"text_docs"`
}
MLPredictRequest represents a request to the ML predict API
type MLPredictResponse ¶
type MLPredictResponse struct {
InferenceResults []MLInferenceResult `json:"inference_results"`
}
MLPredictResponse represents the response from the ML predict API
type MLTaskInfo ¶
type MLTaskInfo struct {
TaskID string `json:"task_id"`
TaskType string `json:"task_type,omitempty"`
State string `json:"state"` // CREATED, RUNNING, COMPLETED, FAILED, CANCELLED
ModelID string `json:"model_id,omitempty"`
Error string `json:"error,omitempty"`
CreateTime int64 `json:"create_time,omitempty"`
LastUpdateTime int64 `json:"last_update_time,omitempty"`
}
MLTaskInfo contains information about an async ML task
type MapperOption ¶
type MapperOption func(*MappingCache)
MapperOption configures the FieldMapper
func WithCacheTTL ¶
func WithCacheTTL(ttl time.Duration) MapperOption
WithCacheTTL sets the cache TTL duration
func WithConflictStrategy ¶
func WithConflictStrategy(strategy ConflictStrategy) MapperOption
WithConflictStrategy sets how to handle field type conflicts
func WithMaxCacheSize ¶
func WithMaxCacheSize(size int) MapperOption
WithMaxCacheSize sets the maximum cache size
func WithStrictMode ¶
func WithStrictMode(strict bool) MapperOption
WithStrictMode enables strict mode (error on unknown fields)
type MappingBuilder ¶
type MappingBuilder struct {
// contains filtered or unexported fields
}
MappingBuilder provides a fluent API for adding fields to existing indices
func NewMappingBuilder ¶
func NewMappingBuilder(ctx context.Context, index string) *MappingBuilder
NewMappingBuilder creates a new mapping builder for the specified index
func (*MappingBuilder) AddBooleanField ¶
func (b *MappingBuilder) AddBooleanField(name string) *MappingBuilder
AddBooleanField adds a boolean field
func (*MappingBuilder) AddDateField ¶
func (b *MappingBuilder) AddDateField(name string, format string) *MappingBuilder
AddDateField adds a date field with optional format
func (*MappingBuilder) AddDoubleField ¶
func (b *MappingBuilder) AddDoubleField(name string) *MappingBuilder
AddDoubleField adds a double field
func (*MappingBuilder) AddField ¶
func (b *MappingBuilder) AddField(name string, fieldType string) *MappingBuilder
AddField adds a field with the specified type
func (*MappingBuilder) AddFloatField ¶
func (b *MappingBuilder) AddFloatField(name string) *MappingBuilder
AddFloatField adds a float field
func (*MappingBuilder) AddIntegerField ¶
func (b *MappingBuilder) AddIntegerField(name string) *MappingBuilder
AddIntegerField adds an integer field
func (*MappingBuilder) AddKNNVectorField ¶
func (b *MappingBuilder) AddKNNVectorField(name string, dimension int, method *KNNMethod) *MappingBuilder
AddKNNVectorField adds a k-NN vector field for similarity search
func (*MappingBuilder) AddKeywordField ¶
func (b *MappingBuilder) AddKeywordField(name string) *MappingBuilder
AddKeywordField adds a keyword field
func (*MappingBuilder) AddLongField ¶
func (b *MappingBuilder) AddLongField(name string) *MappingBuilder
AddLongField adds a long field
func (*MappingBuilder) AddNestedField ¶
func (b *MappingBuilder) AddNestedField(name string, properties map[string]MappingProperty) *MappingBuilder
AddNestedField adds a nested field with properties
func (*MappingBuilder) AddObjectField ¶
func (b *MappingBuilder) AddObjectField(name string, properties map[string]MappingProperty) *MappingBuilder
AddObjectField adds an object field with properties
func (*MappingBuilder) AddProperty ¶
func (b *MappingBuilder) AddProperty(name string, property MappingProperty) *MappingBuilder
AddProperty adds a custom property definition
func (*MappingBuilder) AddTextField ¶
func (b *MappingBuilder) AddTextField(name string, analyzer string) *MappingBuilder
AddTextField adds a text field with an optional analyzer
func (*MappingBuilder) Build ¶
func (b *MappingBuilder) Build() (map[string]interface{}, error)
Build returns the mapping update request body
func (*MappingBuilder) BuildWithErrors ¶
func (b *MappingBuilder) BuildWithErrors() (map[string]interface{}, []error)
BuildWithErrors returns the mapping and any accumulated errors
func (*MappingBuilder) Ensure ¶
func (b *MappingBuilder) Ensure() error
Ensure applies the mapping to the index (idempotent - adds new fields only)
type MappingCache ¶
type MappingCache struct {
// contains filtered or unexported fields
}
MappingCache caches merged mappings with LRU eviction
func (*MappingCache) GetOrFetch ¶
func (c *MappingCache) GetOrFetch(ctx context.Context, pattern string) (*MergedMapping, error)
GetOrFetch retrieves from cache or fetches and caches
func (*MappingCache) Invalidate ¶
func (c *MappingCache) Invalidate(pattern string)
Invalidate removes the pattern from cache
type MappingProperty ¶
type MappingProperty struct {
Type string `json:"type"`
Index *bool `json:"index,omitempty"`
Store *bool `json:"store,omitempty"`
Analyzer string `json:"analyzer,omitempty"`
Format string `json:"format,omitempty"`
Dimension int `json:"dimension,omitempty"`
Method *KNNMethod `json:"method,omitempty"`
Fields map[string]MappingProperty `json:"fields,omitempty"`
Properties map[string]MappingProperty `json:"properties,omitempty"`
}
MappingProperty represents a field mapping property
type Match ¶
type Match struct {
Query string `json:"query,omitempty"`
Fuzziness string `json:"fuzziness,omitempty"`
FuzzyTranspositions bool `json:"fuzzy_transpositions,omitempty"`
Operator string `json:"operator,omitempty"`
MinimumShouldMatch int64 `json:"minimum_should_match,omitempty"`
Analyzer string `json:"analyzer,omitempty"`
ZeroTermsQuery string `json:"zero_terms_query,omitempty"`
Lenient bool `json:"lenient,omitempty"`
PrefixLength int64 `json:"prefix_length,omitempty"`
MaxExpansions int64 `json:"max_expansions,omitempty"`
Boost int64 `json:"boost,omitempty"`
}
Match represents a full-text match query configuration.
type MatchBoolPrefix ¶
type MatchBoolPrefix struct {
Query string `json:"query,omitempty"`
Fuzziness string `json:"fuzziness,omitempty"`
FuzzyTranspositions bool `json:"fuzzy_transpositions,omitempty"`
MaxExpansions int64 `json:"max_expansions,omitempty"`
PrefixLength int64 `json:"prefix_length,omitempty"`
Operator string `json:"operator,omitempty"`
MinimumShouldMatch int64 `json:"minimum_should_match,omitempty"`
Analyzer string `json:"analyzer,omitempty"`
}
type MatchPhrase ¶
type MatchPhrasePrefix ¶
type MergedMapping ¶
type MergedMapping struct {
IndexPattern string
Indices []string
Fields map[string]FieldInfo
ConflictCount int
FetchedAt time.Time
}
MergedMapping holds merged field definitions from multiple indices
func (*MergedMapping) GetConflicts ¶
func (m *MergedMapping) GetConflicts() []FieldInfo
GetConflicts returns a list of fields with type conflicts
func (*MergedMapping) GetFieldInfo ¶
func (m *MergedMapping) GetFieldInfo(field string) (FieldInfo, bool)
GetFieldInfo retrieves field info from merged mapping
func (*MergedMapping) HasConflicts ¶
func (m *MergedMapping) HasConflicts() bool
HasConflicts returns true if any fields have type conflicts
func (*MergedMapping) ResolveFieldName ¶
func (m *MergedMapping) ResolveFieldName(field string, queryType QueryType) (string, error)
ResolveFieldName returns the correct field name for the given query type
type MovingAvg ¶
type MovingAvg struct {
Predict int `json:"predict,omitempty"`
Window int `json:"window,omitempty"`
Model string `json:"model,omitempty"`
Settings map[string]interface{} `json:"settings,omitempty"`
PipelineAgg
}
type MultiMatch ¶
type MultiMatch struct {
Query string `json:"query,omitempty"`
Fields []string `json:"fields,omitempty"`
Fuzziness string `json:"fuzziness,omitempty"`
FuzzyTranspositions bool `json:"fuzzy_transpositions,omitempty"`
Operator string `json:"operator,omitempty"`
MinimumShouldMatch int64 `json:"minimum_should_match,omitempty"`
Analyzer string `json:"analyzer,omitempty"`
ZeroTermsQuery string `json:"zero_terms_query,omitempty"`
Lenient bool `json:"lenient,omitempty"`
PrefixLength int64 `json:"prefix_length,omitempty"`
MaxExpansions int64 `json:"max_expansions,omitempty"`
Boost int64 `json:"boost,omitempty"`
Type string `json:"type,omitempty"`
TieBreaker float64 `json:"tie_breaker,omitempty"`
AutoGenerateSynonymsPhraseQuery bool `json:"auto_generate_synonyms_phrase_query,omitempty"`
}
type MultiTerms ¶
type PercentileRanks ¶
type PipelineAgg ¶
type PipelineAgg struct {
BucketsPath string `json:"buckets_path,omitempty"`
}
type Query ¶
type Query struct {
Bool *Bool `json:"bool,omitempty"`
Term map[string]map[string]interface{} `json:"term,omitempty"`
Terms map[string][]interface{} `json:"terms,omitempty"`
IDs map[string][]interface{} `json:"ids,omitempty"`
Range map[string]map[string]interface{} `json:"range,omitempty"`
Exists map[string]string `json:"exists,omitempty"`
Prefix map[string]string `json:"prefix,omitempty"`
Fuzzy map[string]map[string]interface{} `json:"fuzzy,omitempty"`
Wildcard map[string]map[string]interface{} `json:"wildcard,omitempty"`
Regexp map[string]string `json:"regexp,omitempty"`
Match map[string]Match `json:"match,omitempty"`
MultiMatch *MultiMatch `json:"multi_match,omitempty"`
MatchBoolPrefix map[string]MatchBoolPrefix `json:"match_bool_prefix,omitempty"`
MatchPhrase map[string]MatchPhrase `json:"match_phrase,omitempty"`
MatchPhrasePrefix map[string]MatchPhrasePrefix `json:"match_phrase_prefix,omitempty"`
QueryString *QueryString `json:"query_string,omitempty"`
SimpleQueryString *SimpleQueryString `json:"simple_query_string,omitempty"`
KNN map[string]*KNNQuery `json:"knn,omitempty"`
}
Query represents an OpenSearch query clause. Only one query type should be set per Query instance.
func CIDRQuery ¶
CIDRQuery creates a term query for "ip" type fields using CIDR notation. This is for fields mapped as "ip" type (storing single IP addresses). OpenSearch natively supports CIDR notation in term queries on ip fields. Example: CIDRQuery("client_ip", "192.168.0.0/16") matches all IPs in 192.168.x.x range Note: For "ip_range" type fields, use IPRangeContainsQuery or IPRangeIntersectsQuery instead.
func CIDRsQuery ¶
CIDRsQuery creates a terms query for "ip" type fields using multiple CIDR notations. This is for fields mapped as "ip" type (storing single IP addresses). Example: CIDRsQuery("client_ip", "192.168.0.0/24", "10.0.0.0/8") Note: For "ip_range" type fields, use IPRangeContainsQuery or IPRangeIntersectsQuery instead.
func ExistsQuery ¶
ExistsQuery creates an exists query (field must be present)
func FuzzyQuery ¶
FuzzyQuery creates a fuzzy query
func IDsQuery ¶
func IDsQuery(ids []interface{}) Query
IDsQuery creates an IDs query (match by document IDs)
func IPRangeContainsQuery ¶
IPRangeContainsQuery creates a range query that matches ip_range fields containing the given IP. Use this to find documents where the stored IP range contains the query IP address. The "relation" parameter is set to "contains" to match ranges that fully contain the query value. Example: IPRangeContainsQuery("allowed_ips", "192.168.1.50") matches ranges like 192.168.0.0/16
func IPRangeIntersectsQuery ¶
IPRangeIntersectsQuery creates a range query that matches ip_range fields intersecting with the given range. Use this to find documents where the stored IP range overlaps with the query range. The "relation" parameter is set to "intersects" (default behavior). Example: IPRangeIntersectsQuery("blocked_ranges", "192.168.0.0", "192.168.255.255")
func IPRangeWithinQuery ¶
IPRangeWithinQuery creates a range query that matches ip_range fields entirely within the given range. Use this to find documents where the stored IP range is completely contained within the query range. The "relation" parameter is set to "within". Example: IPRangeWithinQuery("subnet", "10.0.0.0", "10.255.255.255") matches 10.0.0.0/24, 10.1.0.0/16, etc.
func MatchPhrasePrefixQuery ¶
MatchPhrasePrefixQuery creates a match phrase prefix query
func MatchPhraseQuery ¶
MatchPhraseQuery creates a match phrase query
func MatchQuery ¶
MatchQuery creates a full-text match query
func MultiMatchQuery ¶
MultiMatchQuery creates a multi-match query across multiple fields
func NewKNNQuery ¶
NewKNNQuery creates a basic k-NN query to find the k nearest neighbors. field: the knn_vector field name vector: the query vector (must match the field's dimension) k: number of nearest neighbors to return Example: NewKNNQuery("embedding", []float32{0.1, 0.2, 0.3}, 10)
func NewKNNQueryWithFilter ¶
NewKNNQueryWithFilter creates a k-NN query with a pre-filter. The filter is applied before the k-NN search, so only matching documents are considered. field: the knn_vector field name vector: the query vector k: number of nearest neighbors to return filter: query to filter documents before k-NN search Example:
NewKNNQueryWithFilter("embedding", []float32{0.1, 0.2, 0.3}, 10,
TermQuery("status.keyword", "active"))
func NewKNNQueryWithMaxDistance ¶
NewKNNQueryWithMaxDistance creates a k-NN query with a maximum distance threshold. Only results within maxDistance from the query vector are returned. The distance metric depends on the space_type configured in the index mapping. field: the knn_vector field name vector: the query vector k: number of nearest neighbors to return maxDistance: maximum distance threshold (e.g., for L2 distance) Example: NewKNNQueryWithMaxDistance("embedding", []float32{0.1, 0.2, 0.3}, 10, 100.0)
func NewKNNQueryWithMinScore ¶
NewKNNQueryWithMinScore creates a k-NN query with a minimum score threshold. Only results with similarity score >= minScore are returned. field: the knn_vector field name vector: the query vector k: number of nearest neighbors to return minScore: minimum similarity score threshold (0.0 to 1.0 for cosine similarity) Example: NewKNNQueryWithMinScore("embedding", []float32{0.1, 0.2, 0.3}, 10, 0.8)
func NewKNNQueryWithOptions ¶
func NewKNNQueryWithOptions(field string, vector []float32, k int, opts KNNQueryOptions) Query
NewKNNQueryWithOptions creates a k-NN query with additional options. field: the knn_vector field name vector: the query vector (must match the field's dimension) k: number of nearest neighbors to return opts: optional parameters like filter, min_score, max_distance, etc. Example:
NewKNNQueryWithOptions("embedding", []float32{0.1, 0.2, 0.3}, 10, KNNQueryOptions{
MinScore: Float64Ptr(0.8),
Filter: &Query{Term: map[string]map[string]interface{}{"category": {"value": "tech"}}},
})
func PrefixQuery ¶
PrefixQuery creates a prefix query
func QueryStringQuery ¶
QueryStringQuery creates a query string query
func RangeQuery ¶
RangeQuery creates a range query operator can be: "gte", "lte", "gt", "lt"
func RangeQueryBetween ¶
RangeQueryBetween creates a range query between two values
func RegexpQuery ¶
RegexpQuery creates a regexp query
func SimpleQueryStringQuery ¶
SimpleQueryStringQuery creates a simple query string query
func TermsQuery ¶
TermsQuery creates a terms query (match any value)
func WildcardQuery ¶
WildcardQuery creates a wildcard query
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
QueryBuilder provides a fluent API for building OpenSearch queries
func NewQueryBuilder ¶
func NewQueryBuilder(ctx context.Context, indices []string, processName string) *QueryBuilder
NewQueryBuilder creates a new QueryBuilder with default mapper
func NewQueryBuilderWithMapper ¶
func NewQueryBuilderWithMapper(ctx context.Context, indices []string, mapper *FieldMapper, processName string) *QueryBuilder
NewQueryBuilderWithMapper creates a new QueryBuilder with custom mapper
func (*QueryBuilder) AdjacencyMatrixAgg ¶
func (b *QueryBuilder) AdjacencyMatrixAgg(name string, filters map[string]interface{}) *QueryBuilder
AdjacencyMatrixAgg adds an adjacency_matrix aggregation
func (*QueryBuilder) Agg ¶
func (b *QueryBuilder) Agg(name string, agg Aggs) *QueryBuilder
Agg adds a raw Aggs object (for advanced/custom aggregations)
func (*QueryBuilder) AvgAgg ¶
func (b *QueryBuilder) AvgAgg(name string, field string) *QueryBuilder
AvgAgg adds an average aggregation
func (*QueryBuilder) AvgBucketAgg ¶
func (b *QueryBuilder) AvgBucketAgg(name string, bucketsPath string) *QueryBuilder
AvgBucketAgg adds an avg_bucket pipeline aggregation
func (*QueryBuilder) Bool ¶
func (b *QueryBuilder) Bool() *BoolBuilder
Bool creates a new BoolBuilder with inherited context from QueryBuilder
func (*QueryBuilder) BucketSortAgg ¶
func (b *QueryBuilder) BucketSortAgg(name string, sort []map[string]interface{}, size int) *QueryBuilder
BucketSortAgg adds a bucket_sort pipeline aggregation
func (*QueryBuilder) Build ¶
func (b *QueryBuilder) Build() SearchRequest
Build returns the constructed SearchRequest
func (*QueryBuilder) BuildWithErrors ¶
func (b *QueryBuilder) BuildWithErrors() (SearchRequest, []error)
BuildWithErrors returns the SearchRequest and any errors encountered
func (*QueryBuilder) CIDR ¶
func (b *QueryBuilder) CIDR(field string, cidr string) *QueryBuilder
CIDR adds a CIDR query for "ip" type fields (e.g., "192.168.0.0/16") This is for fields mapped as "ip" type (storing single IP addresses). OpenSearch natively supports CIDR notation in term queries on ip fields. Note: For "ip_range" type fields, use IPRangeContains, IPRangeIntersects, or IPRangeWithin instead.
func (*QueryBuilder) CIDRs ¶
func (b *QueryBuilder) CIDRs(field string, cidrs ...string) *QueryBuilder
CIDRs add a terms query for "ip" type fields using multiple CIDR notations. This is for fields mapped as "ip" type (storing single IP addresses). Example: CIDRs("client_ip", "192.168.0.0/24", "10.0.0.0/8") Note: For "ip_range" type fields, use IPRangeContains, IPRangeIntersects, or IPRangeWithin instead.
func (*QueryBuilder) CardinalityAgg ¶
func (b *QueryBuilder) CardinalityAgg(name string, field string) *QueryBuilder
CardinalityAgg adds a cardinality aggregation (unique count)
func (*QueryBuilder) Collapse ¶
func (b *QueryBuilder) Collapse(field string) *QueryBuilder
Collapse deduplicates results by field
func (*QueryBuilder) CumulativeSumAgg ¶
func (b *QueryBuilder) CumulativeSumAgg(name string, bucketsPath string) *QueryBuilder
CumulativeSumAgg adds a cumulative_sum pipeline aggregation
func (*QueryBuilder) DateHistogramAgg ¶
func (b *QueryBuilder) DateHistogramAgg(name string, field string, interval string) *QueryBuilder
DateHistogramAgg adds a date histogram aggregation
func (*QueryBuilder) DateRangeAgg ¶
func (b *QueryBuilder) DateRangeAgg(name string, field string, format string, ranges []map[string]interface{}) *QueryBuilder
DateRangeAgg adds a date_range aggregation
func (*QueryBuilder) DerivativeAgg ¶
func (b *QueryBuilder) DerivativeAgg(name string, bucketsPath string) *QueryBuilder
DerivativeAgg adds a derivative pipeline aggregation
func (*QueryBuilder) DiversifiedSamplerAgg ¶
func (b *QueryBuilder) DiversifiedSamplerAgg(name string, field string, shardSize int) *QueryBuilder
DiversifiedSamplerAgg adds a diversified_sampler aggregation
func (*QueryBuilder) ExcludeSource ¶
func (b *QueryBuilder) ExcludeSource(fields ...string) *QueryBuilder
ExcludeSource specifies which fields to exclude from results
func (*QueryBuilder) Exists ¶
func (b *QueryBuilder) Exists(field string) *QueryBuilder
Exists adds an exists query (field must be present)
func (*QueryBuilder) ExtendedStatsAgg ¶
func (b *QueryBuilder) ExtendedStatsAgg(name string, field string, sigma int64) *QueryBuilder
ExtendedStatsAgg adds an extended_stats aggregation
func (*QueryBuilder) ExtendedStatsBucketAgg ¶
func (b *QueryBuilder) ExtendedStatsBucketAgg(name string, bucketsPath string) *QueryBuilder
ExtendedStatsBucketAgg adds an extended_stats_bucket pipeline aggregation
func (*QueryBuilder) Filter ¶
func (b *QueryBuilder) Filter(queries ...Query) *QueryBuilder
Filter adds filter queries (no scoring, AND logic)
func (*QueryBuilder) FilterAgg ¶
func (b *QueryBuilder) FilterAgg(name string, filter Query) *QueryBuilder
FilterAgg adds a filter aggregation
func (*QueryBuilder) FilterBool ¶
func (b *QueryBuilder) FilterBool(nested *BoolBuilder) *QueryBuilder
FilterBool adds a nested bool query to filter clause
func (*QueryBuilder) FiltersAgg ¶
func (b *QueryBuilder) FiltersAgg(name string, filters map[string]interface{}) *QueryBuilder
FiltersAgg adds a filters aggregation
func (*QueryBuilder) From ¶
func (b *QueryBuilder) From(from int64) *QueryBuilder
From sets the offset for pagination
func (*QueryBuilder) Fuzzy ¶
func (b *QueryBuilder) Fuzzy(field string, value string, fuzziness ...string) *QueryBuilder
Fuzzy adds a fuzzy query for typo-tolerant matching (with field resolution)
func (*QueryBuilder) GeoDistanceAgg ¶
func (b *QueryBuilder) GeoDistanceAgg(name string, field string, origin interface{}, ranges []map[string]interface{}) *QueryBuilder
GeoDistanceAgg adds a geo_distance aggregation
func (*QueryBuilder) GeohashGridAgg ¶
func (b *QueryBuilder) GeohashGridAgg(name string, field string, precision int) *QueryBuilder
GeohashGridAgg adds a geohash_grid aggregation
func (*QueryBuilder) GeohexGridAgg ¶
func (b *QueryBuilder) GeohexGridAgg(name string, field string, precision int) *QueryBuilder
GeohexGridAgg adds a geohex_grid aggregation
func (*QueryBuilder) GeotileGridAgg ¶
func (b *QueryBuilder) GeotileGridAgg(name string, field string, precision int) *QueryBuilder
GeotileGridAgg adds a geotile_grid aggregation
func (*QueryBuilder) GetMappingConflicts ¶
func (b *QueryBuilder) GetMappingConflicts() []FieldInfo
GetMappingConflicts returns fields with type conflicts across indices
func (*QueryBuilder) GlobalAgg ¶
func (b *QueryBuilder) GlobalAgg(name string) *QueryBuilder
GlobalAgg adds a global aggregation
func (*QueryBuilder) HistogramAgg ¶
func (b *QueryBuilder) HistogramAgg(name string, field string, interval float64) *QueryBuilder
HistogramAgg adds a numeric histogram aggregation
func (*QueryBuilder) IDs ¶
func (b *QueryBuilder) IDs(ids ...interface{}) *QueryBuilder
IDs adds an IDs query to filter documents by ID (no field resolution needed)
func (*QueryBuilder) IPRangeAgg ¶
func (b *QueryBuilder) IPRangeAgg(name string, field string, ranges []map[string]interface{}) *QueryBuilder
IPRangeAgg adds an ip_range aggregation
func (*QueryBuilder) IPRangeContains ¶
func (b *QueryBuilder) IPRangeContains(field string, ip string) *QueryBuilder
IPRangeContains finds documents where the stored ip_range contains the given IP address. Example: IPRangeContains("allowed_ips", "192.168.1.50") matches ranges like 192.168.0.0/16
func (*QueryBuilder) IPRangeIntersects ¶
func (b *QueryBuilder) IPRangeIntersects(field string, fromIP, toIP string) *QueryBuilder
IPRangeIntersects finds documents where the stored ip_range overlaps with the given range. Example: IPRangeIntersects("blocked_ranges", "192.168.0.0", "192.168.255.255")
func (*QueryBuilder) IPRangeWithin ¶
func (b *QueryBuilder) IPRangeWithin(field string, fromIP, toIP string) *QueryBuilder
IPRangeWithin finds documents where the stored ip_range is entirely within the given range. Example: IPRangeWithin("subnet", "10.0.0.0", "10.255.255.255") matches 10.0.0.0/24, 10.1.0.0/16, etc.
func (*QueryBuilder) IncludeSource ¶
func (b *QueryBuilder) IncludeSource(fields ...string) *QueryBuilder
IncludeSource specifies which fields to include in results
func (*QueryBuilder) KNN ¶
func (b *QueryBuilder) KNN(field string, vector []float32, k int) *QueryBuilder
KNN adds a basic k-NN query to find the k nearest neighbors. field: the knn_vector field name vector: the query vector (must match the field's dimension) k: number of nearest neighbors to return Example: builder.KNN("embedding", []float32{0.1, 0.2, 0.3}, 10)
Note: In OpenSearch 3.x, k-NN queries must be at the top level of the query. This builder handles the proper placement automatically.
func (*QueryBuilder) KNNWithFilter ¶
func (b *QueryBuilder) KNNWithFilter(field string, vector []float32, k int, filter Query) *QueryBuilder
KNNWithFilter adds a k-NN query with a pre-filter. The filter is applied before the k-NN search, so only matching documents are considered. field: the knn_vector field name vector: the query vector k: number of nearest neighbors to return filter: query to filter documents before k-NN search Example:
builder.KNNWithFilter("embedding", []float32{0.1, 0.2, 0.3}, 10,
TermQuery("category.keyword", "tech"))
Note: In OpenSearch 3.x, k-NN queries must be at the top level of the query. This builder handles the proper placement automatically.
func (*QueryBuilder) KNNWithMaxDistance ¶
func (b *QueryBuilder) KNNWithMaxDistance(field string, vector []float32, k int, maxDistance float64) *QueryBuilder
KNNWithMaxDistance adds a k-NN query with a maximum distance threshold. Only results within maxDistance from the query vector are returned. The distance metric depends on the space_type configured in the index mapping. field: the knn_vector field name vector: the query vector k: maximum number of results to return (used as Size limit) maxDistance: maximum distance threshold (e.g., for L2 distance) Example: builder.KNNWithMaxDistance("embedding", []float32{0.1, 0.2, 0.3}, 10, 100.0)
Note: In OpenSearch 3.x, k-NN queries must be at the top level of the query and require exactly ONE of k, distance, or score. When max_distance is set, this function sets the Size field to limit results instead of using K.
func (*QueryBuilder) KNNWithMinScore ¶
func (b *QueryBuilder) KNNWithMinScore(field string, vector []float32, k int, minScore float64) *QueryBuilder
KNNWithMinScore adds a k-NN query with a minimum score threshold. Only results with similarity score >= minScore are returned. field: the knn_vector field name vector: the query vector k: maximum number of results to return (used as Size limit) minScore: minimum similarity score threshold (0.0 to 1.0 for cosine similarity) Example: builder.KNNWithMinScore("embedding", []float32{0.1, 0.2, 0.3}, 10, 0.8)
Note: In OpenSearch 3.x, k-NN queries must be at the top level of the query and require exactly ONE of k, distance, or score. When min_score is set, this function sets the Size field to limit results instead of using K.
func (*QueryBuilder) KNNWithOptions ¶
func (b *QueryBuilder) KNNWithOptions(field string, vector []float32, k int, opts KNNQueryOptions) *QueryBuilder
KNNWithOptions adds a k-NN query with full options. field: the knn_vector field name vector: the query vector k: number of nearest neighbors to return (or max results when using min_score/max_distance) opts: optional parameters like filter, min_score, max_distance, ef_search, etc. Example:
builder.KNNWithOptions("embedding", []float32{0.1, 0.2, 0.3}, 10, KNNQueryOptions{
MinScore: Float64Ptr(0.8),
EfSearch: IntPtr(100),
})
Note: In OpenSearch 3.x, k-NN queries must be at the top level of the query and require exactly ONE of k, distance, or score. When min_score or max_distance is set, K is not used in the query (Size is set instead to limit results).
func (*QueryBuilder) Match ¶
func (b *QueryBuilder) Match(field string, value string) *QueryBuilder
Match adds a full-text match query
func (*QueryBuilder) MatchAll ¶
func (b *QueryBuilder) MatchAll() *QueryBuilder
MatchAll adds a match_all query (matches everything)
func (*QueryBuilder) MatchPhrase ¶
func (b *QueryBuilder) MatchPhrase(field string, value string) *QueryBuilder
MatchPhrase adds a match phrase query
func (*QueryBuilder) MatchPhrasePrefix ¶
func (b *QueryBuilder) MatchPhrasePrefix(field string, value string) *QueryBuilder
MatchPhrasePrefix adds a match_phrase_prefix query (with field resolution)
func (*QueryBuilder) MatrixStatsAgg ¶
func (b *QueryBuilder) MatrixStatsAgg(name string, fields []string) *QueryBuilder
MatrixStatsAgg adds a matrix_stats aggregation
func (*QueryBuilder) MaxAgg ¶
func (b *QueryBuilder) MaxAgg(name string, field string) *QueryBuilder
MaxAgg adds a max aggregation
func (*QueryBuilder) MaxBucketAgg ¶
func (b *QueryBuilder) MaxBucketAgg(name string, bucketsPath string) *QueryBuilder
MaxBucketAgg adds a max_bucket pipeline aggregation
func (*QueryBuilder) MinAgg ¶
func (b *QueryBuilder) MinAgg(name string, field string) *QueryBuilder
MinAgg adds a min aggregation
func (*QueryBuilder) MinBucketAgg ¶
func (b *QueryBuilder) MinBucketAgg(name string, bucketsPath string) *QueryBuilder
MinBucketAgg adds a min_bucket pipeline aggregation
func (*QueryBuilder) MinimumShouldMatch ¶
func (b *QueryBuilder) MinimumShouldMatch(value interface{}) *QueryBuilder
MinimumShouldMatch sets the minimum number of should clauses that must match
func (*QueryBuilder) MovingAvgAgg ¶
func (b *QueryBuilder) MovingAvgAgg(name string, bucketsPath string, window int, model string) *QueryBuilder
MovingAvgAgg adds a moving_avg pipeline aggregation
func (*QueryBuilder) MultiMatch ¶
func (b *QueryBuilder) MultiMatch(query string, fields []string, matchType ...string) *QueryBuilder
MultiMatch adds a multi_match query across multiple fields
func (*QueryBuilder) MultiTermsAgg ¶
func (b *QueryBuilder) MultiTermsAgg(name string, terms []Agg, order map[string]string) *QueryBuilder
MultiTermsAgg adds a multi_terms aggregation
func (*QueryBuilder) Must ¶
func (b *QueryBuilder) Must(queries ...Query) *QueryBuilder
Must adds queries that must match (AND logic)
func (*QueryBuilder) MustBool ¶
func (b *QueryBuilder) MustBool(nested *BoolBuilder) *QueryBuilder
MustBool adds a nested bool query to must clause
func (*QueryBuilder) MustNot ¶
func (b *QueryBuilder) MustNot(queries ...Query) *QueryBuilder
MustNot adds queries that must not match (NOT logic)
func (*QueryBuilder) MustNotBool ¶
func (b *QueryBuilder) MustNotBool(nested *BoolBuilder) *QueryBuilder
MustNotBool adds a nested bool query to must_not clause
func (*QueryBuilder) NestedAgg ¶
func (b *QueryBuilder) NestedAgg(name string, path string) *QueryBuilder
NestedAgg adds a nested aggregation
func (*QueryBuilder) PercentileRanksAgg ¶
func (b *QueryBuilder) PercentileRanksAgg(name string, field string, values []int64) *QueryBuilder
PercentileRanksAgg adds a percentile_ranks aggregation
func (*QueryBuilder) PercentilesAgg ¶
func (b *QueryBuilder) PercentilesAgg(name string, field string) *QueryBuilder
PercentilesAgg adds a percentiles aggregation
func (*QueryBuilder) Prefix ¶
func (b *QueryBuilder) Prefix(field string, prefix string) *QueryBuilder
Prefix adds a prefix query (with field resolution)
func (*QueryBuilder) QueryString ¶
func (b *QueryBuilder) QueryString(query string, defaultOperator ...string) *QueryBuilder
QueryString adds a query_string query with Lucene syntax support
func (*QueryBuilder) Range ¶
func (b *QueryBuilder) Range(field string, operator string, value interface{}) *QueryBuilder
Range adds a range query
func (*QueryBuilder) RangeAgg ¶
func (b *QueryBuilder) RangeAgg(name string, field string, ranges []map[string]interface{}) *QueryBuilder
RangeAgg adds a range aggregation
func (*QueryBuilder) Regexp ¶
func (b *QueryBuilder) Regexp(field string, pattern string) *QueryBuilder
Regexp adds a regexp query (with field resolution - prefers keyword fields)
func (*QueryBuilder) ReverseNestedAgg ¶
func (b *QueryBuilder) ReverseNestedAgg(name string) *QueryBuilder
ReverseNestedAgg adds a reverse_nested aggregation
func (*QueryBuilder) SamplerAgg ¶
func (b *QueryBuilder) SamplerAgg(name string, shardSize int) *QueryBuilder
SamplerAgg adds a sampler aggregation
func (*QueryBuilder) ScriptFields ¶
func (b *QueryBuilder) ScriptFields(scripts interface{}) *QueryBuilder
ScriptFields adds script fields to compute values
func (*QueryBuilder) SearchAfter ¶
func (b *QueryBuilder) SearchAfter(values []any) *QueryBuilder
SearchAfter sets cursor-based pagination
func (*QueryBuilder) SerialDiffAgg ¶
func (b *QueryBuilder) SerialDiffAgg(name string, bucketsPath string, lag int) *QueryBuilder
SerialDiffAgg adds a serial_diff pipeline aggregation
func (*QueryBuilder) SetSource ¶
func (b *QueryBuilder) SetSource(source *Source) *QueryBuilder
SetSource sets the full Source object (for advanced control)
func (*QueryBuilder) Should ¶
func (b *QueryBuilder) Should(queries ...Query) *QueryBuilder
Should adds queries that should match (OR logic)
func (*QueryBuilder) ShouldBool ¶
func (b *QueryBuilder) ShouldBool(nested *BoolBuilder) *QueryBuilder
ShouldBool adds a nested bool query to should clause
func (*QueryBuilder) SignificantTermsAgg ¶
func (b *QueryBuilder) SignificantTermsAgg(name string, field string) *QueryBuilder
SignificantTermsAgg adds a significant_terms aggregation
func (*QueryBuilder) SignificantTextAgg ¶
func (b *QueryBuilder) SignificantTextAgg(name string, field string, opts map[string]interface{}) *QueryBuilder
SignificantTextAgg adds a significant_text aggregation
func (*QueryBuilder) SimpleQueryString ¶
func (b *QueryBuilder) SimpleQueryString(query string, fields ...string) *QueryBuilder
SimpleQueryString adds a simple_query_string query
func (*QueryBuilder) Size ¶
func (b *QueryBuilder) Size(size int64) *QueryBuilder
Size sets the number of results to return
func (*QueryBuilder) Sort ¶
func (b *QueryBuilder) Sort(field string, order string) *QueryBuilder
Sort adds sorting to the query
func (*QueryBuilder) StatsAgg ¶
func (b *QueryBuilder) StatsAgg(name string, field string) *QueryBuilder
StatsAgg adds a stats aggregation (min, max, avg, sum, count)
func (*QueryBuilder) StatsBucketAgg ¶
func (b *QueryBuilder) StatsBucketAgg(name string, bucketsPath string) *QueryBuilder
StatsBucketAgg adds a stats_bucket pipeline aggregation
func (*QueryBuilder) StoredFields ¶
func (b *QueryBuilder) StoredFields(fields ...string) *QueryBuilder
StoredFields specifies which stored fields to return
func (*QueryBuilder) SubAgg ¶
func (b *QueryBuilder) SubAgg(parentName string, childName string, childAgg Aggs) *QueryBuilder
SubAgg adds a sub-aggregation to an existing aggregation
func (*QueryBuilder) SumAgg ¶
func (b *QueryBuilder) SumAgg(name string, field string) *QueryBuilder
SumAgg adds a sum aggregation
func (*QueryBuilder) SumBucketAgg ¶
func (b *QueryBuilder) SumBucketAgg(name string, bucketsPath string) *QueryBuilder
SumBucketAgg adds a sum_bucket pipeline aggregation
func (*QueryBuilder) Term ¶
func (b *QueryBuilder) Term(field string, value interface{}) *QueryBuilder
Term adds a term query (exact match)
func (*QueryBuilder) Terms ¶
func (b *QueryBuilder) Terms(field string, values []interface{}) *QueryBuilder
Terms add a terms query (match any of the values)
func (*QueryBuilder) TermsAgg ¶
func (b *QueryBuilder) TermsAgg(name string, field string, size int64) *QueryBuilder
TermsAgg adds a terms aggregation
func (*QueryBuilder) TopHitsAgg ¶
func (b *QueryBuilder) TopHitsAgg(name string, size int64) *QueryBuilder
TopHitsAgg adds a top_hits aggregation
func (*QueryBuilder) ValueCountAgg ¶
func (b *QueryBuilder) ValueCountAgg(name string, field string) *QueryBuilder
ValueCountAgg adds a value_count aggregation
func (*QueryBuilder) Version ¶
func (b *QueryBuilder) Version(enabled bool) *QueryBuilder
Version enables version tracking in results
func (*QueryBuilder) Wildcard ¶
func (b *QueryBuilder) Wildcard(field string, pattern string) *QueryBuilder
Wildcard adds a wildcard query
type QueryString ¶
type QueryString struct {
Query string `json:"query,omitempty"`
DefaultField string `json:"default_field,omitempty"`
Type string `json:"type,omitempty"`
Fuzziness string `json:"fuzziness,omitempty"`
FuzzyTranspositions bool `json:"fuzzy_transpositions,omitempty"`
FuzzyMaxExpansions int64 `json:"fuzzy_max_expansions,omitempty"`
FuzzyPrefixLength int64 `json:"fuzzy_prefix_length,omitempty"`
MinimumShouldMatch int64 `json:"minimum_should_match,omitempty"`
DefaultOperator string `json:"default_operator,omitempty"`
Analyzer string `json:"analyzer,omitempty"`
Lenient bool `json:"lenient,omitempty"`
Boost int64 `json:"boost,omitempty"`
AllowLeadingWildcard bool `json:"allow_leading_wildcard,omitempty"`
EnablePositionIncrements bool `json:"enable_position_increments,omitempty"`
PhraseSlop int64 `json:"phrase_slop,omitempty"`
MaxDeterminizedStates int64 `json:"max_determinized_states,omitempty"`
TimeZone string `json:"time_zone,omitempty"`
QuoteFieldSuffix string `json:"quote_field_suffix,omitempty"`
QuoteAnalyzer string `json:"quote_analyzer,omitempty"`
AnalyzeWildcard bool `json:"analyze_wildcard,omitempty"`
AutoGenerateSynonymsPhraseQuery bool `json:"auto_generate_synonyms_phrase_query,omitempty"`
}
type QueryType ¶
type QueryType int
QueryType represents the type of query being performed
const ( QueryTypeTerm QueryType = iota QueryTypeTerms QueryTypeMatch QueryTypeMatchPhrase QueryTypeRange QueryTypeSort QueryTypeAggregation QueryTypeExists QueryTypeWildcard QueryTypeFuzzy // Works like Match - needs text fields QueryTypeRegexp // Works on keyword/text, prefers keyword QueryTypeMatchPhrasePrefix // Works like Match - needs text fields QueryTypePrefix // Works on keyword fields )
type RolloverBuilder ¶
type RolloverBuilder struct {
// contains filtered or unexported fields
}
RolloverBuilder provides a fluent API for rollover operations
func NewRolloverBuilder ¶
func NewRolloverBuilder(ctx context.Context, alias string, processName string) *RolloverBuilder
NewRolloverBuilder creates a new rollover builder for the specified alias
func (*RolloverBuilder) Aliases ¶
func (b *RolloverBuilder) Aliases(aliases map[string]interface{}) *RolloverBuilder
Aliases sets custom aliases for the new index
func (*RolloverBuilder) Build ¶
func (b *RolloverBuilder) Build() (map[string]interface{}, error)
Build returns the rollover request body
func (*RolloverBuilder) DryRun ¶
func (b *RolloverBuilder) DryRun() *RolloverBuilder
DryRun enables dry run mode (check conditions without rolling over)
func (*RolloverBuilder) Execute ¶
func (b *RolloverBuilder) Execute() (*RolloverResult, error)
Execute performs the rollover operation
func (*RolloverBuilder) Mappings ¶
func (b *RolloverBuilder) Mappings(mappings map[string]interface{}) *RolloverBuilder
Mappings sets custom mappings for the new index
func (*RolloverBuilder) MaxAge ¶
func (b *RolloverBuilder) MaxAge(age string) *RolloverBuilder
MaxAge sets the maximum age condition
func (*RolloverBuilder) MaxDocs ¶
func (b *RolloverBuilder) MaxDocs(docs int64) *RolloverBuilder
MaxDocs sets the maximum document count condition
func (*RolloverBuilder) MaxPrimaryShardDocs ¶
func (b *RolloverBuilder) MaxPrimaryShardDocs(docs int64) *RolloverBuilder
MaxPrimaryShardDocs sets the maximum primary shard document count condition
func (*RolloverBuilder) MaxPrimaryShardSize ¶
func (b *RolloverBuilder) MaxPrimaryShardSize(size string) *RolloverBuilder
MaxPrimaryShardSize sets the maximum primary shard size condition
func (*RolloverBuilder) MaxSize ¶
func (b *RolloverBuilder) MaxSize(size string) *RolloverBuilder
MaxSize sets the maximum index size condition
func (*RolloverBuilder) MinAge ¶
func (b *RolloverBuilder) MinAge(age string) *RolloverBuilder
MinAge sets the minimum age condition
func (*RolloverBuilder) MinDocs ¶
func (b *RolloverBuilder) MinDocs(docs int64) *RolloverBuilder
MinDocs sets the minimum document count condition
func (*RolloverBuilder) MinPrimaryShardDocs ¶
func (b *RolloverBuilder) MinPrimaryShardDocs(docs int64) *RolloverBuilder
MinPrimaryShardDocs sets the minimum primary shard document count condition
func (*RolloverBuilder) MinPrimaryShardSize ¶
func (b *RolloverBuilder) MinPrimaryShardSize(size string) *RolloverBuilder
MinPrimaryShardSize sets the minimum primary shard size condition
func (*RolloverBuilder) MinSize ¶
func (b *RolloverBuilder) MinSize(size string) *RolloverBuilder
MinSize sets the minimum index size condition
func (*RolloverBuilder) NewIndexName ¶
func (b *RolloverBuilder) NewIndexName(name string) *RolloverBuilder
NewIndexName sets a custom name for the new index
func (*RolloverBuilder) Settings ¶
func (b *RolloverBuilder) Settings(settings map[string]interface{}) *RolloverBuilder
Settings sets custom settings for the new index
type RolloverConditions ¶
type RolloverConditions struct {
MaxAge string `json:"max_age,omitempty"`
MaxDocs int64 `json:"max_docs,omitempty"`
MaxSize string `json:"max_size,omitempty"`
MaxPrimaryShardSize string `json:"max_primary_shard_size,omitempty"`
MaxPrimaryShardDocs int64 `json:"max_primary_shard_docs,omitempty"`
MinAge string `json:"min_age,omitempty"`
MinDocs int64 `json:"min_docs,omitempty"`
MinSize string `json:"min_size,omitempty"`
MinPrimaryShardSize string `json:"min_primary_shard_size,omitempty"`
MinPrimaryShardDocs int64 `json:"min_primary_shard_docs,omitempty"`
}
RolloverConditions represents conditions for triggering a rollover
type RolloverResult ¶
type RolloverResult struct {
OldIndex string `json:"old_index"`
NewIndex string `json:"new_index"`
RolledOver bool `json:"rolled_over"`
DryRun bool `json:"dry_run"`
Acknowledged bool `json:"acknowledged"`
ShardsAcknowledged bool `json:"shards_acknowledged"`
Conditions map[string]bool `json:"conditions"`
}
RolloverResult represents the result of a rollover operation
func CheckRolloverConditions ¶
func CheckRolloverConditions(ctx context.Context, alias, processName string, conditions RolloverConditions) (*RolloverResult, error)
CheckRolloverConditions checks if rollover conditions are met without rolling over
func ForceRollover ¶
func ForceRollover(ctx context.Context, alias, processName string) (*RolloverResult, error)
ForceRollover performs an unconditional rollover (no conditions)
type SearchRequest ¶
type SearchRequest struct {
Version bool `json:"version,omitempty"`
From int64 `json:"from,omitempty"`
Size int64 `json:"size"`
Sort []map[string]map[string]interface{} `json:"sort,omitempty"`
StoredFields []string `json:"stored_fields,omitempty"`
Source *Source `json:"_source,omitempty"`
Query *Query `json:"query,omitempty"`
Collapse *Collapse `json:"collapse,omitempty"`
Aggs map[string]Aggs `json:"aggs,omitempty"`
SearchAfter []any `json:"search_after,omitempty"`
ScriptFields interface{} `json:"script_fields,omitempty"`
}
SearchRequest represents an OpenSearch search request body.
func (SearchRequest) SearchIn ¶
func (q SearchRequest) SearchIn(ctx context.Context, index []string, groups []string) (SearchResult, error)
SearchIn executes a search with automatic visibleBy.keyword filtering based on provided groups. It enforces group-based access control by filtering documents that are visible to the specified groups. Use this for user-facing queries that require access control. It returns a SearchResult and an error, if any.
func (SearchRequest) WideSearchIn ¶
func (q SearchRequest) WideSearchIn(ctx context.Context, index []string) (SearchResult, error)
WideSearchIn executes a search without access control filtering. Use this for admin or system operations that don't require group-based filtering. It returns a SearchResult and an error, if any.
type SearchResult ¶
type SearchResult struct {
Took int64 `json:"took"`
TimedOut bool `json:"timed_out"`
Shards Shards `json:"_shards"`
Hits Hits `json:"hits"`
Aggregations map[string]interface{} `json:"aggregations"`
}
SearchResult represents the response from an OpenSearch search query.
type SearchResultRaw ¶
SearchResultRaw represents raw search results
type SerialDiff ¶
type SerialDiff struct {
Lag int `json:"lag,omitempty"`
PipelineAgg
}
type Shards ¶
type Shards struct {
Total int64 `json:"total"`
Successful int64 `json:"successful"`
Skipped int64 `json:"skipped"`
Failed int64 `json:"failed"`
}
Shards contain information about the shards involved in the search.
type SimpleQueryString ¶
type SimpleQueryString struct {
Query string `json:"query,omitempty"`
Fields []string `json:"fields,omitempty"`
Flags string `json:"flags,omitempty"`
FuzzyTranspositions bool `json:"fuzzy_transpositions,omitempty"`
FuzzyMaxExpansions int64 `json:"fuzzy_max_expansions,omitempty"`
FuzzyPrefixLength int64 `json:"fuzzy_prefix_length,omitempty"`
MinimumShouldMatch int64 `json:"minimum_should_match,omitempty"`
DefaultOperator string `json:"default_operator,omitempty"`
Analyzer string `json:"analyzer,omitempty"`
Lenient bool `json:"lenient,omitempty"`
QuoteFieldSuffix string `json:"quote_field_suffix,omitempty"`
AnalyzeWildcard bool `json:"analyze_wildcard,omitempty"`
AutoGenerateSynonymsPhraseQuery bool `json:"auto_generate_synonyms_phrase_query,omitempty"`
}
type Source ¶
type Source struct {
Includes []string `json:"includes,omitempty"`
Excludes []string `json:"excludes,omitempty"`
}
Source specifies which fields to include or exclude from the _source in results.
type TemplateAliasConfig ¶
type TemplateAliasConfig struct {
Filter map[string]interface{} `json:"filter,omitempty"`
IndexRouting string `json:"index_routing,omitempty"`
SearchRouting string `json:"search_routing,omitempty"`
Routing string `json:"routing,omitempty"`
IsWriteIndex *bool `json:"is_write_index,omitempty"`
IsHidden *bool `json:"is_hidden,omitempty"`
}
TemplateAliasConfig represents alias configuration in a template
type TemplateBuilder ¶
type TemplateBuilder struct {
// contains filtered or unexported fields
}
TemplateBuilder provides a fluent API for creating index templates
func NewTemplateBuilder ¶
func NewTemplateBuilder(ctx context.Context, name string) *TemplateBuilder
NewTemplateBuilder creates a new template builder
func (*TemplateBuilder) AddDateField ¶
func (b *TemplateBuilder) AddDateField(name string, format string) *TemplateBuilder
AddDateField adds a date field with optional format
func (*TemplateBuilder) AddField ¶
func (b *TemplateBuilder) AddField(name string, fieldType string) *TemplateBuilder
AddField adds a field to the mapping
func (*TemplateBuilder) AddKNNVectorField ¶
func (b *TemplateBuilder) AddKNNVectorField(name string, dimension int, method *KNNMethod) *TemplateBuilder
AddKNNVectorField adds a k-NN vector field
func (*TemplateBuilder) AddKeywordField ¶
func (b *TemplateBuilder) AddKeywordField(name string) *TemplateBuilder
AddKeywordField adds a keyword field
func (*TemplateBuilder) AddNestedField ¶
func (b *TemplateBuilder) AddNestedField(name string, properties map[string]interface{}) *TemplateBuilder
AddNestedField adds a nested field with properties
func (*TemplateBuilder) AddTextField ¶
func (b *TemplateBuilder) AddTextField(name string, analyzer string) *TemplateBuilder
AddTextField adds a text field with optional analyzer
func (*TemplateBuilder) Alias ¶
func (b *TemplateBuilder) Alias(alias string) *TemplateBuilder
Alias adds an alias to the template
func (*TemplateBuilder) AliasWithConfig ¶
func (b *TemplateBuilder) AliasWithConfig(alias string, config TemplateAliasConfig) *TemplateBuilder
AliasWithConfig adds an alias with full configuration
func (*TemplateBuilder) Build ¶
func (b *TemplateBuilder) Build() (IndexTemplate, error)
Build returns the index template request body
func (*TemplateBuilder) BuildWithErrors ¶
func (b *TemplateBuilder) BuildWithErrors() (IndexTemplate, []error)
BuildWithErrors returns the template and any accumulated errors
func (*TemplateBuilder) ComposedOf ¶
func (b *TemplateBuilder) ComposedOf(components ...string) *TemplateBuilder
ComposedOf sets the component templates to compose from
func (*TemplateBuilder) CustomSetting ¶
func (b *TemplateBuilder) CustomSetting(key string, value interface{}) *TemplateBuilder
CustomSetting sets a custom setting
func (*TemplateBuilder) DynamicMapping ¶
func (b *TemplateBuilder) DynamicMapping(dynamic string) *TemplateBuilder
DynamicMapping sets the dynamic mapping mode
func (*TemplateBuilder) EnableKNN ¶
func (b *TemplateBuilder) EnableKNN() *TemplateBuilder
EnableKNN enables k-NN support for the template
func (*TemplateBuilder) Ensure ¶
func (b *TemplateBuilder) Ensure() error
Ensure creates or updates the index template (idempotent)
func (*TemplateBuilder) IndexPatterns ¶
func (b *TemplateBuilder) IndexPatterns(patterns ...string) *TemplateBuilder
IndexPatterns sets the index patterns this template applies to
func (*TemplateBuilder) KNNAlgoParamEFSearch ¶
func (b *TemplateBuilder) KNNAlgoParamEFSearch(ef int) *TemplateBuilder
KNNAlgoParamEFSearch sets the ef_search parameter for k-NN
func (*TemplateBuilder) Mapping ¶
func (b *TemplateBuilder) Mapping(properties map[string]interface{}) *TemplateBuilder
Mapping sets the full mappings object
func (*TemplateBuilder) Meta ¶
func (b *TemplateBuilder) Meta(meta map[string]interface{}) *TemplateBuilder
Meta sets template metadata
func (*TemplateBuilder) Priority ¶
func (b *TemplateBuilder) Priority(priority int) *TemplateBuilder
Priority sets the template priority (higher = more important)
func (*TemplateBuilder) RefreshInterval ¶
func (b *TemplateBuilder) RefreshInterval(interval string) *TemplateBuilder
RefreshInterval sets the refresh interval
func (*TemplateBuilder) Replicas ¶
func (b *TemplateBuilder) Replicas(n int) *TemplateBuilder
Replicas sets the number of replica shards
func (*TemplateBuilder) Settings ¶
func (b *TemplateBuilder) Settings(settings map[string]interface{}) *TemplateBuilder
Settings sets custom index settings
func (*TemplateBuilder) Shards ¶
func (b *TemplateBuilder) Shards(n int) *TemplateBuilder
Shards sets the number of primary shards
func (*TemplateBuilder) Version ¶
func (b *TemplateBuilder) Version(version int64) *TemplateBuilder
Version sets the template version
func (*TemplateBuilder) WriteAlias ¶
func (b *TemplateBuilder) WriteAlias(alias string) *TemplateBuilder
WriteAlias adds an alias as the write index
type TemplateContent ¶
type TemplateContent struct {
Settings map[string]interface{} `json:"settings,omitempty"`
Mappings map[string]interface{} `json:"mappings,omitempty"`
Aliases map[string]TemplateAliasConfig `json:"aliases,omitempty"`
}
TemplateContent represents the template content (settings, mappings, aliases)
Source Files
¶
- alias_builder.go
- builder.go
- builder_bool.go
- builder_helpers.go
- bulk_operations.go
- bulk_queue.go
- bulk_types.go
- bulk_worker.go
- delete.go
- document.go
- field_types.go
- ilm_builder.go
- index.go
- index_builder.go
- index_management.go
- indices.go
- mapping.go
- ml_inference.go
- ml_model.go
- opensearch.go
- rollover_builder.go
- schema.go
- search.go
- source.go
- template_builder.go
- update.go