Skip to content

Commit c4f562f

Browse files
committed
[DSL] Removes deprecated interval parameter
1 parent f7a8099 commit c4f562f

File tree

2 files changed

+5
-35
lines changed

2 files changed

+5
-35
lines changed

lib/elasticsearch/dsl/search/aggregations/date_histogram.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ module Aggregations
2626
#
2727
# search do
2828
# aggregation :daily do
29-
# field 'published_at'
30-
# interval 'day'
31-
# format 'yyyy-MM-dd'
29+
# field 'published_at'
30+
# calendar_interval 'day'
31+
# format 'yyyy-MM-dd'
3232
# end
3333
# end
3434
#
@@ -38,7 +38,6 @@ class DateHistogram
3838
include BaseAggregationComponent
3939

4040
option_method :field
41-
option_method :interval
4241
option_method :fixed_interval
4342
option_method :calendar_interval
4443
option_method :pre_zone

spec/elasticsearch/dsl/search/aggregations/date_histogram_spec.rb

+2-31
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,22 @@
1818
require 'spec_helper'
1919

2020
describe Elasticsearch::DSL::Search::Aggregations::DateHistogram do
21-
2221
let(:search) do
2322
described_class.new
2423
end
2524

2625
describe '#to_hash' do
27-
2826
it 'can be converted to a hash' do
2927
expect(search.to_hash).to eq(date_histogram: {})
3028
end
3129
end
3230

3331
context 'when options methods are called' do
34-
3532
let(:search) do
3633
described_class.new(:foo)
3734
end
3835

3936
describe '#field' do
40-
4137
before do
4238
search.field('bar')
4339
end
@@ -47,19 +43,7 @@
4743
end
4844
end
4945

50-
describe '#interval' do
51-
52-
before do
53-
search.interval('bar')
54-
end
55-
56-
it 'applies the option' do
57-
expect(search.to_hash[:date_histogram][:foo][:interval]).to eq('bar')
58-
end
59-
end
60-
6146
describe '#fixed_interval' do
62-
6347
before do
6448
search.fixed_interval('bar')
6549
end
@@ -70,7 +54,6 @@
7054
end
7155

7256
describe '#calendar_interval' do
73-
7457
before do
7558
search.calendar_interval('bar')
7659
end
@@ -81,7 +64,6 @@
8164
end
8265

8366
describe '#pre_zone' do
84-
8567
before do
8668
search.pre_zone('bar')
8769
end
@@ -92,7 +74,6 @@
9274
end
9375

9476
describe '#post_zone' do
95-
9677
before do
9778
search.post_zone('bar')
9879
end
@@ -103,7 +84,6 @@
10384
end
10485

10586
describe '#time_zone' do
106-
10787
before do
10888
search.time_zone('bar')
10989
end
@@ -114,7 +94,6 @@
11494
end
11595

11696
describe '#pre_zone_adjust_large_interval' do
117-
11897
before do
11998
search.pre_zone_adjust_large_interval('bar')
12099
end
@@ -125,7 +104,6 @@
125104
end
126105

127106
describe '#pre_offest' do
128-
129107
before do
130108
search.pre_offset('bar')
131109
end
@@ -136,7 +114,6 @@
136114
end
137115

138116
describe '#post_offset' do
139-
140117
before do
141118
search.post_offset('bar')
142119
end
@@ -147,7 +124,6 @@
147124
end
148125

149126
describe '#format' do
150-
151127
before do
152128
search.format('bar')
153129
end
@@ -158,7 +134,6 @@
158134
end
159135

160136
describe '#min_doc_count' do
161-
162137
before do
163138
search.min_doc_count('bar')
164139
end
@@ -169,7 +144,6 @@
169144
end
170145

171146
describe '#extended_bounds' do
172-
173147
before do
174148
search.extended_bounds('bar')
175149
end
@@ -180,7 +154,6 @@
180154
end
181155

182156
describe '#order' do
183-
184157
before do
185158
search.order('bar')
186159
end
@@ -192,19 +165,17 @@
192165
end
193166

194167
describe '#initialize' do
195-
196168
context 'when a block is provided' do
197-
198169
let(:search) do
199170
described_class.new do
200171
field 'bar'
201-
interval 'day'
172+
calendar_interval 'day'
202173
format 'yyyy-MM-dd'
203174
end
204175
end
205176

206177
it 'executes the block' do
207-
expect(search.to_hash).to eq(date_histogram: { field: 'bar', interval: 'day', format: 'yyyy-MM-dd' })
178+
expect(search.to_hash).to eq(date_histogram: { field: 'bar', calendar_interval: 'day', format: 'yyyy-MM-dd' })
208179
end
209180
end
210181
end

0 commit comments

Comments
 (0)