-
Notifications
You must be signed in to change notification settings - Fork 627
/
Copy pathautodatehistogramaggregation.go
141 lines (100 loc) · 4.04 KB
/
autodatehistogramaggregation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
// Code generated from the elasticsearch-specification DO NOT EDIT.
// https://github.com/elastic/elasticsearch-specification/tree/ea991724f4dd4f90c496eff547d3cc2e6529f509
package esdsl
import (
"encoding/json"
"github.com/elastic/go-elasticsearch/v8/typedapi/types"
"github.com/elastic/go-elasticsearch/v8/typedapi/types/enums/minimuminterval"
)
type _autoDateHistogramAggregation struct {
v *types.AutoDateHistogramAggregation
}
// A multi-bucket aggregation similar to the date histogram, except instead of
// providing an interval to use as the width of each bucket, a target number of
// buckets is provided.
func NewAutoDateHistogramAggregation() *_autoDateHistogramAggregation {
return &_autoDateHistogramAggregation{v: types.NewAutoDateHistogramAggregation()}
}
// The target number of buckets.
func (s *_autoDateHistogramAggregation) Buckets(buckets int) *_autoDateHistogramAggregation {
s.v.Buckets = &buckets
return s
}
// The field on which to run the aggregation.
func (s *_autoDateHistogramAggregation) Field(field string) *_autoDateHistogramAggregation {
s.v.Field = &field
return s
}
// The date format used to format `key_as_string` in the response.
// If no `format` is specified, the first date format specified in the field
// mapping is used.
func (s *_autoDateHistogramAggregation) Format(format string) *_autoDateHistogramAggregation {
s.v.Format = &format
return s
}
// The minimum rounding interval.
// This can make the collection process more efficient, as the aggregation will
// not attempt to round at any interval lower than `minimum_interval`.
func (s *_autoDateHistogramAggregation) MinimumInterval(minimuminterval minimuminterval.MinimumInterval) *_autoDateHistogramAggregation {
s.v.MinimumInterval = &minimuminterval
return s
}
// The value to apply to documents that do not have a value.
// By default, documents without a value are ignored.
func (s *_autoDateHistogramAggregation) Missing(datetime types.DateTimeVariant) *_autoDateHistogramAggregation {
s.v.Missing = *datetime.DateTimeCaster()
return s
}
// Time zone specified as a ISO 8601 UTC offset.
func (s *_autoDateHistogramAggregation) Offset(offset string) *_autoDateHistogramAggregation {
s.v.Offset = &offset
return s
}
func (s *_autoDateHistogramAggregation) Params(params map[string]json.RawMessage) *_autoDateHistogramAggregation {
s.v.Params = params
return s
}
func (s *_autoDateHistogramAggregation) AddParam(key string, value json.RawMessage) *_autoDateHistogramAggregation {
var tmp map[string]json.RawMessage
if s.v.Params == nil {
s.v.Params = make(map[string]json.RawMessage)
} else {
tmp = s.v.Params
}
tmp[key] = value
s.v.Params = tmp
return s
}
func (s *_autoDateHistogramAggregation) Script(script types.ScriptVariant) *_autoDateHistogramAggregation {
s.v.Script = script.ScriptCaster()
return s
}
// Time zone ID.
func (s *_autoDateHistogramAggregation) TimeZone(timezone string) *_autoDateHistogramAggregation {
s.v.TimeZone = &timezone
return s
}
func (s *_autoDateHistogramAggregation) AggregationsCaster() *types.Aggregations {
container := types.NewAggregations()
container.AutoDateHistogram = s.v
return container
}
func (s *_autoDateHistogramAggregation) AutoDateHistogramAggregationCaster() *types.AutoDateHistogramAggregation {
return s.v
}