elastic-rails 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/elastic/commands/build_agg_from_params.rb +37 -20
- data/lib/elastic/commands/build_query_from_params.rb +109 -79
- data/lib/elastic/commands/build_sort_from_params.rb +41 -0
- data/lib/elastic/commands/import_index_documents.rb +1 -1
- data/lib/elastic/configuration.rb +14 -11
- data/lib/elastic/core/adaptor.rb +0 -1
- data/lib/elastic/core/base_middleware.rb +2 -2
- data/lib/elastic/core/default_middleware.rb +1 -1
- data/lib/elastic/core/definition.rb +53 -34
- data/lib/elastic/core/query_assembler.rb +51 -19
- data/lib/elastic/core/query_config.rb +4 -5
- data/lib/elastic/core/source_formatter.rb +12 -31
- data/lib/elastic/datatypes/date.rb +32 -0
- data/lib/elastic/datatypes/default.rb +74 -0
- data/lib/elastic/datatypes/string.rb +7 -0
- data/lib/elastic/datatypes/term.rb +10 -0
- data/lib/elastic/datatypes/time.rb +29 -0
- data/lib/elastic/dsl/bool_query_builder.rb +4 -0
- data/lib/elastic/fields/nested.rb +24 -6
- data/lib/elastic/fields/value.rb +69 -25
- data/lib/elastic/nested_query.rb +34 -0
- data/lib/elastic/nested_type.rb +10 -0
- data/lib/elastic/nodes/agg/average.rb +3 -1
- data/lib/elastic/nodes/agg/base_metric.rb +6 -5
- data/lib/elastic/nodes/agg/date_histogram.rb +4 -4
- data/lib/elastic/nodes/agg/maximum.rb +3 -1
- data/lib/elastic/nodes/agg/minimum.rb +3 -1
- data/lib/elastic/nodes/agg/stats.rb +3 -1
- data/lib/elastic/nodes/agg/sum.rb +3 -1
- data/lib/elastic/nodes/agg/terms.rb +4 -4
- data/lib/elastic/nodes/agg/top_hits.rb +6 -6
- data/lib/elastic/nodes/and.rb +2 -2
- data/lib/elastic/nodes/base.rb +5 -3
- data/lib/elastic/nodes/base_agg.rb +2 -2
- data/lib/elastic/nodes/boolean.rb +34 -14
- data/lib/elastic/nodes/concerns/aggregable.rb +12 -8
- data/lib/elastic/nodes/concerns/bucketed.rb +4 -7
- data/lib/elastic/nodes/concerns/field_query.rb +10 -0
- data/lib/elastic/nodes/concerns/hit_provider.rb +11 -0
- data/lib/elastic/nodes/function_score.rb +8 -7
- data/lib/elastic/nodes/match.rb +6 -5
- data/lib/elastic/nodes/nested.rb +28 -7
- data/lib/elastic/nodes/range.rb +9 -8
- data/lib/elastic/nodes/search.rb +11 -10
- data/lib/elastic/nodes/sort.rb +82 -0
- data/lib/elastic/nodes/term.rb +7 -6
- data/lib/elastic/query.rb +24 -12
- data/lib/elastic/railtie.rb +7 -0
- data/lib/elastic/railties/ar_helpers.rb +2 -1
- data/lib/elastic/railties/configuration_extensions.rb +13 -0
- data/lib/elastic/railties/indexable_record.rb +1 -2
- data/lib/elastic/railties/indexing_job.rb +8 -0
- data/lib/elastic/railties/type_extensions.rb +1 -1
- data/lib/elastic/results/aggregations.rb +1 -1
- data/lib/elastic/results/bucket.rb +3 -2
- data/lib/elastic/results/grouped_result.rb +31 -1
- data/lib/elastic/results/hit.rb +8 -20
- data/lib/elastic/results/hit_collection.rb +2 -33
- data/lib/elastic/results/root.rb +3 -2
- data/lib/elastic/results/scored_collection.rb +44 -0
- data/lib/elastic/results/scored_item.rb +10 -0
- data/lib/elastic/shims/base.rb +6 -4
- data/lib/elastic/shims/concerns/hit_picker.rb +41 -0
- data/lib/elastic/shims/field_picking.rb +20 -0
- data/lib/elastic/shims/grouping.rb +17 -8
- data/lib/elastic/shims/id_picking.rb +15 -0
- data/lib/elastic/shims/populating.rb +4 -11
- data/lib/elastic/shims/reducing.rb +3 -7
- data/lib/elastic/shims/total_picking.rb +16 -0
- data/lib/elastic/type.rb +6 -3
- data/lib/elastic/types/base_type.rb +16 -9
- data/lib/elastic/types/faceted_type.rb +1 -1
- data/lib/elastic/types/nestable_type.rb +2 -2
- data/lib/elastic/version.rb +1 -1
- data/lib/elastic.rb +15 -0
- data/lib/generators/elastic/index_generator.rb +1 -1
- data/lib/generators/elastic/init_generator.rb +10 -0
- data/lib/generators/elastic/templates/elastic.yml +14 -0
- data/lib/generators/elastic/templates/index.rb +0 -1
- metadata +21 -2
data/lib/elastic.rb
CHANGED
@@ -10,8 +10,11 @@ require "elastic/support/traversable"
|
|
10
10
|
require "elastic/commands/import_index_documents"
|
11
11
|
require "elastic/commands/build_query_from_params"
|
12
12
|
require "elastic/commands/build_agg_from_params"
|
13
|
+
require "elastic/commands/build_sort_from_params"
|
13
14
|
|
14
15
|
require "elastic/results/base"
|
16
|
+
require "elastic/results/scored_item"
|
17
|
+
require "elastic/results/scored_collection"
|
15
18
|
require "elastic/results/aggregations"
|
16
19
|
require "elastic/results/hit"
|
17
20
|
require "elastic/results/hit_collection"
|
@@ -31,6 +34,7 @@ require "elastic/nodes/match"
|
|
31
34
|
require "elastic/nodes/and"
|
32
35
|
require "elastic/nodes/or"
|
33
36
|
require "elastic/nodes/boolean"
|
37
|
+
require "elastic/nodes/sort"
|
34
38
|
require "elastic/nodes/function_score"
|
35
39
|
require "elastic/nodes/nested"
|
36
40
|
require "elastic/nodes/agg/base_metric"
|
@@ -47,6 +51,15 @@ require "elastic/shims/base"
|
|
47
51
|
require "elastic/shims/populating"
|
48
52
|
require "elastic/shims/grouping"
|
49
53
|
require "elastic/shims/reducing"
|
54
|
+
require "elastic/shims/total_picking"
|
55
|
+
require "elastic/shims/id_picking"
|
56
|
+
require "elastic/shims/field_picking"
|
57
|
+
|
58
|
+
require "elastic/datatypes/default"
|
59
|
+
require "elastic/datatypes/string"
|
60
|
+
require "elastic/datatypes/term"
|
61
|
+
require "elastic/datatypes/date"
|
62
|
+
require "elastic/datatypes/time"
|
50
63
|
|
51
64
|
require "elastic/fields/value"
|
52
65
|
require "elastic/fields/nested"
|
@@ -69,9 +82,11 @@ require "elastic/dsl/metric_builder"
|
|
69
82
|
require "elastic/types/base_type"
|
70
83
|
require "elastic/types/faceted_type"
|
71
84
|
require "elastic/types/nestable_type"
|
85
|
+
|
72
86
|
require "elastic/type"
|
73
87
|
require "elastic/nested_type"
|
74
88
|
require "elastic/query"
|
89
|
+
require "elastic/nested_query"
|
75
90
|
|
76
91
|
module Elastic
|
77
92
|
def self.configure(*_args)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Elastic
|
2
|
+
class InitGenerator < Rails::Generators::Base
|
3
|
+
source_root File.expand_path("../templates", __FILE__)
|
4
|
+
|
5
|
+
desc "Initializes the app to work with elastic-rails"
|
6
|
+
def create_index
|
7
|
+
template("elastic.yml", "config/elastic.yml")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
development:
|
2
|
+
host: '127.0.0.1'
|
3
|
+
port: 9200
|
4
|
+
index: '<%= Rails.application.class.parent_name.to_s.underscore %>_develop'
|
5
|
+
|
6
|
+
test:
|
7
|
+
host: '127.0.0.1'
|
8
|
+
port: 9200
|
9
|
+
index: '<%= Rails.application.class.parent_name.to_s.underscore %>_test'
|
10
|
+
|
11
|
+
production:
|
12
|
+
host: '127.0.0.1'
|
13
|
+
port: 9200
|
14
|
+
index: '<%= Rails.application.class.parent_name.to_s.underscore %>'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ignacio Baixas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elasticsearch
|
@@ -227,6 +227,7 @@ files:
|
|
227
227
|
- lib/elastic.rb
|
228
228
|
- lib/elastic/commands/build_agg_from_params.rb
|
229
229
|
- lib/elastic/commands/build_query_from_params.rb
|
230
|
+
- lib/elastic/commands/build_sort_from_params.rb
|
230
231
|
- lib/elastic/commands/import_index_documents.rb
|
231
232
|
- lib/elastic/configuration.rb
|
232
233
|
- lib/elastic/core/adaptor.rb
|
@@ -239,11 +240,17 @@ files:
|
|
239
240
|
- lib/elastic/core/query_config.rb
|
240
241
|
- lib/elastic/core/serializer.rb
|
241
242
|
- lib/elastic/core/source_formatter.rb
|
243
|
+
- lib/elastic/datatypes/date.rb
|
244
|
+
- lib/elastic/datatypes/default.rb
|
245
|
+
- lib/elastic/datatypes/string.rb
|
246
|
+
- lib/elastic/datatypes/term.rb
|
247
|
+
- lib/elastic/datatypes/time.rb
|
242
248
|
- lib/elastic/dsl/bool_query_builder.rb
|
243
249
|
- lib/elastic/dsl/bool_query_context.rb
|
244
250
|
- lib/elastic/dsl/metric_builder.rb
|
245
251
|
- lib/elastic/fields/nested.rb
|
246
252
|
- lib/elastic/fields/value.rb
|
253
|
+
- lib/elastic/nested_query.rb
|
247
254
|
- lib/elastic/nested_type.rb
|
248
255
|
- lib/elastic/nodes/agg/average.rb
|
249
256
|
- lib/elastic/nodes/agg/base_metric.rb
|
@@ -261,6 +268,7 @@ files:
|
|
261
268
|
- lib/elastic/nodes/concerns/aggregable.rb
|
262
269
|
- lib/elastic/nodes/concerns/boostable.rb
|
263
270
|
- lib/elastic/nodes/concerns/bucketed.rb
|
271
|
+
- lib/elastic/nodes/concerns/field_query.rb
|
264
272
|
- lib/elastic/nodes/concerns/hit_provider.rb
|
265
273
|
- lib/elastic/nodes/function_score.rb
|
266
274
|
- lib/elastic/nodes/match.rb
|
@@ -268,12 +276,15 @@ files:
|
|
268
276
|
- lib/elastic/nodes/or.rb
|
269
277
|
- lib/elastic/nodes/range.rb
|
270
278
|
- lib/elastic/nodes/search.rb
|
279
|
+
- lib/elastic/nodes/sort.rb
|
271
280
|
- lib/elastic/nodes/term.rb
|
272
281
|
- lib/elastic/query.rb
|
273
282
|
- lib/elastic/railtie.rb
|
274
283
|
- lib/elastic/railties/ar_helpers.rb
|
275
284
|
- lib/elastic/railties/ar_middleware.rb
|
285
|
+
- lib/elastic/railties/configuration_extensions.rb
|
276
286
|
- lib/elastic/railties/indexable_record.rb
|
287
|
+
- lib/elastic/railties/indexing_job.rb
|
277
288
|
- lib/elastic/railties/query_extensions.rb
|
278
289
|
- lib/elastic/railties/rspec.rb
|
279
290
|
- lib/elastic/railties/tasks/es.rake
|
@@ -289,10 +300,16 @@ files:
|
|
289
300
|
- lib/elastic/results/metric.rb
|
290
301
|
- lib/elastic/results/result_group.rb
|
291
302
|
- lib/elastic/results/root.rb
|
303
|
+
- lib/elastic/results/scored_collection.rb
|
304
|
+
- lib/elastic/results/scored_item.rb
|
292
305
|
- lib/elastic/shims/base.rb
|
306
|
+
- lib/elastic/shims/concerns/hit_picker.rb
|
307
|
+
- lib/elastic/shims/field_picking.rb
|
293
308
|
- lib/elastic/shims/grouping.rb
|
309
|
+
- lib/elastic/shims/id_picking.rb
|
294
310
|
- lib/elastic/shims/populating.rb
|
295
311
|
- lib/elastic/shims/reducing.rb
|
312
|
+
- lib/elastic/shims/total_picking.rb
|
296
313
|
- lib/elastic/support/command.rb
|
297
314
|
- lib/elastic/support/transform.rb
|
298
315
|
- lib/elastic/support/traversable.rb
|
@@ -302,6 +319,8 @@ files:
|
|
302
319
|
- lib/elastic/types/nestable_type.rb
|
303
320
|
- lib/elastic/version.rb
|
304
321
|
- lib/generators/elastic/index_generator.rb
|
322
|
+
- lib/generators/elastic/init_generator.rb
|
323
|
+
- lib/generators/elastic/templates/elastic.yml
|
305
324
|
- lib/generators/elastic/templates/index.rb
|
306
325
|
homepage: https://github.com/surbtc/elastic-rails
|
307
326
|
licenses:
|