elastic_record 3.1.4 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/README.md +1 -1
- data/elastic_record.gemspec +2 -2
- data/lib/elastic_record/config.rb +2 -2
- data/lib/elastic_record/index/analyze.rb +10 -0
- data/lib/elastic_record/index/documents.rb +31 -28
- data/lib/elastic_record/index.rb +3 -6
- data/lib/elastic_record/relation/batches.rb +3 -3
- data/lib/elastic_record/relation/none.rb +1 -1
- data/lib/elastic_record/relation/search_methods.rb +12 -7
- data/lib/elastic_record/relation.rb +2 -9
- data/lib/elastic_record.rb +0 -1
- data/test/dummy/.env.test +1 -1
- data/test/dummy/app/models/widget.rb +1 -1
- data/test/elastic_record/index/analyze_test.rb +12 -0
- data/test/elastic_record/index/documents_test.rb +5 -6
- data/test/elastic_record/integration/active_record_test.rb +14 -65
- data/test/elastic_record/relation/batches_test.rb +1 -1
- data/test/elastic_record/relation/delegation_test.rb +1 -1
- data/test/elastic_record/relation/none_test.rb +1 -1
- data/test/elastic_record/relation/search_methods_test.rb +19 -15
- metadata +6 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95195e9bd6f65e35a24b3ed7d8a3d8ee4170a214
|
4
|
+
data.tar.gz: 65331f5fec26898efe80717794ef0a5ca897895e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d151b8500473e3634658de2f8b1869bc25a480c081faf6a48a952312ff6f5db7409c3b26a04424750ddf36611f45fbb659440c32a0e52deeb3147670668ac86c
|
7
|
+
data.tar.gz: 27171232b4f59a2f290e323c5742b24034926f1231275f6258cb6463e1f8bea9c217e07a3f16530d96791d8d4fbe11812967aa27b2e9fc99bbd137de33af3319
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -48,7 +48,7 @@ If a simple hash is passed into filter, a term or terms query is created:
|
|
48
48
|
```ruby
|
49
49
|
search.filter(color: 'red') # Creates a 'term' filter
|
50
50
|
search.filter(color: %w(red blue)) # Creates a 'terms' filter
|
51
|
-
search.filter(color: nil) # Creates a '
|
51
|
+
search.filter(color: nil) # Creates a 'must not exist' filter
|
52
52
|
```
|
53
53
|
|
54
54
|
If a hash containing hashes is passed into filter, it is used directly as a filter DSL expression:
|
data/elastic_record.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'elastic_record'
|
5
|
-
s.version = '
|
5
|
+
s.version = '4.0.0'
|
6
6
|
s.summary = 'An Elasticsearch querying ORM'
|
7
7
|
s.description = 'Find your records with Elasticsearch'
|
8
8
|
|
@@ -18,6 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.files = `git ls-files`.split("\n")
|
19
19
|
s.test_files = `git ls-files -- {test}/*`.split("\n")
|
20
20
|
|
21
|
-
s.add_dependency 'arelastic', '
|
21
|
+
s.add_dependency 'arelastic', '>= 2.0.0'
|
22
22
|
s.add_dependency 'activemodel'
|
23
23
|
end
|
@@ -31,8 +31,8 @@ module ElasticRecord
|
|
31
31
|
self.servers = settings['servers']
|
32
32
|
self.connection_options = settings
|
33
33
|
|
34
|
-
if
|
35
|
-
self.scroll_keep_alive = scroll_keep_alive
|
34
|
+
if settings['scroll_keep_alive'].present?
|
35
|
+
self.scroll_keep_alive = settings['scroll_keep_alive']
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -2,40 +2,51 @@ require 'active_support/core_ext/object/to_query'
|
|
2
2
|
|
3
3
|
module ElasticRecord
|
4
4
|
class Index
|
5
|
-
class
|
6
|
-
attr_reader :scroll_id
|
7
|
-
|
8
|
-
|
9
|
-
def initialize(elastic_index, scroll_id, options = {})
|
5
|
+
class ScrollEnumerator
|
6
|
+
attr_reader :keep_alive, :batch_size, :scroll_id
|
7
|
+
def initialize(elastic_index, search: nil, scroll_id: nil, keep_alive:, batch_size:)
|
10
8
|
@elastic_index = elastic_index
|
9
|
+
@search = search
|
11
10
|
@scroll_id = scroll_id
|
12
|
-
@
|
11
|
+
@keep_alive = keep_alive
|
12
|
+
@batch_size = batch_size
|
13
13
|
end
|
14
14
|
|
15
15
|
def each_slice(&block)
|
16
16
|
while (hit_ids = request_more_ids).any?
|
17
|
-
hit_ids.each_slice(
|
17
|
+
hit_ids.each_slice(batch_size, &block)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def request_more_hits
|
22
|
-
request_next_scroll['hits']['hits']
|
23
|
-
end
|
24
|
-
|
25
21
|
def request_more_ids
|
26
22
|
request_more_hits.map { |hit| hit['_id'] }
|
27
23
|
end
|
28
24
|
|
25
|
+
def request_more_hits
|
26
|
+
request_next_scroll['hits']['hits']
|
27
|
+
end
|
28
|
+
|
29
29
|
def request_next_scroll
|
30
|
-
|
30
|
+
if scroll_id.nil?
|
31
|
+
response = initial_search_response
|
32
|
+
else
|
33
|
+
response = @elastic_index.scroll(scroll_id, keep_alive)
|
34
|
+
end
|
35
|
+
|
36
|
+
@scroll_id = response['_scroll_id']
|
37
|
+
response
|
31
38
|
end
|
32
39
|
|
33
|
-
def
|
34
|
-
|
40
|
+
def total_hits
|
41
|
+
initial_search_response['hits']['total']
|
35
42
|
end
|
36
43
|
|
37
|
-
def
|
38
|
-
@
|
44
|
+
def initial_search_response
|
45
|
+
@initial_search_response ||= begin
|
46
|
+
search_options = {size: batch_size, scroll: keep_alive}
|
47
|
+
elastic_query = @search.merge('sort' => '_doc')
|
48
|
+
@elastic_index.search(elastic_query, search_options)
|
49
|
+
end
|
39
50
|
end
|
40
51
|
end
|
41
52
|
|
@@ -101,9 +112,9 @@ module ElasticRecord
|
|
101
112
|
end
|
102
113
|
|
103
114
|
def delete_by_query(query)
|
104
|
-
|
115
|
+
scroll_enumerator = build_scroll_enumerator search: query
|
105
116
|
|
106
|
-
|
117
|
+
scroll_enumerator.each_slice do |ids|
|
107
118
|
bulk do
|
108
119
|
ids.each { |id| delete_document(id) }
|
109
120
|
end
|
@@ -127,16 +138,8 @@ module ElasticRecord
|
|
127
138
|
get "_explain", elastic_query
|
128
139
|
end
|
129
140
|
|
130
|
-
def
|
131
|
-
|
132
|
-
options[:keep_alive] ||= ElasticRecord::Config.scroll_keep_alive
|
133
|
-
|
134
|
-
search_options = {search_type: 'scan', size: options[:batch_size], scroll: options[:keep_alive]}
|
135
|
-
json = search(elastic_query, search_options)
|
136
|
-
|
137
|
-
ScanSearch.new(self, json['_scroll_id'], options).tap do |scan_search|
|
138
|
-
scan_search.total_hits = json['hits']['total']
|
139
|
-
end
|
141
|
+
def build_scroll_enumerator(search: nil, scroll_id: nil, batch_size: 100, keep_alive: ElasticRecord::Config.scroll_keep_alive)
|
142
|
+
ScrollEnumerator.new(self, search: search, scroll_id: scroll_id, batch_size: batch_size, keep_alive: keep_alive)
|
140
143
|
end
|
141
144
|
|
142
145
|
def scroll(scroll_id, scroll_keep_alive)
|
data/lib/elastic_record/index.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'elastic_record/index/analyze'
|
1
2
|
require 'elastic_record/index/configurator'
|
2
3
|
require 'elastic_record/index/deferred'
|
3
4
|
require 'elastic_record/index/documents'
|
@@ -7,12 +8,7 @@ require 'elastic_record/index/percolator'
|
|
7
8
|
require 'elastic_record/index/settings'
|
8
9
|
require 'elastic_record/index/warmer'
|
9
10
|
|
10
|
-
require 'active_support/
|
11
|
-
if ActiveSupport::VERSION::STRING < '4'
|
12
|
-
require 'active_support/core_ext/hash/deep_dup'
|
13
|
-
else
|
14
|
-
require 'active_support/core_ext/object/deep_dup'
|
15
|
-
end
|
11
|
+
require 'active_support/core_ext/object/deep_dup'
|
16
12
|
|
17
13
|
module ElasticRecord
|
18
14
|
# ElasticRecord::Index provides access to elastic search's API. It is accessed with
|
@@ -37,6 +33,7 @@ module ElasticRecord
|
|
37
33
|
include Manage
|
38
34
|
include Mapping, Settings
|
39
35
|
include Percolator, Warmer
|
36
|
+
include Analyze
|
40
37
|
include Deferred
|
41
38
|
|
42
39
|
attr_accessor :model
|
@@ -14,11 +14,11 @@ module ElasticRecord
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def find_ids_in_batches(options = {}, &block)
|
17
|
-
|
17
|
+
build_scroll_enumerator(options).each_slice(&block)
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
elastic_index.
|
20
|
+
def build_scroll_enumerator(options)
|
21
|
+
elastic_index.build_scroll_enumerator(search: as_elastic, **options)
|
22
22
|
end
|
23
23
|
|
24
24
|
def reindex
|
@@ -8,13 +8,13 @@ module ElasticRecord
|
|
8
8
|
|
9
9
|
def not(*filters)
|
10
10
|
add_filter_nodes_to_scope(filters) do |filter_node|
|
11
|
-
Arelastic::
|
11
|
+
Arelastic::Queries::Bool.new must_not: filter_node
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
def nested(path, *filters)
|
16
16
|
add_filter_nodes_to_scope(filters) do |filter_node|
|
17
|
-
Arelastic::
|
17
|
+
Arelastic::Queries::Nested.new path, filter_node
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -120,8 +120,12 @@ module ElasticRecord
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def search_type!(type)
|
123
|
-
|
124
|
-
|
123
|
+
if type == :count # TODO: Deprecate support
|
124
|
+
limit! 0
|
125
|
+
else
|
126
|
+
self.search_type_value = type
|
127
|
+
self
|
128
|
+
end
|
125
129
|
end
|
126
130
|
|
127
131
|
def search_type(type)
|
@@ -196,8 +200,9 @@ module ElasticRecord
|
|
196
200
|
def build_query_and_filter(query, filters)
|
197
201
|
query = build_query(query)
|
198
202
|
filter = build_filter(filters)
|
203
|
+
|
199
204
|
if filter
|
200
|
-
arelastic.query.
|
205
|
+
arelastic.query.bool(filter: filter, must: query)
|
201
206
|
elsif query
|
202
207
|
Arelastic::Searches::Query.new(query)
|
203
208
|
else
|
@@ -219,7 +224,7 @@ module ElasticRecord
|
|
219
224
|
if nodes.size == 1
|
220
225
|
nodes.first
|
221
226
|
elsif nodes.size > 1
|
222
|
-
Arelastic::
|
227
|
+
Arelastic::Queries::Bool.new(must: nodes)
|
223
228
|
end
|
224
229
|
end
|
225
230
|
|
@@ -228,7 +233,7 @@ module ElasticRecord
|
|
228
233
|
if filter.is_a?(Arelastic::Nodes::Node)
|
229
234
|
nodes << filter
|
230
235
|
elsif filter.is_a?(ElasticRecord::Relation)
|
231
|
-
nodes << Arelastic::
|
236
|
+
nodes << Arelastic::Queries::HasChild.new(filter.elastic_index.type, filter.as_elastic['query'])
|
232
237
|
else
|
233
238
|
filter.each do |field, terms|
|
234
239
|
case terms
|
@@ -75,20 +75,13 @@ module ElasticRecord
|
|
75
75
|
def search_results
|
76
76
|
@search_results ||= begin
|
77
77
|
options = search_type_value ? {search_type: search_type_value} : {}
|
78
|
-
|
78
|
+
|
79
|
+
klass.elastic_index.search(as_elastic.update('_source' => false), options)
|
79
80
|
end
|
80
81
|
end
|
81
82
|
|
82
83
|
def load_hits(ids)
|
83
84
|
scope = select_values.any? ? klass.select(select_values) : klass
|
84
|
-
if defined?(ActiveRecord::Base) && klass < ActiveRecord::Base
|
85
|
-
case klass.connection.adapter_name
|
86
|
-
when /Mysql/
|
87
|
-
scope = scope.order("FIELD(#{connection.quote_column_name(primary_key)}, #{ids.join(',')})")
|
88
|
-
when /Pos/
|
89
|
-
scope = scope.order(ids.map { |id| "ID=#{connection.quote(id)} DESC" }.join(','))
|
90
|
-
end
|
91
|
-
end
|
92
85
|
scope.find(ids)
|
93
86
|
end
|
94
87
|
end
|
data/lib/elastic_record.rb
CHANGED
data/test/dummy/.env.test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
DATABASE_URL=postgres://
|
1
|
+
DATABASE_URL=postgres://localhost/elastic_record_test
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class ElasticRecord::Index::PercolatorTest < MiniTest::Test
|
4
|
+
def test_analyze
|
5
|
+
tokens = Widget.elastic_index.analyze(
|
6
|
+
"analyzer" => "standard",
|
7
|
+
"text" => "this is a test"
|
8
|
+
)
|
9
|
+
|
10
|
+
assert_equal ["this", "is", "a", "test"], tokens
|
11
|
+
end
|
12
|
+
end
|
@@ -47,21 +47,20 @@ class ElasticRecord::Index::DocumentsTest < MiniTest::Test
|
|
47
47
|
index.index_document('bob', name: 'bob')
|
48
48
|
index.index_document('joe', name: 'joe')
|
49
49
|
|
50
|
-
index.delete_by_query('query' => {query_string: {query: 'name
|
50
|
+
index.delete_by_query('query' => {query_string: {query: 'name:bob'}})
|
51
51
|
|
52
52
|
refute index.record_exists?('bob')
|
53
53
|
assert index.record_exists?('joe')
|
54
54
|
end
|
55
55
|
|
56
|
-
def
|
56
|
+
def test_build_scroll_enumerator
|
57
57
|
index.index_document('bob', name: 'bob')
|
58
58
|
index.index_document('joe', name: 'joe')
|
59
59
|
|
60
|
-
|
60
|
+
scroll_enumerator = index.build_scroll_enumerator(search: {'query' => {query_string: {query: 'name:bob'}}})
|
61
61
|
|
62
|
-
assert_equal 1,
|
63
|
-
|
64
|
-
assert_equal 1, scan_search.request_more_ids.size
|
62
|
+
assert_equal 1, scroll_enumerator.total_hits
|
63
|
+
assert_equal 1, scroll_enumerator.request_more_ids.size
|
65
64
|
end
|
66
65
|
|
67
66
|
def test_bulk_add
|
@@ -1,72 +1,21 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
ActiveRecord::Base.establish_connection config
|
12
|
-
|
13
|
-
ActiveRecord::Migration.suppress_messages do
|
14
|
-
ActiveRecord::Migration.create_table :projects do |t|
|
15
|
-
t.string :name, null: false
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
Project.elastic_index.create_and_deploy if Project.elastic_index.all_names.empty?
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_ordering
|
23
|
-
poo_product = Project.create! name: "Poo"
|
24
|
-
bear_product = Project.create! name: "Bear"
|
25
|
-
Project.elastic_index.refresh
|
26
|
-
|
27
|
-
assert_equal [bear_product, poo_product], Project.elastic_relation.order(name: 'asc')
|
28
|
-
assert_equal [poo_product, bear_product], Project.elastic_relation.order(name: 'desc')
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_update_callback
|
32
|
-
project = Project.create! name: "Ideas"
|
33
|
-
Project.elastic_index.refresh
|
34
|
-
project.update! name: 'Terrible Stuff'
|
35
|
-
Project.elastic_index.refresh
|
36
|
-
|
37
|
-
assert_equal [project], Project.elastic_relation.filter(name: 'Terrible Stuff')
|
38
|
-
end
|
3
|
+
class ElasticRecord::ActiveRecordTest < MiniTest::Test
|
4
|
+
def test_ordering
|
5
|
+
poo_product = Project.create! name: "Poo"
|
6
|
+
bear_product = Project.create! name: "Bear"
|
7
|
+
Project.elastic_index.refresh
|
8
|
+
|
9
|
+
assert_equal [bear_product, poo_product], Project.elastic_relation.order(name: 'asc')
|
10
|
+
assert_equal [poo_product, bear_product], Project.elastic_relation.order(name: 'desc')
|
39
11
|
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class ElasticRecord::Mysql2Test < MiniTest::Test
|
43
|
-
include ElasticRecord::ActiveRecordIntegration
|
44
|
-
|
45
|
-
def setup
|
46
|
-
super
|
47
|
-
|
48
|
-
setup_project_database(
|
49
|
-
'adapter' => 'mysql2',
|
50
|
-
'host' => "localhost",
|
51
|
-
'database' => 'elastic_record_subtest',
|
52
|
-
'username' => 'root'
|
53
|
-
)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
class ElasticRecord::PostgresqlTest < MiniTest::Test
|
58
|
-
include ElasticRecord::ActiveRecordIntegration
|
59
12
|
|
60
|
-
def
|
61
|
-
|
13
|
+
def test_update_callback
|
14
|
+
project = Project.create! name: "Ideas"
|
15
|
+
Project.elastic_index.refresh
|
16
|
+
project.update! name: 'Terrible Stuff'
|
17
|
+
Project.elastic_index.refresh
|
62
18
|
|
63
|
-
|
64
|
-
'adapter' => 'postgresql',
|
65
|
-
'encoding' => 'unicode',
|
66
|
-
'database' => 'elastic_record_subtest',
|
67
|
-
'pool' => 5,
|
68
|
-
'host' => 'localhost',
|
69
|
-
'password' => ''
|
70
|
-
)
|
19
|
+
assert_equal [project], Project.elastic_relation.filter(name: 'Terrible Stuff')
|
71
20
|
end
|
72
21
|
end
|
@@ -67,7 +67,7 @@ class ElasticRecord::Relation::BatchesTest < MiniTest::Test
|
|
67
67
|
Widget.elastic_index.bulk_add [
|
68
68
|
Widget.new(id: 5, color: 'red'),
|
69
69
|
Widget.new(id: 10, color: 'blue'),
|
70
|
-
Widget.new(id: 15, color: 'green')
|
70
|
+
Widget.new(id: 15, color: 'green')
|
71
71
|
]
|
72
72
|
end
|
73
73
|
end
|
@@ -22,7 +22,7 @@ class ElasticRecord::Relation::DelegationTest < MiniTest::Test
|
|
22
22
|
|
23
23
|
result = model.elastic_relation.filter('foo' => 'bar').do_it
|
24
24
|
|
25
|
-
expected = {"query" => {"
|
25
|
+
expected = {"query" => {"bool" => {"filter" => {"term" => {"foo" => "bar"}}}}}
|
26
26
|
assert_equal expected, result
|
27
27
|
end
|
28
28
|
end
|
@@ -9,7 +9,7 @@ class ElasticRecord::Relation::NoneTest < MiniTest::Test
|
|
9
9
|
assert_equal [], none.to_a
|
10
10
|
assert_equal({}, none.aggregations)
|
11
11
|
|
12
|
-
expected_elastic = {"
|
12
|
+
expected_elastic = {"bool" => {"must_not" => {"match_all" => {}}}}
|
13
13
|
assert_equal expected_elastic, none.as_elastic
|
14
14
|
end
|
15
15
|
end
|
@@ -12,12 +12,14 @@ class ElasticRecord::Relation::SearchMethodsTest < MiniTest::Test
|
|
12
12
|
relation.filter!(Widget.arelastic['faz'].in ['baz', 'fum'])
|
13
13
|
|
14
14
|
expected = {
|
15
|
-
"
|
15
|
+
"bool" => {
|
16
16
|
"filter" => {
|
17
|
-
"
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
"bool" => {
|
18
|
+
"must" => [
|
19
|
+
{"term" => {"foo" => "bar"}},
|
20
|
+
{"terms" => {"faz" => ["baz", "fum"]}}
|
21
|
+
]
|
22
|
+
}
|
21
23
|
}
|
22
24
|
}
|
23
25
|
}
|
@@ -29,7 +31,7 @@ class ElasticRecord::Relation::SearchMethodsTest < MiniTest::Test
|
|
29
31
|
relation.filter!(Widget.arelastic['faz'].in 3..5)
|
30
32
|
|
31
33
|
expected = {
|
32
|
-
"
|
34
|
+
"bool" => {
|
33
35
|
"filter" => {
|
34
36
|
"range" => {
|
35
37
|
"faz" => {"gte"=>3, "lte"=>5}
|
@@ -45,7 +47,7 @@ class ElasticRecord::Relation::SearchMethodsTest < MiniTest::Test
|
|
45
47
|
relation.filter!("prefix" => {"name" => "Jo"})
|
46
48
|
|
47
49
|
expected = {
|
48
|
-
"
|
50
|
+
"bool" => {
|
49
51
|
"filter" => {
|
50
52
|
"prefix" => {
|
51
53
|
"name" => "Jo"
|
@@ -61,11 +63,13 @@ class ElasticRecord::Relation::SearchMethodsTest < MiniTest::Test
|
|
61
63
|
scope = relation.filter.not("prefix" => {"name" => "Jo"})
|
62
64
|
|
63
65
|
expected = {
|
64
|
-
"
|
66
|
+
"bool" => {
|
65
67
|
"filter" => {
|
66
|
-
"
|
67
|
-
"
|
68
|
-
"
|
68
|
+
"bool" => {
|
69
|
+
"must_not" => {
|
70
|
+
"prefix" => {
|
71
|
+
"name" => "Jo"
|
72
|
+
}
|
69
73
|
}
|
70
74
|
}
|
71
75
|
}
|
@@ -79,11 +83,11 @@ class ElasticRecord::Relation::SearchMethodsTest < MiniTest::Test
|
|
79
83
|
scope = relation.filter.nested("contacts", "prefix" => {"contacts.name" => "Jo"})
|
80
84
|
|
81
85
|
expected = {
|
82
|
-
"
|
86
|
+
"bool" => {
|
83
87
|
"filter" => {
|
84
88
|
"nested" => {
|
85
89
|
"path" => "contacts",
|
86
|
-
"
|
90
|
+
"query" => {
|
87
91
|
"prefix" => {
|
88
92
|
"contacts.name" => "Jo"
|
89
93
|
}
|
@@ -109,8 +113,8 @@ class ElasticRecord::Relation::SearchMethodsTest < MiniTest::Test
|
|
109
113
|
relation.filter!(Widget.arelastic['name'].prefix "mat")
|
110
114
|
|
111
115
|
expected = {
|
112
|
-
"
|
113
|
-
"
|
116
|
+
"bool" => {
|
117
|
+
"must" => {
|
114
118
|
"field" => {
|
115
119
|
"name"=>"joe"
|
116
120
|
},
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Infogroup
|
@@ -9,28 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-07-
|
12
|
+
date: 2017-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: arelastic
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '1.1'
|
21
18
|
- - ">="
|
22
19
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
20
|
+
version: 2.0.0
|
24
21
|
type: :runtime
|
25
22
|
prerelease: false
|
26
23
|
version_requirements: !ruby/object:Gem::Requirement
|
27
24
|
requirements:
|
28
|
-
- - "~>"
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: '1.1'
|
31
25
|
- - ">="
|
32
26
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
27
|
+
version: 2.0.0
|
34
28
|
- !ruby/object:Gem::Dependency
|
35
29
|
name: activemodel
|
36
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -65,6 +59,7 @@ files:
|
|
65
59
|
- lib/elastic_record/connection.rb
|
66
60
|
- lib/elastic_record/errors.rb
|
67
61
|
- lib/elastic_record/index.rb
|
62
|
+
- lib/elastic_record/index/analyze.rb
|
68
63
|
- lib/elastic_record/index/configurator.rb
|
69
64
|
- lib/elastic_record/index/deferred.rb
|
70
65
|
- lib/elastic_record/index/documents.rb
|
@@ -143,6 +138,7 @@ files:
|
|
143
138
|
- test/elastic_record/callbacks_test.rb
|
144
139
|
- test/elastic_record/config_test.rb
|
145
140
|
- test/elastic_record/connection_test.rb
|
141
|
+
- test/elastic_record/index/analyze_test.rb
|
146
142
|
- test/elastic_record/index/configurator_test.rb
|
147
143
|
- test/elastic_record/index/documents_test.rb
|
148
144
|
- test/elastic_record/index/manage_test.rb
|