arelastic 0.4.2 → 0.4.3

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
  SHA1:
3
- metadata.gz: 8e69e5905caa282145e6314534d1b7052c555d92
4
- data.tar.gz: 5466777ec501cc3339cfae0ceb739959a171a9b1
3
+ metadata.gz: e0362351a0ed0762cf896785ce5e0c11fca53bf7
4
+ data.tar.gz: 817bc4f513dd50cdecb79807b53ab7db4ac5e37d
5
5
  SHA512:
6
- metadata.gz: 99cbd01873e50263c7e7fd84ff8cf9feb7781ee2f13fd9da4f60cc6d47d3a10e716be4982dc9ed69dfcd91c91cb215f2e4ab6ba90edee0ea4ca36ac4093fbfd3
7
- data.tar.gz: 5caf1f1cfbbf52d9a511f980070a31d4ddf83d5fdd8b0d6090036ae0ac1af7bf36ecd613657f6ff36b47e66beef880b480a7500c65f9c9d9b3419e8487b674c7
6
+ metadata.gz: e64f0032b75fb6da266edad7e78325c162205378223a3006dced8ab9986713aebf20b16ed04a81db121712a44337cdabbdfdfedcd71af64e1792acd60d04676c
7
+ data.tar.gz: 8cfc0943eb1787acffc04d8b08dcafb8547ae1900908741126d7dde1d57d0c4847236da3b2068658d8062965608b6f5af408f51d3561b441e15166a0820546f0
@@ -0,0 +1,20 @@
1
+ module Arelastic
2
+ module Filters
3
+ class Nested < Arelastic::Filters::Filter
4
+ attr_accessor :path, :expr
5
+ def initialize(path, expr)
6
+ @path = path
7
+ @expr = expr
8
+ end
9
+
10
+ def as_elastic
11
+ {
12
+ 'nested' => {
13
+ 'path' => path,
14
+ 'query' => convert_to_elastic(expr)
15
+ }
16
+ }
17
+ end
18
+ end
19
+ end
20
+ end
@@ -8,6 +8,7 @@ require 'arelastic/filters/ids'
8
8
  require 'arelastic/filters/limit'
9
9
  require 'arelastic/filters/match_all'
10
10
  require 'arelastic/filters/missing'
11
+ require 'arelastic/filters/nested'
11
12
  require 'arelastic/filters/not'
12
13
  require 'arelastic/filters/or'
13
14
  require 'arelastic/filters/prefix'
@@ -0,0 +1,19 @@
1
+ require 'helper'
2
+
3
+ class Arelastic::Filters::NestedTest < MiniTest::Unit::TestCase
4
+ def test_as_elastic
5
+ expected = {
6
+ "nested" => {
7
+ "path" => "bunnies",
8
+ "query" => {
9
+ "match" => {
10
+ "name" => "Harry"
11
+ }
12
+ }
13
+ }
14
+ }
15
+
16
+ assert_equal expected, Arelastic::Filters::Nested.new('bunnies', Arelastic::Queries::Match.new('name', 'Harry')).as_elastic
17
+ end
18
+
19
+ 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: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Higgins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-21 00:00:00.000000000 Z
11
+ date: 2013-09-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Build Elastic Search queries with objects
14
14
  email: developer@matthewhiggins.com
@@ -42,6 +42,7 @@ files:
42
42
  - lib/arelastic/filters/limit.rb
43
43
  - lib/arelastic/filters/match_all.rb
44
44
  - lib/arelastic/filters/missing.rb
45
+ - lib/arelastic/filters/nested.rb
45
46
  - lib/arelastic/filters/not.rb
46
47
  - lib/arelastic/filters/or.rb
47
48
  - lib/arelastic/filters/prefix.rb
@@ -104,6 +105,7 @@ files:
104
105
  - test/arelastic/filters/match_all_test.rb
105
106
  - test/arelastic/filters/match_test.rb
106
107
  - test/arelastic/filters/missing_test.rb
108
+ - test/arelastic/filters/nested_test.rb
107
109
  - test/arelastic/filters/not_test.rb
108
110
  - test/arelastic/filters/query_test.rb
109
111
  - test/arelastic/mappings/types/binary_test.rb