arelastic 3.3.0 → 3.4.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: dbe2ab978160bb5c51def73c61c913c93582c675ce467caaa239a0967715826d
4
- data.tar.gz: 4c0b18e7f5767acd373940f3eff5e1e4b676c1f4a6a08766b465f025c5f09f0c
3
+ metadata.gz: d8edfdb17e46c6148893fd8ae238a07c4743359a9c5e4955b424649727196ff8
4
+ data.tar.gz: 3c5c40a1d08cbf850a096b0d72b675c4d63e692d9b55d0b123792e68904a1aa9
5
5
  SHA512:
6
- metadata.gz: 36dd4ea278ccb16d0ffe3cc81d1c737fce8f76d25b5157a617cc2ca60b8ab5dfa02dbcad30f9ca634f343fb5f6bccc33e6050a0974602167614b193903c89b0a
7
- data.tar.gz: 2e9c34a9603a8de8ea28a0e353f82014e5a1bed58ea0954769c104df550c56ba6dfc21a7e239295f5c15266ccc3ca434e242f9e9df6a376cd00fbe3ceae54582
6
+ metadata.gz: eb01a6abd4f16c130a8759a53d40582698221b11e58178ec49297be9cacf03e87bc2cd666a1076480b65a264968b1ef539d9888aaa3416ad4474617f98de5613
7
+ data.tar.gz: 20ae0b0240d1b2d439b08d6dbb38576687f7a5d3c2c5bc4bafb018625f5f35b6662e0fd9f62e45b9264ace1c8164ab4e71f68e696100509ccbff83b14af79e26
@@ -0,0 +1,13 @@
1
+ module Arelastic
2
+ module Aggregations
3
+ class Children < Arelastic::Aggregations::SpecialSingleBucket
4
+ def aggregation_name
5
+ 'children'
6
+ end
7
+
8
+ def specification_key
9
+ 'type'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,15 +1,12 @@
1
1
  module Arelastic
2
2
  module Aggregations
3
- class Nested < Arelastic::Aggregations::Bucket
4
- attr_accessor :path
5
-
6
- def initialize(name, path, aggs)
7
- super name, aggs: aggs
8
- @path = path
3
+ class Nested < Arelastic::Aggregations::SpecialSingleBucket
4
+ def aggregation_name
5
+ 'nested'
9
6
  end
10
7
 
11
- def as_elastic_aggregation
12
- {"nested" => { "path" => path }}.merge(super)
8
+ def specification_key
9
+ 'path'
13
10
  end
14
11
  end
15
12
  end
@@ -0,0 +1,13 @@
1
+ module Arelastic
2
+ module Aggregations
3
+ class Parent < Arelastic::Aggregations::SpecialSingleBucket
4
+ def aggregation_name
5
+ 'parent'
6
+ end
7
+
8
+ def specification_key
9
+ 'type'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ module Arelastic
2
+ module Aggregations
3
+ class SpecialSingleBucket < Arelastic::Aggregations::Bucket
4
+ attr_accessor :specification
5
+
6
+ def initialize(name, specification, aggs)
7
+ super name, aggs: aggs
8
+ @specification = specification
9
+ end
10
+
11
+ def as_elastic_aggregation
12
+ { aggregation_name => { specification_key => specification } }.merge(super)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ module Arelastic
2
+ module Aggregations
3
+ class Sum < Arelastic::Aggregations::Aggregation
4
+ def as_elastic_aggregation
5
+ {'sum' => options}
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,9 +1,11 @@
1
1
  require 'arelastic/aggregations/aggregation'
2
2
  require 'arelastic/aggregations/bucket'
3
+ require 'arelastic/aggregations/special_single_bucket'
3
4
 
4
5
  require 'arelastic/aggregations/bucket_sort'
5
6
  require 'arelastic/aggregations/bucket_selector'
6
7
  require 'arelastic/aggregations/cardinality'
8
+ require 'arelastic/aggregations/children'
7
9
  require 'arelastic/aggregations/date_histogram'
8
10
  require 'arelastic/aggregations/filter'
9
11
  require 'arelastic/aggregations/filters'
@@ -11,8 +13,10 @@ require 'arelastic/aggregations/histogram'
11
13
  require 'arelastic/aggregations/min'
12
14
  require 'arelastic/aggregations/missing'
13
15
  require 'arelastic/aggregations/nested'
16
+ require 'arelastic/aggregations/parent'
14
17
  require 'arelastic/aggregations/range'
15
18
  require 'arelastic/aggregations/reverse_nested'
16
19
  require 'arelastic/aggregations/sampler'
20
+ require 'arelastic/aggregations/sum'
17
21
  require 'arelastic/aggregations/terms'
18
22
  require 'arelastic/aggregations/value_count'
@@ -0,0 +1,16 @@
1
+ require 'helper'
2
+
3
+ class Arelastic::Aggregations::SumTest < Minitest::Test
4
+ def test_as_elastic
5
+ aggregation = Arelastic::Aggregations::Sum.new('foo', 'field' => 'bar_count')
6
+
7
+ expected = {
8
+ "foo" => {
9
+ "sum" => {
10
+ "field" => "bar_count"
11
+ }
12
+ }
13
+ }
14
+ assert_equal expected, aggregation.as_elastic
15
+ end
16
+ 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: 3.3.0
4
+ version: 3.4.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: 2022-01-31 00:00:00.000000000 Z
11
+ date: 2022-04-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Build Elastic Search queries with objects
14
14
  email: developer@matthewhiggins.com
@@ -25,6 +25,7 @@ files:
25
25
  - lib/arelastic/aggregations/bucket_selector.rb
26
26
  - lib/arelastic/aggregations/bucket_sort.rb
27
27
  - lib/arelastic/aggregations/cardinality.rb
28
+ - lib/arelastic/aggregations/children.rb
28
29
  - lib/arelastic/aggregations/date_histogram.rb
29
30
  - lib/arelastic/aggregations/filter.rb
30
31
  - lib/arelastic/aggregations/filters.rb
@@ -32,9 +33,12 @@ files:
32
33
  - lib/arelastic/aggregations/min.rb
33
34
  - lib/arelastic/aggregations/missing.rb
34
35
  - lib/arelastic/aggregations/nested.rb
36
+ - lib/arelastic/aggregations/parent.rb
35
37
  - lib/arelastic/aggregations/range.rb
36
38
  - lib/arelastic/aggregations/reverse_nested.rb
37
39
  - lib/arelastic/aggregations/sampler.rb
40
+ - lib/arelastic/aggregations/special_single_bucket.rb
41
+ - lib/arelastic/aggregations/sum.rb
38
42
  - lib/arelastic/aggregations/terms.rb
39
43
  - lib/arelastic/aggregations/value_count.rb
40
44
  - lib/arelastic/arities.rb
@@ -116,6 +120,7 @@ files:
116
120
  - test/arelastic/aggregations/range_test.rb
117
121
  - test/arelastic/aggregations/reverse_nested_test.rb
118
122
  - test/arelastic/aggregations/sampler_test.rb
123
+ - test/arelastic/aggregations/sum_test.rb
119
124
  - test/arelastic/aggregations/terms_test.rb
120
125
  - test/arelastic/arities/binary_test.rb
121
126
  - test/arelastic/arities/polyadic_test.rb