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 +4 -4
- data/lib/arelastic/filters/nested.rb +20 -0
- data/lib/arelastic/filters.rb +1 -0
- data/test/arelastic/filters/nested_test.rb +19 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e0362351a0ed0762cf896785ce5e0c11fca53bf7
|
|
4
|
+
data.tar.gz: 817bc4f513dd50cdecb79807b53ab7db4ac5e37d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
data/lib/arelastic/filters.rb
CHANGED
|
@@ -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.
|
|
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-
|
|
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
|