elasticsearch: always use fixed_interval (#50297)
This commit is contained in:
@@ -145,7 +145,7 @@ func TestClient_ExecuteMultisearch(t *testing.T) {
|
||||
|
||||
assert.Equal(t, "15000*@hostname", jBody.GetPath("aggs", "2", "aggs", "1", "avg", "script").MustString())
|
||||
|
||||
assert.Equal(t, "15s", jBody.GetPath("aggs", "2", "date_histogram", "interval").MustString())
|
||||
assert.Equal(t, "15s", jBody.GetPath("aggs", "2", "date_histogram", "fixed_interval").MustString())
|
||||
|
||||
assert.Equal(t, 200, res.Status)
|
||||
require.Len(t, res.Responses, 1)
|
||||
@@ -197,7 +197,7 @@ func TestClient_ExecuteMultisearch(t *testing.T) {
|
||||
|
||||
assert.Equal(t, "15000*@hostname", jBody.GetPath("aggs", "2", "aggs", "1", "avg", "script").MustString())
|
||||
|
||||
assert.Equal(t, "15s", jBody.GetPath("aggs", "2", "date_histogram", "interval").MustString())
|
||||
assert.Equal(t, "15s", jBody.GetPath("aggs", "2", "date_histogram", "fixed_interval").MustString())
|
||||
|
||||
assert.Equal(t, 200, res.Status)
|
||||
require.Len(t, res.Responses, 1)
|
||||
@@ -252,7 +252,7 @@ func TestClient_ExecuteMultisearch(t *testing.T) {
|
||||
|
||||
assert.Equal(t, "15000*@hostname", jBody.GetPath("aggs", "2", "aggs", "1", "avg", "script").MustString())
|
||||
|
||||
assert.Equal(t, "15s", jBody.GetPath("aggs", "2", "date_histogram", "interval").MustString())
|
||||
assert.Equal(t, "15s", jBody.GetPath("aggs", "2", "date_histogram", "fixed_interval").MustString())
|
||||
|
||||
assert.Equal(t, 200, res.Status)
|
||||
require.Len(t, res.Responses, 1)
|
||||
@@ -308,7 +308,7 @@ func TestClient_ExecuteMultisearch(t *testing.T) {
|
||||
|
||||
assert.Equal(t, "15000*@hostname", jBody.GetPath("aggs", "2", "aggs", "1", "avg", "script").MustString())
|
||||
|
||||
assert.Equal(t, "15s", jBody.GetPath("aggs", "2", "date_histogram", "interval").MustString())
|
||||
assert.Equal(t, "15s", jBody.GetPath("aggs", "2", "date_histogram", "fixed_interval").MustString())
|
||||
|
||||
assert.Equal(t, 200, res.Status)
|
||||
require.Len(t, res.Responses, 1)
|
||||
@@ -321,7 +321,7 @@ func createMultisearchForTest(t *testing.T, c Client) (*MultiSearchRequest, erro
|
||||
msb := c.MultiSearch()
|
||||
s := msb.Search(intervalv2.Interval{Value: 15 * time.Second, Text: "15s"})
|
||||
s.Agg().DateHistogram("2", "@timestamp", func(a *DateHistogramAgg, ab AggBuilder) {
|
||||
a.Interval = "$__interval"
|
||||
a.FixedInterval = "$__interval"
|
||||
|
||||
ab.Metric("1", "avg", "@hostname", func(a *MetricAggregation) {
|
||||
a.Settings["script"] = "$__interval_ms*@hostname"
|
||||
|
||||
@@ -238,7 +238,6 @@ type HistogramAgg struct {
|
||||
// DateHistogramAgg represents a date histogram aggregation
|
||||
type DateHistogramAgg struct {
|
||||
Field string `json:"field"`
|
||||
Interval string `json:"interval,omitempty"`
|
||||
FixedInterval string `json:"fixed_interval,omitempty"`
|
||||
MinDocCount int `json:"min_doc_count"`
|
||||
Missing *string `json:"missing,omitempty"`
|
||||
|
||||
@@ -342,11 +342,6 @@ func (b *aggBuilderImpl) DateHistogram(key, field string, fn func(a *DateHistogr
|
||||
fn(innerAgg, builder)
|
||||
}
|
||||
|
||||
if b.version.Major() >= 8 {
|
||||
innerAgg.FixedInterval = innerAgg.Interval
|
||||
innerAgg.Interval = ""
|
||||
}
|
||||
|
||||
b.aggDefs = append(b.aggDefs, aggDef)
|
||||
|
||||
return b
|
||||
|
||||
Reference in New Issue
Block a user