arelastic 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eecf4e946c5a80dbd67b631bc501c709f7f675a5cdf361fd1ca70720316e988f
4
- data.tar.gz: 8cdb5255aabd05b3cebfbdaa2b14ee4bda3ed92f35165a6d6d263b823b1b6e79
3
+ metadata.gz: 6308932a33e5083eb069d534b87c865b2d56703d5fd4f52ccfc623d38a37055a
4
+ data.tar.gz: 432adb718ff25ed590a4a454cf8ca72476a1504bf205882a581a064cf47c5799
5
5
  SHA512:
6
- metadata.gz: 7be8e99832a66885f1a073b6001dc845d7a9ce1908376c9b4ca367715a18fc0353b89e7122a4c2e2e001322ad37fd25677396ebbd05af796e23b79a54f765a48
7
- data.tar.gz: 57dcd466e35b9531536dd3b9e6ec12e039f7843ae98faa19b0f1fdc342ae22ef8996afb537555ee85af6f77ba4bd58436e68bcf766d81903c2c28e166e351b15
6
+ metadata.gz: 2b5c0b9ea2d8d26cb89bb4b596f36ee2e044cae0a98e865c20fd98963cea0c123e8c5d8d3fbd2dbba238f8c1fb58ed5fbf03910a43aeed1bb28130bf02b517c7
7
+ data.tar.gz: 79fe140cd2b5c83b560250b1625e9e6ded94f65fc24a99c342201a2fd02c81431edca1569fcb7429efbbcd4f2906cfc33b51dd5d1ab8c9c20c438f0d303f69f3
@@ -3,8 +3,10 @@ require 'arelastic/aggregations/bucket'
3
3
 
4
4
  require 'arelastic/aggregations/date_histogram'
5
5
  require 'arelastic/aggregations/filter'
6
+ require 'arelastic/aggregations/histogram'
6
7
  require 'arelastic/aggregations/min'
7
8
  require 'arelastic/aggregations/nested'
9
+ require 'arelastic/aggregations/range'
8
10
  require 'arelastic/aggregations/reverse_nested'
9
11
  require 'arelastic/aggregations/sampler'
10
12
  require 'arelastic/aggregations/terms'
@@ -0,0 +1,9 @@
1
+ module Arelastic
2
+ module Aggregations
3
+ class Range < Arelastic::Aggregations::Bucket
4
+ def as_elastic_aggregation
5
+ {'range' => options}.merge(super)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,25 @@
1
+ require 'helper'
2
+
3
+ class Arelastic::Aggregations::RangeTest < Minitest::Test
4
+ def test_as_elastic
5
+ aggregation = Arelastic::Aggregations::Range.new('foo', 'field' => 'price', 'ranges' => [
6
+ { 'to' => 100 },
7
+ { 'from' => 100, 'to' => 200 },
8
+ { 'from' => 200 }
9
+ ])
10
+
11
+ expected = {
12
+ "foo" => {
13
+ "range" => {
14
+ "field" => "price",
15
+ "ranges" => [
16
+ {"to"=>100},
17
+ {"from"=>100,"to"=>200},
18
+ {"from"=>200}
19
+ ]
20
+ }
21
+ }
22
+ }
23
+ assert_equal expected, aggregation.as_elastic
24
+ end
25
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arelastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Higgins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-21 00:00:00.000000000 Z
11
+ date: 2018-05-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Build Elastic Search queries with objects
14
14
  email: developer@matthewhiggins.com
@@ -27,6 +27,7 @@ files:
27
27
  - lib/arelastic/aggregations/histogram.rb
28
28
  - lib/arelastic/aggregations/min.rb
29
29
  - lib/arelastic/aggregations/nested.rb
30
+ - lib/arelastic/aggregations/range.rb
30
31
  - lib/arelastic/aggregations/reverse_nested.rb
31
32
  - lib/arelastic/aggregations/sampler.rb
32
33
  - lib/arelastic/aggregations/terms.rb
@@ -100,6 +101,7 @@ files:
100
101
  - test/arelastic/aggregations/date_histogram_test.rb
101
102
  - test/arelastic/aggregations/filter_test.rb
102
103
  - test/arelastic/aggregations/nested_test.rb
104
+ - test/arelastic/aggregations/range_test.rb
103
105
  - test/arelastic/aggregations/reverse_nested_test.rb
104
106
  - test/arelastic/aggregations/sampler_test.rb
105
107
  - test/arelastic/aggregations/terms_test.rb