Versions in this module Expand all Collapse all v0 v0.5.0 Apr 25, 2023 Changes in this version type BulkRequest + ParseResponseItemsOnlyOnFailure bool type SearchRequest + From int + func (r *SearchRequest) WithFrom(n int) *SearchRequest v0.4.0 Mar 23, 2023 Changes in this version + type NestedQuery struct + func NewNestedQuery(path string, query Query) *NestedQuery + func (q *NestedQuery) ToOpenSearchJSON() ([]byte, error) v0.3.0 Mar 16, 2023 Changes in this version type ValidationResults + func (vrs *ValidationResults) Len() int v0.2.0 Mar 16, 2023 Changes in this version + type PercentilesAggregationResult struct + P1 *float64 + P1String string + P25 *float64 + P25String string + P5 *float64 + P50 *float64 + P50String string + P5String string + P75 *float64 + P75String string + P95 *float64 + P95String string + P99 *float64 + P99String string + func (p *PercentilesAggregationResult) UnmarshalJSON(b []byte) error v0.1.0 Mar 9, 2023 Changes in this version + const AverageAggregation + const CardinalityAggregation + const MaximumAggregation + const MinimumAggregation + const SumAggregation + func ConvertSubAggregations(bucketAgg BucketAggregation, converter AggregateVersionConverter) (map[string]Aggregation, error) + func ReadAggregationResult(name string, aggResponse R, subAggResponse P) (error, bool) + func ReadDocument(docResult R, document P) error + type ActionError struct + Index string + IndexUUID string + Reason string + Shard string + Type string + type ActionResponse struct + Error *ActionError + ID string + Index string + PrimaryTerm uint64 + Result string + SeqNo uint64 + Shards *ShardMeta + Status int + Type string + Version uint64 + func (o *ActionResponse) UnmarshalJSON(m []byte) error + type AggregateVersionConverter func(Aggregation) (Aggregation, error) + type Aggregation interface + ToOpenSearchJSON func() ([]byte, error) + Validate func() ValidationResults + type AggregationResultSet interface + GetAggregationResultSource func(name string) ([]byte, bool) + Keys func() []string + type BoolQuery struct + func NewBoolQuery() *BoolQuery + func (q *BoolQuery) Filter(queries ...Query) *BoolQuery + func (q *BoolQuery) MinimumShouldMatch(n int) *BoolQuery + func (q *BoolQuery) Must(queries ...Query) *BoolQuery + func (q *BoolQuery) MustNot(queries ...Query) *BoolQuery + func (q *BoolQuery) Should(queries ...Query) *BoolQuery + func (q *BoolQuery) ToOpenSearchJSON() ([]byte, error) + type BucketAggregation interface + AddSubAggregation func(name string, agg Aggregation) BucketAggregation + SubAggregations func() map[string]Aggregation + type BucketSortAggregation struct + From int + Size int + Sort []sort + func NewBucketSortAggregation() *BucketSortAggregation + func (b *BucketSortAggregation) AddSort(field string, isDesc bool) *BucketSortAggregation + func (b *BucketSortAggregation) ToOpenSearchJSON() ([]byte, error) + func (b *BucketSortAggregation) Validate() ValidationResults + func (b *BucketSortAggregation) WithFrom(from int) *BucketSortAggregation + func (b *BucketSortAggregation) WithSize(size int) *BucketSortAggregation + type Bulk interface + Bulk func(ctx context.Context, req *BulkRequest) (OpenSearchResponse[BulkResponse], error) + type BulkAction struct + Doc RoutableDoc + Type BulkActionType + func NewCreateBulkAction(doc RoutableDoc) BulkAction + func NewDeleteBulkAction(index, id string) BulkAction + func NewIndexBulkAction(doc RoutableDoc) BulkAction + func NewUpdateBulkAction(doc RoutableDoc) BulkAction + func (b *BulkAction) MarshalJSONLines() ([][]byte, error) + type BulkActionType string + const BulkCreate + const BulkDelete + const BulkIndex + const BulkUpdate + type BulkRequest struct + Actions []BulkAction + Index string + Refresh Refresh + func NewBulkRequest() *BulkRequest + func (r *BulkRequest) Add(actions ...BulkAction) *BulkRequest + func (r *BulkRequest) WithIndex(index string) *BulkRequest + type BulkResponse struct + Error *Error + Errors bool + Items []ActionResponse + Took int64 + type DateHistogramAggregation struct + Aggregations map[string]Aggregation + Field string + Interval string + MinDocCount int64 + Order []Order + TimeZone string + func NewDateHistogramAggregation(field, interval string) *DateHistogramAggregation + func (d *DateHistogramAggregation) AddOrder(orders ...Order) *DateHistogramAggregation + func (d *DateHistogramAggregation) AddSubAggregation(name string, agg Aggregation) BucketAggregation + func (d *DateHistogramAggregation) SubAggregations() map[string]Aggregation + func (d *DateHistogramAggregation) ToOpenSearchJSON() ([]byte, error) + func (d *DateHistogramAggregation) Validate() ValidationResults + func (d *DateHistogramAggregation) WithMinDocCount(minCount int64) *DateHistogramAggregation + func (d *DateHistogramAggregation) WithTimeZone(tz string) *DateHistogramAggregation + type DateHistogramAggregationResults struct + Buckets []DateHistogramBucketResult + func (d *DateHistogramAggregationResults) UnmarshalJSON(m []byte) error + type DateHistogramBucketResult struct + DocCount int64 + Key int64 + KeyString string + SubAggregationResults map[string]json.RawMessage + func (d *DateHistogramBucketResult) GetAggregationResultSource(name string) ([]byte, bool) + func (d *DateHistogramBucketResult) Keys() []string + func (d *DateHistogramBucketResult) UnmarshalJSON(m []byte) error + type DateRangeAggregation struct + Aggregations map[string]Aggregation + Field string + Format string + Ranges []Range + func NewDateRangeAggregation(field string) *DateRangeAggregation + func (dr *DateRangeAggregation) AddKeyedRange(key string, from, to any) *DateRangeAggregation + func (dr *DateRangeAggregation) AddRange(from, to any) *DateRangeAggregation + func (dr *DateRangeAggregation) AddRanges(ranges ...Range) *DateRangeAggregation + func (dr *DateRangeAggregation) AddSubAggregation(name string, agg Aggregation) BucketAggregation + func (dr *DateRangeAggregation) SubAggregations() map[string]Aggregation + func (dr *DateRangeAggregation) ToOpenSearchJSON() ([]byte, error) + func (dr *DateRangeAggregation) Validate() ValidationResults + func (dr *DateRangeAggregation) WithFormat(format string) *DateRangeAggregation + type DateRangeAggregationResults struct + Buckets []RangeBucketResult + type DocumentRef struct + func NewDocumentRef(index, id string) DocumentRef + func (d DocumentRef) ID() string + func (d DocumentRef) Index() string + type DocumentResult interface + GetSource func() []byte + type Error struct + Index string + IndexUUID string + Reason string + ResourceID string + ResourceType string + RootCause []Error + Type string + type ExistsQuery struct + func NewExistsQuery(field string) *ExistsQuery + func (q *ExistsQuery) ToOpenSearchJSON() ([]byte, error) + type FilterAggregation struct + Aggregations map[string]Aggregation + Filter Query + func NewFilterAggregation(filter Query) *FilterAggregation + func (f *FilterAggregation) AddSubAggregation(name string, agg Aggregation) BucketAggregation + func (f *FilterAggregation) SubAggregations() map[string]Aggregation + func (f *FilterAggregation) ToOpenSearchJSON() ([]byte, error) + func (f *FilterAggregation) Validate() ValidationResults + type FilterAggregationResults struct + DocCount uint64 + SubAggregationResults map[string]json.RawMessage + func (f *FilterAggregationResults) GetAggregationResultSource(name string) ([]byte, bool) + func (f *FilterAggregationResults) Keys() []string + func (f *FilterAggregationResults) UnmarshalJSON(m []byte) error + type Hit struct + ID string + Index string + Score float64 + Source json.RawMessage + func (h Hit) GetSource() []byte + type Hits struct + Hits []Hit + MaxScore float64 + Total Total + type MGet interface + MGet func(ctx context.Context, req *MGetRequest) (OpenSearchResponse[MGetResponse], error) + type MGetRequest struct + Docs []RoutableDoc + Index string + func NewMGetRequest() *MGetRequest + func (m *MGetRequest) Add(index, id string) *MGetRequest + func (m *MGetRequest) AddDocs(docs ...RoutableDoc) *MGetRequest + func (m *MGetRequest) WithIndex(index string) *MGetRequest + type MGetResponse struct + Docs []MGetResult + type MGetResult struct + Error error + Found bool + ID string + Index string + PrimaryTerm int + SeqNo int + Source json.RawMessage + Version int + func (m MGetResult) GetSource() []byte + type MatchAllQuery struct + func NewMatchAllQuery() *MatchAllQuery + func (q *MatchAllQuery) ToOpenSearchJSON() ([]byte, error) + type MatchPhraseQuery struct + func NewMatchPhraseQuery(field, phrase string) *MatchPhraseQuery + func (q *MatchPhraseQuery) ToOpenSearchJSON() ([]byte, error) + type MatchQuery struct + func NewMatchQuery(field, value string) *MatchQuery + func (q *MatchQuery) SetOperator(op string) *MatchQuery + func (q *MatchQuery) ToOpenSearchJSON() ([]byte, error) + type OpenSearchResponse struct + Header http.Header + Response T + StatusCode int + ValidationResults ValidationResults + func NewOpenSearchResponse(vrs ValidationResults, statusCode int, header http.Header, response T) OpenSearchResponse[T] + type Order struct + Desc bool + Target string + func NewOrder(field string, desc bool) Order + func (o Order) ToOpenSearchJSON() ([]byte, error) + type PercentileAggregationResult struct + P1 *float64 + P1String string + P25 *float64 + P25String string + P5 *float64 + P50 *float64 + P50String string + P5String string + P75 *float64 + P75String string + P95 *float64 + P95String string + P99 *float64 + P99String string + type PercentilesAggregation struct + Field string + func NewPercentileAggregation(field string) *PercentilesAggregation + func (p *PercentilesAggregation) ToOpenSearchJSON() ([]byte, error) + func (p *PercentilesAggregation) Validate() ValidationResults + type PrefixQuery struct + func NewPrefixQuery(field string, value any) *PrefixQuery + func (q *PrefixQuery) ToOpenSearchJSON() ([]byte, error) + type PtrTo interface + type Query interface + ToOpenSearchJSON func() ([]byte, error) + func BoolQueryConverter(boolQuery *BoolQuery, converter QueryVersionConverter) (Query, error) + type QueryVersionConverter func(Query) (Query, error) + type Range struct + From any + Key string + To any + type RangeAggregation struct + Aggregations map[string]Aggregation + Field string + Ranges []Range + func NewRangeAggregation(field string) *RangeAggregation + func (r *RangeAggregation) AddKeyedRange(key string, from, to any) *RangeAggregation + func (r *RangeAggregation) AddRange(from, to any) *RangeAggregation + func (r *RangeAggregation) AddRanges(ranges ...Range) *RangeAggregation + func (r *RangeAggregation) AddSubAggregation(name string, agg Aggregation) BucketAggregation + func (r *RangeAggregation) SubAggregations() map[string]Aggregation + func (r *RangeAggregation) ToOpenSearchJSON() ([]byte, error) + func (r *RangeAggregation) Validate() ValidationResults + type RangeAggregationResults struct + Buckets []RangeBucketResult + type RangeBucketResult struct + DocCount int64 + From any + FromString string + Key string + SubAggregationResults map[string]json.RawMessage + To any + ToString string + func (r *RangeBucketResult) GetAggregationResultSource(name string) ([]byte, bool) + func (r *RangeBucketResult) Keys() []string + func (r *RangeBucketResult) UnmarshalJSON(m []byte) error + type RangeQuery struct + func NewRangeQuery(field string) *RangeQuery + func (q *RangeQuery) Gt(value any) *RangeQuery + func (q *RangeQuery) Gte(value any) *RangeQuery + func (q *RangeQuery) Lt(value any) *RangeQuery + func (q *RangeQuery) Lte(value any) *RangeQuery + func (q *RangeQuery) ToOpenSearchJSON() ([]byte, error) + type Refresh string + const False + const True + const WaitFor + type RegexQuery struct + func NewRegexQuery(field, regex string) *RegexQuery + func (q *RegexQuery) ToOpenSearchJSON() ([]byte, error) + type RoutableDoc interface + ID func() string + Index func() string + type Search interface + Search func(ctx context.Context, req *SearchRequest) (OpenSearchResponse[SearchResponse], error) + type SearchRequest struct + Aggregations map[string]Aggregation + Index []string + Query Query + Routing []string + Size int + Sort []Sort + TrackTotalHits any + func NewSearchRequest() *SearchRequest + func (r *SearchRequest) AddAggregation(name string, agg Aggregation) *SearchRequest + func (r *SearchRequest) AddIndices(indices ...string) *SearchRequest + func (r *SearchRequest) AddSorts(sort ...Sort) *SearchRequest + func (r *SearchRequest) WithQuery(q Query) *SearchRequest + func (r *SearchRequest) WithRouting(routing ...string) *SearchRequest + func (r *SearchRequest) WithSize(n int) *SearchRequest + func (r *SearchRequest) WithTrackTotalHits(track any) *SearchRequest + type SearchResponse struct + Aggregations map[string]json.RawMessage + Error *Error + Hits Hits + Shards ShardMeta + TimedOut bool + Took int + func (sr SearchResponse) GetAggregationResultSource(name string) ([]byte, bool) + func (sr SearchResponse) Keys() []string + type ShardMeta struct + Failed int + Skipped int + Successful int + Total int + type SingleValueAggType string + type SingleValueAggregationResult struct + Value *float64 + ValueString string + type SingleValueMetricAggregation struct + Field string + Missing any + PrecisionThreshold int + Type SingleValueAggType + func NewAverageAggregation(field string) *SingleValueMetricAggregation + func NewCardinalityAggregation(field string) *SingleValueMetricAggregation + func NewMaximumAggregation(field string) *SingleValueMetricAggregation + func NewMinimumAggregation(field string) *SingleValueMetricAggregation + func NewSumAggregation(field string) *SingleValueMetricAggregation + func (s *SingleValueMetricAggregation) ToOpenSearchJSON() ([]byte, error) + func (s *SingleValueMetricAggregation) Validate() ValidationResults + func (s *SingleValueMetricAggregation) WithMissing(missing any) *SingleValueMetricAggregation + func (s *SingleValueMetricAggregation) WithPrecisionThreshold(p int) *SingleValueMetricAggregation + type Sort struct + Desc bool + Field string + func NewSort(field string, desc bool) Sort + func (s *Sort) ToOpenSearchJSON() ([]byte, error) + type TermBucketResult struct + DocCount int64 + Key string + SubAggregationResults map[string]json.RawMessage + func (t *TermBucketResult) GetAggregationResultSource(name string) ([]byte, bool) + func (t *TermBucketResult) Keys() []string + func (t *TermBucketResult) UnmarshalJSON(m []byte) error + type TermQuery struct + func NewTermQuery(field string, value any) *TermQuery + func (q *TermQuery) ToOpenSearchJSON() ([]byte, error) + type TermsAggregation struct + Aggregations map[string]Aggregation + Exclude string + ExcludeValues []string + Field string + Include string + IncludeValues []string + MinDocCount int64 + Missing string + Order []Order + Size int + func NewTermsAggregation(field string) *TermsAggregation + func (t *TermsAggregation) AddOrder(orders ...Order) *TermsAggregation + func (t *TermsAggregation) AddSubAggregation(name string, agg Aggregation) BucketAggregation + func (t *TermsAggregation) SubAggregations() map[string]Aggregation + func (t *TermsAggregation) ToOpenSearchJSON() ([]byte, error) + func (t *TermsAggregation) Validate() ValidationResults + func (t *TermsAggregation) WithExclude(exclude string) *TermsAggregation + func (t *TermsAggregation) WithExcludes(excludes []string) *TermsAggregation + func (t *TermsAggregation) WithInclude(include string) *TermsAggregation + func (t *TermsAggregation) WithIncludes(include []string) *TermsAggregation + func (t *TermsAggregation) WithMinDocCount(minCount int64) *TermsAggregation + func (t *TermsAggregation) WithMissing(missing string) *TermsAggregation + func (t *TermsAggregation) WithSize(size int) *TermsAggregation + type TermsAggregationResults struct + Buckets []TermBucketResult + DocCountErrorUpperBound int64 + SumOtherDocCount int64 + func (t *TermsAggregationResults) UnmarshalJSON(m []byte) error + type TermsQuery struct + func NewTermsQuery(field string, values ...any) *TermsQuery + func (q *TermsQuery) ToOpenSearchJSON() ([]byte, error) + type Total struct + Relation string + Value int64 + type ValidationError struct + ValidationResults ValidationResults + func NewValidationError(vrs ValidationResults) *ValidationError + func (e *ValidationError) Error() string + type ValidationResult struct + Fatal bool + Message string + func NewValidationResult(message string, fatal bool) ValidationResult + type ValidationResults struct + func NewValidationResults() ValidationResults + func ValidationResultsFromSlice(vrs []ValidationResult) ValidationResults + func (vrs *ValidationResults) Add(vr ValidationResult) + func (vrs *ValidationResults) Extend(other ValidationResults) + func (vrs *ValidationResults) IsFatal() bool + type Validator interface + Validate func() ValidationResults + type WildcardQuery struct + func NewWildcardQuery(field, value string) *WildcardQuery + func (q *WildcardQuery) ToOpenSearchJSON() ([]byte, error)