arelastic 2.1.3 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7dd07c79d390e3b2c840edaa9a075901818e0db63f9445b9df8be621a3f9128
|
4
|
+
data.tar.gz: 0fcccd8fb4fa7c24d76749986a65a20697bb51d93992c90d2e4b37d3dbfeec32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72836ec160d987f8fc5d648c0b2f82f10bc9c92e3b16ed002f8c9be189e3566aed31869f9f9c6f47bebd3507457415b50851af6371279abe9e86f82b0ac519c7
|
7
|
+
data.tar.gz: e1f8e296c26dacb529cd14858e06a2e69cd98af08261b3f62fe88c76bb86b0d46234145585925e7d30e72fa9ea23e98441d1cbac4d0121731dbe76dd51826868
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Arelastic
|
2
|
+
module Aggregations
|
3
|
+
class Sampler < Bucket
|
4
|
+
def initialize(name, shard_size, aggs)
|
5
|
+
super(name, aggs: aggs, shard_size: shard_size)
|
6
|
+
end
|
7
|
+
|
8
|
+
def as_elastic_aggregation
|
9
|
+
{ 'sampler' => { 'shard_size' => options[:shard_size] } }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class Arelastic::Aggregations::SamplerTest < Minitest::Test
|
4
|
+
def test_as_elastic
|
5
|
+
aggregation = Arelastic::Aggregations::Sampler.new('sample', 10, [
|
6
|
+
Arelastic::Aggregations::Terms.new('colors', 'field' => 'color')
|
7
|
+
])
|
8
|
+
|
9
|
+
expected = {
|
10
|
+
'sample' => {
|
11
|
+
'sampler' => {
|
12
|
+
'shard_size' => 10
|
13
|
+
},
|
14
|
+
'aggs' => {
|
15
|
+
'colors' => {
|
16
|
+
'terms' => {
|
17
|
+
'field' => 'color'
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
assert_equal expected, aggregation.as_elastic
|
24
|
+
end
|
25
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Queries::
|
3
|
+
class Arelastic::Queries::MatchNoneTest < Minitest::Test
|
4
4
|
def test_as_elastic
|
5
5
|
match_all = Arelastic::Queries::MatchNone.new
|
6
6
|
|
7
7
|
expected = {"match_none" => {}}
|
8
8
|
assert_equal expected, match_all.as_elastic
|
9
9
|
end
|
10
|
-
end
|
10
|
+
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.1.
|
4
|
+
version: 2.1.4
|
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-
|
11
|
+
date: 2018-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build Elastic Search queries with objects
|
14
14
|
email: developer@matthewhiggins.com
|
@@ -28,6 +28,7 @@ files:
|
|
28
28
|
- lib/arelastic/aggregations/min.rb
|
29
29
|
- lib/arelastic/aggregations/nested.rb
|
30
30
|
- lib/arelastic/aggregations/reverse_nested.rb
|
31
|
+
- lib/arelastic/aggregations/sampler.rb
|
31
32
|
- lib/arelastic/aggregations/terms.rb
|
32
33
|
- lib/arelastic/arities.rb
|
33
34
|
- lib/arelastic/arities/binary.rb
|
@@ -100,6 +101,7 @@ files:
|
|
100
101
|
- test/arelastic/aggregations/filter_test.rb
|
101
102
|
- test/arelastic/aggregations/nested_test.rb
|
102
103
|
- test/arelastic/aggregations/reverse_nested_test.rb
|
104
|
+
- test/arelastic/aggregations/sampler_test.rb
|
103
105
|
- test/arelastic/aggregations/terms_test.rb
|
104
106
|
- test/arelastic/arities/binary_test.rb
|
105
107
|
- test/arelastic/arities/polyadic_test.rb
|