arelastic 0.8.0 → 0.8.1
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 +4 -4
- data/lib/arelastic/aggregations.rb +2 -0
- data/lib/arelastic/aggregations/aggregation.rb +4 -0
- data/lib/arelastic/aggregations/date_histogram.rb +9 -0
- data/lib/arelastic/aggregations/min.rb +2 -9
- data/test/arelastic/aggregations/aggregation_test.rb +22 -0
- data/test/arelastic/aggregations/date_histogram_test.rb +17 -0
- data/test/arelastic/aggregations/filter_test.rb +1 -1
- data/test/arelastic/aggregations/nested_test.rb +6 -1
- data/test/arelastic/aggregations/terms_test.rb +1 -1
- data/test/arelastic/arities/binary_test.rb +1 -1
- data/test/arelastic/arities/polyadic_test.rb +1 -1
- data/test/arelastic/arities/unary_test.rb +1 -1
- data/test/arelastic/builders/aggregation_test.rb +1 -1
- data/test/arelastic/builders/facet_test.rb +1 -1
- data/test/arelastic/builders/filter_test.rb +1 -1
- data/test/arelastic/builders/mapping_test.rb +1 -1
- data/test/arelastic/builders/query_test.rb +1 -1
- data/test/arelastic/builders/search_test.rb +1 -1
- data/test/arelastic/builders/sort_test.rb +1 -1
- data/test/arelastic/facets/date_histogram_test.rb +1 -1
- data/test/arelastic/facets/facet_test.rb +1 -1
- data/test/arelastic/facets/histogram_test.rb +1 -1
- data/test/arelastic/facets/terms_test.rb +1 -1
- data/test/arelastic/filters/exists_test.rb +1 -1
- data/test/arelastic/filters/filter_test.rb +1 -1
- data/test/arelastic/filters/geo_distance_test.rb +1 -1
- data/test/arelastic/filters/has_child_test.rb +1 -1
- data/test/arelastic/filters/ids_test.rb +1 -1
- data/test/arelastic/filters/match_all_test.rb +1 -1
- data/test/arelastic/filters/missing_test.rb +1 -1
- data/test/arelastic/filters/nested_test.rb +1 -1
- data/test/arelastic/filters/not_test.rb +1 -1
- data/test/arelastic/filters/query_test.rb +1 -1
- data/test/arelastic/filters/script_test.rb +1 -1
- data/test/arelastic/mappings/types/binary_test.rb +1 -1
- data/test/arelastic/mappings/types/multi_field_test.rb +1 -1
- data/test/arelastic/mappings/types/string_test.rb +1 -1
- data/test/arelastic/nodes/node_test.rb +1 -1
- data/test/arelastic/queries/bool_test.rb +1 -1
- data/test/arelastic/queries/filtered_test.rb +1 -1
- data/test/arelastic/queries/match_all_test.rb +1 -1
- data/test/arelastic/queries/multi_match_test.rb +1 -1
- data/test/arelastic/queries/query_string_test.rb +1 -1
- data/test/arelastic/queries/query_test.rb +1 -1
- data/test/arelastic/queries/wildcard_test.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8edf892187c4bc1b1dfd20957cb7f906a174e477
|
4
|
+
data.tar.gz: f70671331e9a01954dae642a81b43536c17566aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d3950ddc9d39032578070a19a24df1674fe1f6ca52ae94e5d04d421aa8b86f71b75f233e32f1382a6cb14069830b1e135da5665e7e9a6a12ef8681c5b6e0e3d
|
7
|
+
data.tar.gz: 3e0fee651967a41f0de510d2d5fdcde18d5aa33a058f59d781dca74fc9981e10a01cdc27e07a7045331b0b652366dab1b11612b29351f208eb4476eaff4e5f7f
|
@@ -1,15 +1,8 @@
|
|
1
1
|
module Arelastic
|
2
2
|
module Aggregations
|
3
|
-
class Min < Arelastic::
|
4
|
-
attr_accessor :options
|
5
|
-
|
6
|
-
def initialize name, options
|
7
|
-
super name
|
8
|
-
@options = options
|
9
|
-
end
|
10
|
-
|
3
|
+
class Min < Arelastic::Aggregations::Aggregation
|
11
4
|
def as_elastic_aggregation
|
12
|
-
|
5
|
+
{"min" => options}
|
13
6
|
end
|
14
7
|
end
|
15
8
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class Arelastic::Aggregations::AggregationTest < Minitest::Test
|
4
|
+
def test_nested
|
5
|
+
aggregation = Arelastic::Aggregations::Min.new('smallest', 'field' => 'pets.weight').nested('pets')
|
6
|
+
|
7
|
+
expected = {
|
8
|
+
"smallest" => {
|
9
|
+
"nested" => {
|
10
|
+
"path" => "pets"
|
11
|
+
},
|
12
|
+
"aggs" => {
|
13
|
+
"smallest" => {
|
14
|
+
"min" => { "field" => "pets.weight" }
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
assert_equal expected, aggregation.as_elastic
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class Arelastic::Aggregations::DateHistogramTest < Minitest::Test
|
4
|
+
def test_as_elastic
|
5
|
+
aggregation = Arelastic::Aggregations::DateHistogram.new('foo', 'field' => 'birthdate', 'interval' => 'month')
|
6
|
+
|
7
|
+
expected = {
|
8
|
+
"foo" => {
|
9
|
+
"date_histogram" => {
|
10
|
+
"field" => "birthdate",
|
11
|
+
"interval" => "month"
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
assert_equal expected, aggregation.as_elastic
|
16
|
+
end
|
17
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Aggregations::TermsTest <
|
3
|
+
class Arelastic::Aggregations::TermsTest < Minitest::Test
|
4
4
|
def test_as_elastic
|
5
5
|
aggregation = Arelastic::Aggregations::Filter.new('foo', 'exists' => {'field' => 'color'})
|
6
6
|
expected = {
|
@@ -1,4 +1,9 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Aggregations::NestedTest <
|
3
|
+
class Arelastic::Aggregations::NestedTest < Minitest::Test
|
4
|
+
def test_as_elastic
|
5
|
+
aggregation = Arelastic::Aggregations::Nested.new('favorite', 'movies', [
|
6
|
+
|
7
|
+
])
|
8
|
+
end
|
4
9
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Aggregations::TermsTest <
|
3
|
+
class Arelastic::Aggregations::TermsTest < Minitest::Test
|
4
4
|
def test_as_elastic
|
5
5
|
aggregation = Arelastic::Aggregations::Terms.new('foo', 'field' => 'tags', 'size' => 10)
|
6
6
|
expected = {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Builders::AggregationTest <
|
3
|
+
class Arelastic::Builders::AggregationTest < Minitest::Test
|
4
4
|
def test_terms
|
5
5
|
expected = {"name" => {"terms" => {"field" => "term"}}}
|
6
6
|
actual = Arelastic::Builders::Aggregation['name'].terms('term').as_elastic
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Builders::FacetTest <
|
3
|
+
class Arelastic::Builders::FacetTest < Minitest::Test
|
4
4
|
def test_terms
|
5
5
|
expected = {"name" => {"terms" => {"field" => "term"}}}
|
6
6
|
actual = Arelastic::Builders::Facet['name'].terms('term').as_elastic
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Builders::FilterTest <
|
3
|
+
class Arelastic::Builders::FilterTest < Minitest::Test
|
4
4
|
def test_ids
|
5
5
|
expected = {"ids" => {"values"=>["5", "6"]}}
|
6
6
|
assert_equal expected, Arelastic::Builders::Filter.ids('5', '6').as_elastic
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Builders::QueryTest <
|
3
|
+
class Arelastic::Builders::QueryTest < Minitest::Test
|
4
4
|
def test_constant_score
|
5
5
|
query = Arelastic::Builders::Query.constant_score({"foo" => "bar"})
|
6
6
|
expected = {"query" => {"constant_score" => {"foo" => "bar"}}}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Facets::DateHistogramTest <
|
3
|
+
class Arelastic::Facets::DateHistogramTest < Minitest::Test
|
4
4
|
def test_as_elastic
|
5
5
|
facet = Arelastic::Facets::DateHistogram.new('histo', "field" => "field_name", "interval" => "day")
|
6
6
|
expected = {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Facets::HistogramTest <
|
3
|
+
class Arelastic::Facets::HistogramTest < Minitest::Test
|
4
4
|
def test_as_elastic
|
5
5
|
facet = Arelastic::Facets::Histogram.new('histo', "field" => "field_name", "interval" => 100)
|
6
6
|
expected = {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Mappings::BinaryTest <
|
3
|
+
class Arelastic::Mappings::BinaryTest < Minitest::Test
|
4
4
|
def test_as_elastic
|
5
5
|
type = Arelastic::Mappings::Binary.new('message', 'index' => 'analyzed')
|
6
6
|
expected = {'message' => {'type' => 'binary', 'index' => 'analyzed'}}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Mappings::MultiFieldTest <
|
3
|
+
class Arelastic::Mappings::MultiFieldTest < Minitest::Test
|
4
4
|
def test_as_elastic
|
5
5
|
type = Arelastic::Mappings::MultiField.new('message', 'message' => {'type' => 'string', 'index' => 'analyzed'}, 'untouched' => {'type' => 'string', 'index' => 'not_analyzed'})
|
6
6
|
expected = {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Mappings::StringTest <
|
3
|
+
class Arelastic::Mappings::StringTest < Minitest::Test
|
4
4
|
def test_as_elastic
|
5
5
|
type = Arelastic::Mappings::String.new('message', 'index' => 'analyzed')
|
6
6
|
expected = {'message' => {'type' => 'string', 'index' => 'analyzed'}}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Queries::QueryStringTest <
|
3
|
+
class Arelastic::Queries::QueryStringTest < Minitest::Test
|
4
4
|
def test_as_elastic
|
5
5
|
query_string = Arelastic::Queries::QueryString.new('foo')
|
6
6
|
expected = {"query_string" => {"query" => "foo"}}
|
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: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Higgins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build Elastic Search queries with objects
|
14
14
|
email: developer@matthewhiggins.com
|
@@ -21,6 +21,7 @@ files:
|
|
21
21
|
- lib/arelastic.rb
|
22
22
|
- lib/arelastic/aggregations.rb
|
23
23
|
- lib/arelastic/aggregations/aggregation.rb
|
24
|
+
- lib/arelastic/aggregations/date_histogram.rb
|
24
25
|
- lib/arelastic/aggregations/filter.rb
|
25
26
|
- lib/arelastic/aggregations/min.rb
|
26
27
|
- lib/arelastic/aggregations/nested.rb
|
@@ -102,6 +103,8 @@ files:
|
|
102
103
|
- lib/arelastic/sorts.rb
|
103
104
|
- lib/arelastic/sorts/asc.rb
|
104
105
|
- lib/arelastic/sorts/sort.rb
|
106
|
+
- test/arelastic/aggregations/aggregation_test.rb
|
107
|
+
- test/arelastic/aggregations/date_histogram_test.rb
|
105
108
|
- test/arelastic/aggregations/filter_test.rb
|
106
109
|
- test/arelastic/aggregations/nested_test.rb
|
107
110
|
- test/arelastic/aggregations/terms_test.rb
|
@@ -166,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
169
|
version: 1.8.11
|
167
170
|
requirements: []
|
168
171
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.4.5
|
170
173
|
signing_key:
|
171
174
|
specification_version: 4
|
172
175
|
summary: Elastic Search query builder
|