arelastic 2.7.0 → 2.8.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af4023400c1d257502730aac57b6ce84c98fd24616a1b46be924f61554c5c243
|
4
|
+
data.tar.gz: cc7c793bed539affe141f675cdd507ebe92c65bb0f221095e9870bb1c1229714
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 294e5fdfe4f87a3051f1e02cb80ab26c328ed0edf22542a9b05ff2ddbb1c6dc18f1227fd1290d294bf9a39f35d3ff9acd986c55630d567614b49faf4106914e6
|
7
|
+
data.tar.gz: 365ec409f5586f3df3c4f606dc9a6734c5db370035d6cb7bba2295e9216f6e0b9f4f460a680f089d332fa04f94a65ee594c4d7e0fe63f22d50845d04a49b68a2
|
@@ -1,21 +1,22 @@
|
|
1
1
|
module Arelastic
|
2
2
|
module Queries
|
3
3
|
class Nested < Arelastic::Queries::Query
|
4
|
-
attr_accessor :path, :
|
4
|
+
attr_accessor :path, :query, :options
|
5
5
|
|
6
|
-
def initialize(path,
|
7
|
-
@path
|
8
|
-
@
|
6
|
+
def initialize(path, query, options = {})
|
7
|
+
@path = path
|
8
|
+
@query = query
|
9
|
+
@options = options
|
9
10
|
end
|
10
11
|
|
11
12
|
def as_elastic
|
12
13
|
params = {
|
13
14
|
'path' => path,
|
14
|
-
'query' => convert_to_elastic(
|
15
|
-
}
|
15
|
+
'query' => convert_to_elastic(query)
|
16
|
+
}.update(options)
|
16
17
|
|
17
18
|
{ 'nested' => params }
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
21
|
-
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class Arelastic::Queries::NestedTest < Minitest::Test
|
4
|
+
def test_as_elastic
|
5
|
+
expected = {
|
6
|
+
'nested' => {
|
7
|
+
'path' => 'comments',
|
8
|
+
'query' => {
|
9
|
+
'match' => {
|
10
|
+
'author'=>'matt'
|
11
|
+
}
|
12
|
+
},
|
13
|
+
'inner_hits' => {}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
query = Arelastic::Queries::Match.new('author', 'matt')
|
18
|
+
assert_equal expected, Arelastic::Queries::Nested.new('comments', query, 'inner_hits' => {}).as_elastic
|
19
|
+
end
|
20
|
+
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.
|
4
|
+
version: 2.8.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: 2019-
|
11
|
+
date: 2019-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build Elastic Search queries with objects
|
14
14
|
email: developer@matthewhiggins.com
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- test/arelastic/queries/match_phrase_test.rb
|
141
141
|
- test/arelastic/queries/match_test.rb
|
142
142
|
- test/arelastic/queries/multi_match_test.rb
|
143
|
+
- test/arelastic/queries/nested_test.rb
|
143
144
|
- test/arelastic/queries/percolate_test.rb
|
144
145
|
- test/arelastic/queries/query_string_test.rb
|
145
146
|
- test/arelastic/queries/query_test.rb
|
@@ -172,8 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
173
|
- !ruby/object:Gem::Version
|
173
174
|
version: '0'
|
174
175
|
requirements: []
|
175
|
-
|
176
|
-
rubygems_version: 2.7.6
|
176
|
+
rubygems_version: 3.0.3
|
177
177
|
signing_key:
|
178
178
|
specification_version: 4
|
179
179
|
summary: Elastic Search query builder
|