arelastic 0.8.1 → 0.9.0
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/README.md +1 -0
- data/lib/arelastic/{facets/range.rb → aggregations/histogram.rb} +0 -0
- data/lib/arelastic/builders/aggregation.rb +3 -3
- data/lib/arelastic/builders/search.rb +0 -4
- data/lib/arelastic/builders.rb +0 -1
- data/lib/arelastic/nodes/node.rb +1 -1
- data/lib/arelastic/searches.rb +0 -1
- data/lib/arelastic.rb +0 -1
- data/test/arelastic/builders/aggregation_test.rb +2 -2
- data/test/arelastic/builders/search_test.rb +0 -4
- data/test/arelastic/nodes/node_test.rb +1 -0
- metadata +5 -18
- data/README.rdoc +0 -2
- data/lib/arelastic/builders/facet.rb +0 -19
- data/lib/arelastic/facets/date_histogram.rb +0 -18
- data/lib/arelastic/facets/facet.rb +0 -19
- data/lib/arelastic/facets/histogram.rb +0 -18
- data/lib/arelastic/facets/nested.rb +0 -17
- data/lib/arelastic/facets/terms.rb +0 -21
- data/lib/arelastic/facets.rb +0 -7
- data/lib/arelastic/searches/facets.rb +0 -14
- data/test/arelastic/builders/facet_test.rb +0 -9
- data/test/arelastic/facets/date_histogram_test.rb +0 -17
- data/test/arelastic/facets/facet_test.rb +0 -36
- data/test/arelastic/facets/histogram_test.rb +0 -17
- data/test/arelastic/facets/terms_test.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ed83fdd7af7f94209a516bc4438b0eabdf384cd
|
4
|
+
data.tar.gz: 899e033e443cfd575043fe6d937f18c15cc63ef5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd9786cc2bc4e10fe3c783cd807845321c35632a40d0a696f6a0f7fbb479e96410228c3fc004b4be8dca68b29225d7d333947f2baa13e94b2123622d029cb654
|
7
|
+
data.tar.gz: 836bce0d0430f3338ac5ff4ab02b72c135770648ed0da4d2e8e338ef334bbaeddaa575d9617e99282b4463b92de07dd74c89b830d0642760ea91a409744ac729
|
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
[](http://travis-ci.org/matthuhiggins/arelastic) [](https://codeclimate.com/github/matthuhiggins/arelastic)
|
File without changes
|
@@ -7,12 +7,12 @@ module Arelastic
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
def terms
|
11
|
-
Arelastic::
|
10
|
+
def terms options = {}
|
11
|
+
Arelastic::Aggregations::Terms.new name, options
|
12
12
|
end
|
13
13
|
|
14
14
|
def histogram options
|
15
|
-
Arelastic::
|
15
|
+
Arelastic::Aggregations::Histogram.new name, options
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/arelastic/builders.rb
CHANGED
data/lib/arelastic/nodes/node.rb
CHANGED
data/lib/arelastic/searches.rb
CHANGED
data/lib/arelastic.rb
CHANGED
@@ -2,8 +2,8 @@ require 'helper'
|
|
2
2
|
|
3
3
|
class Arelastic::Builders::AggregationTest < Minitest::Test
|
4
4
|
def test_terms
|
5
|
-
expected = {"name" => {"terms" => {"field" => "
|
6
|
-
actual = Arelastic::Builders::Aggregation['name'].terms('
|
5
|
+
expected = {"name" => {"terms" => {"field" => "color"}}}
|
6
|
+
actual = Arelastic::Builders::Aggregation['name'].terms('field' => 'color').as_elastic
|
7
7
|
|
8
8
|
assert_equal expected, actual
|
9
9
|
end
|
@@ -13,10 +13,6 @@ class Arelastic::Builders::SearchTest < Minitest::Test
|
|
13
13
|
assert_equal Arelastic::Builders::Aggregation, Arelastic::Builders::Search.aggregation
|
14
14
|
end
|
15
15
|
|
16
|
-
def test_facet
|
17
|
-
assert_equal Arelastic::Builders::Facet, Arelastic::Builders::Search.facet
|
18
|
-
end
|
19
|
-
|
20
16
|
def test_filter
|
21
17
|
assert_equal Arelastic::Builders::Query, Arelastic::Builders::Search.query
|
22
18
|
end
|
metadata
CHANGED
@@ -1,28 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arelastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.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: 2015-
|
11
|
+
date: 2015-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build Elastic Search queries with objects
|
14
14
|
email: developer@matthewhiggins.com
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files:
|
18
|
-
- README.
|
18
|
+
- README.md
|
19
19
|
files:
|
20
|
-
- README.
|
20
|
+
- README.md
|
21
21
|
- lib/arelastic.rb
|
22
22
|
- lib/arelastic/aggregations.rb
|
23
23
|
- lib/arelastic/aggregations/aggregation.rb
|
24
24
|
- lib/arelastic/aggregations/date_histogram.rb
|
25
25
|
- lib/arelastic/aggregations/filter.rb
|
26
|
+
- lib/arelastic/aggregations/histogram.rb
|
26
27
|
- lib/arelastic/aggregations/min.rb
|
27
28
|
- lib/arelastic/aggregations/nested.rb
|
28
29
|
- lib/arelastic/aggregations/terms.rb
|
@@ -32,19 +33,11 @@ files:
|
|
32
33
|
- lib/arelastic/arities/unary.rb
|
33
34
|
- lib/arelastic/builders.rb
|
34
35
|
- lib/arelastic/builders/aggregation.rb
|
35
|
-
- lib/arelastic/builders/facet.rb
|
36
36
|
- lib/arelastic/builders/filter.rb
|
37
37
|
- lib/arelastic/builders/mapping.rb
|
38
38
|
- lib/arelastic/builders/query.rb
|
39
39
|
- lib/arelastic/builders/search.rb
|
40
40
|
- lib/arelastic/builders/sort.rb
|
41
|
-
- lib/arelastic/facets.rb
|
42
|
-
- lib/arelastic/facets/date_histogram.rb
|
43
|
-
- lib/arelastic/facets/facet.rb
|
44
|
-
- lib/arelastic/facets/histogram.rb
|
45
|
-
- lib/arelastic/facets/nested.rb
|
46
|
-
- lib/arelastic/facets/range.rb
|
47
|
-
- lib/arelastic/facets/terms.rb
|
48
41
|
- lib/arelastic/filters.rb
|
49
42
|
- lib/arelastic/filters/and.rb
|
50
43
|
- lib/arelastic/filters/exists.rb
|
@@ -92,7 +85,6 @@ files:
|
|
92
85
|
- lib/arelastic/queries/wildcard.rb
|
93
86
|
- lib/arelastic/searches.rb
|
94
87
|
- lib/arelastic/searches/aggregations.rb
|
95
|
-
- lib/arelastic/searches/facets.rb
|
96
88
|
- lib/arelastic/searches/filter.rb
|
97
89
|
- lib/arelastic/searches/from.rb
|
98
90
|
- lib/arelastic/searches/query.rb
|
@@ -112,16 +104,11 @@ files:
|
|
112
104
|
- test/arelastic/arities/polyadic_test.rb
|
113
105
|
- test/arelastic/arities/unary_test.rb
|
114
106
|
- test/arelastic/builders/aggregation_test.rb
|
115
|
-
- test/arelastic/builders/facet_test.rb
|
116
107
|
- test/arelastic/builders/filter_test.rb
|
117
108
|
- test/arelastic/builders/mapping_test.rb
|
118
109
|
- test/arelastic/builders/query_test.rb
|
119
110
|
- test/arelastic/builders/search_test.rb
|
120
111
|
- test/arelastic/builders/sort_test.rb
|
121
|
-
- test/arelastic/facets/date_histogram_test.rb
|
122
|
-
- test/arelastic/facets/facet_test.rb
|
123
|
-
- test/arelastic/facets/histogram_test.rb
|
124
|
-
- test/arelastic/facets/terms_test.rb
|
125
112
|
- test/arelastic/filters/exists_test.rb
|
126
113
|
- test/arelastic/filters/filter_test.rb
|
127
114
|
- test/arelastic/filters/geo_distance_test.rb
|
data/README.rdoc
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module Arelastic
|
2
|
-
module Builders
|
3
|
-
class Facet < Struct.new :name
|
4
|
-
class << self
|
5
|
-
def [](name)
|
6
|
-
new(name)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def terms field, options = {}
|
11
|
-
Arelastic::Facets::Terms.new name, field, options
|
12
|
-
end
|
13
|
-
|
14
|
-
def histogram options
|
15
|
-
Arelastic::Facets::Histogram.new name, options
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Arelastic
|
2
|
-
module Facets
|
3
|
-
class DateHistogram < Arelastic::Facets::Facet
|
4
|
-
attr_accessor :options
|
5
|
-
|
6
|
-
def initialize name, options
|
7
|
-
super name
|
8
|
-
@options = options
|
9
|
-
end
|
10
|
-
|
11
|
-
def as_elastic_facet
|
12
|
-
{
|
13
|
-
"date_histogram" => options
|
14
|
-
}
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Arelastic
|
2
|
-
module Facets
|
3
|
-
class Facet < Arelastic::Nodes::Node
|
4
|
-
attr_reader :name
|
5
|
-
|
6
|
-
def initialize name
|
7
|
-
@name = name
|
8
|
-
end
|
9
|
-
|
10
|
-
def as_elastic
|
11
|
-
{ name => as_elastic_facet }
|
12
|
-
end
|
13
|
-
|
14
|
-
def nested path
|
15
|
-
Facets::Nested.new path, self
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Arelastic
|
2
|
-
module Facets
|
3
|
-
class Histogram < Arelastic::Facets::Facet
|
4
|
-
attr_accessor :options
|
5
|
-
|
6
|
-
def initialize name, options
|
7
|
-
super name
|
8
|
-
@options = options
|
9
|
-
end
|
10
|
-
|
11
|
-
def as_elastic_facet
|
12
|
-
{
|
13
|
-
"histogram" => options
|
14
|
-
}
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Arelastic
|
2
|
-
module Facets
|
3
|
-
class Nested < Arelastic::Facets::Facet
|
4
|
-
attr_reader :path, :facet
|
5
|
-
|
6
|
-
def initialize path, facet
|
7
|
-
super facet.name
|
8
|
-
@path = path
|
9
|
-
@facet = facet
|
10
|
-
end
|
11
|
-
|
12
|
-
def as_elastic_facet
|
13
|
-
facet.as_elastic_facet.merge("nested" => path)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Arelastic
|
2
|
-
module Facets
|
3
|
-
class Terms < Arelastic::Facets::Facet
|
4
|
-
attr_accessor :field, :options
|
5
|
-
|
6
|
-
def initialize name, field, options = {}
|
7
|
-
super name
|
8
|
-
@field = field
|
9
|
-
@options = options
|
10
|
-
end
|
11
|
-
|
12
|
-
def as_elastic_facet
|
13
|
-
params = {"field" => field}.update(options)
|
14
|
-
|
15
|
-
{
|
16
|
-
"terms" => params
|
17
|
-
}
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/arelastic/facets.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
module Arelastic
|
2
|
-
module Searches
|
3
|
-
class Facets < Arelastic::Searches::Search
|
4
|
-
attr_accessor :grouping
|
5
|
-
def initialize facets
|
6
|
-
@grouping = Arelastic::Nodes::HashGroup.new facets
|
7
|
-
end
|
8
|
-
|
9
|
-
def as_elastic
|
10
|
-
{ "facets" => convert_to_elastic(grouping) }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class Arelastic::Builders::FacetTest < Minitest::Test
|
4
|
-
def test_terms
|
5
|
-
expected = {"name" => {"terms" => {"field" => "term"}}}
|
6
|
-
actual = Arelastic::Builders::Facet['name'].terms('term').as_elastic
|
7
|
-
assert_equal expected, actual
|
8
|
-
end
|
9
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class Arelastic::Facets::DateHistogramTest < Minitest::Test
|
4
|
-
def test_as_elastic
|
5
|
-
facet = Arelastic::Facets::DateHistogram.new('histo', "field" => "field_name", "interval" => "day")
|
6
|
-
expected = {
|
7
|
-
"histo" => {
|
8
|
-
"date_histogram" => {
|
9
|
-
"field" => "field_name",
|
10
|
-
"interval" => "day"
|
11
|
-
}
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
assert_equal expected, facet.as_elastic
|
16
|
-
end
|
17
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class Arelastic::Facets::FacetTest < Minitest::Test
|
4
|
-
def test_nested
|
5
|
-
facet = Class.new(Arelastic::Facets::Facet) do
|
6
|
-
def as_elastic_facet
|
7
|
-
{}
|
8
|
-
end
|
9
|
-
end.new 'name'
|
10
|
-
|
11
|
-
expected = {
|
12
|
-
"name" => {"nested" => "links"}
|
13
|
-
}
|
14
|
-
|
15
|
-
nested = facet.nested "links"
|
16
|
-
|
17
|
-
assert_equal expected, nested.as_elastic
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_nested_terms
|
21
|
-
facet = Arelastic::Facets::Terms.new('foo', 'links.name', "size" => 10)
|
22
|
-
expected = {
|
23
|
-
"foo" => {
|
24
|
-
"terms" => {
|
25
|
-
"field" => "links.name",
|
26
|
-
"size" => 10,
|
27
|
-
},
|
28
|
-
"nested" => "links"
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
nested = facet.nested "links"
|
33
|
-
|
34
|
-
assert_equal expected, nested.as_elastic
|
35
|
-
end
|
36
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class Arelastic::Facets::HistogramTest < Minitest::Test
|
4
|
-
def test_as_elastic
|
5
|
-
facet = Arelastic::Facets::Histogram.new('histo', "field" => "field_name", "interval" => 100)
|
6
|
-
expected = {
|
7
|
-
"histo" => {
|
8
|
-
"histogram" => {
|
9
|
-
"field" => "field_name",
|
10
|
-
"interval" => 100
|
11
|
-
}
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
assert_equal expected, facet.as_elastic
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class Arelastic::Facets::TermsTest < Minitest::Test
|
4
|
-
def test_as_elastic
|
5
|
-
facet = Arelastic::Facets::Terms.new('foo', 'tags', "size" => 10)
|
6
|
-
expected = {
|
7
|
-
"foo" => {
|
8
|
-
"terms" => {
|
9
|
-
"field" => "tags",
|
10
|
-
"size" => 10,
|
11
|
-
}
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
assert_equal expected, facet.as_elastic
|
16
|
-
end
|
17
|
-
end
|