elasticsearch-dsl 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -16
- data/README.md +51 -18
- data/Rakefile +4 -17
- data/elasticsearch-dsl.gemspec +3 -16
- data/lib/elasticsearch-dsl.rb +3 -16
- data/lib/elasticsearch/dsl.rb +4 -16
- data/lib/elasticsearch/dsl/search.rb +27 -17
- data/lib/elasticsearch/dsl/search/aggregation.rb +6 -17
- data/lib/elasticsearch/dsl/search/aggregations/avg.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/cardinality.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/children.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/composite.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/date_histogram.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/date_range.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/extended_stats.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/filter.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/filters.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/geo_bounds.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/geo_distance.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/geohash_grid.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/global.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/histogram.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/ip_range.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/max.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/min.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/missing.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/nested.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/percentile_ranks.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/percentiles.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/avg_bucket.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/bucket_script.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/bucket_selector.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/bucket_sort.rb +93 -0
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/cumulative_sum.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/derivative.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/extended_stats_bucket.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/max_bucket.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/min_bucket.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/moving_avg.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/percentiles_bucket.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/serial_diff.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/stats_bucket.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/pipeline/sum_bucket.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/range.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/reverse_nested.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/scripted_metric.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/significant_terms.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/significant_text.rb +49 -0
- data/lib/elasticsearch/dsl/search/aggregations/stats.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/sum.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/terms.rb +3 -16
- data/lib/elasticsearch/dsl/search/aggregations/top_hits.rb +4 -17
- data/lib/elasticsearch/dsl/search/aggregations/value_count.rb +4 -17
- data/lib/elasticsearch/dsl/search/base_aggregation_component.rb +6 -17
- data/lib/elasticsearch/dsl/search/base_component.rb +16 -17
- data/lib/elasticsearch/dsl/search/base_compound_filter_component.rb +6 -17
- data/lib/elasticsearch/dsl/search/collapse.rb +82 -0
- data/lib/elasticsearch/dsl/search/filter.rb +6 -17
- data/lib/elasticsearch/dsl/search/filters/and.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/bool.rb +3 -16
- data/lib/elasticsearch/dsl/search/filters/exists.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/geo_bounding_box.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/geo_distance.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/geo_distance_range.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/geo_polygon.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/geo_shape.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/geohash_cell.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/has_child.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/has_parent.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/ids.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/indices.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/limit.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/match_all.rb +3 -16
- data/lib/elasticsearch/dsl/search/filters/missing.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/nested.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/not.rb +7 -18
- data/lib/elasticsearch/dsl/search/filters/or.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/prefix.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/query.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/range.rb +3 -16
- data/lib/elasticsearch/dsl/search/filters/regexp.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/script.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/term.rb +3 -16
- data/lib/elasticsearch/dsl/search/filters/terms.rb +4 -17
- data/lib/elasticsearch/dsl/search/filters/type.rb +4 -17
- data/lib/elasticsearch/dsl/search/highlight.rb +3 -16
- data/lib/elasticsearch/dsl/search/options.rb +5 -17
- data/lib/elasticsearch/dsl/search/queries/bool.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/boosting.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/common.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/constant_score.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/dis_max.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/exists.rb +3 -16
- data/lib/elasticsearch/dsl/search/queries/filtered.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/function_score.rb +5 -17
- data/lib/elasticsearch/dsl/search/queries/fuzzy.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/fuzzy_like_this.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/fuzzy_like_this_field.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/geo_shape.rb +3 -16
- data/lib/elasticsearch/dsl/search/queries/has_child.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/has_parent.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/ids.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/indices.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/inner_hits.rb +120 -0
- data/lib/elasticsearch/dsl/search/queries/match.rb +3 -16
- data/lib/elasticsearch/dsl/search/queries/match_all.rb +3 -16
- data/lib/elasticsearch/dsl/search/queries/match_phrase.rb +3 -16
- data/lib/elasticsearch/dsl/search/queries/match_phrase_prefix.rb +3 -16
- data/lib/elasticsearch/dsl/search/queries/more_like_this.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/multi_match.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/nested.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/prefix.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/query_string.rb +3 -16
- data/lib/elasticsearch/dsl/search/queries/range.rb +3 -16
- data/lib/elasticsearch/dsl/search/queries/regexp.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/simple_query_string.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/span_first.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/span_multi.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/span_near.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/span_not.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/span_or.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/span_term.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/template.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/term.rb +3 -16
- data/lib/elasticsearch/dsl/search/queries/terms.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/top_children.rb +4 -17
- data/lib/elasticsearch/dsl/search/queries/wildcard.rb +4 -17
- data/lib/elasticsearch/dsl/search/query.rb +6 -17
- data/lib/elasticsearch/dsl/search/sort.rb +3 -16
- data/lib/elasticsearch/dsl/search/suggest.rb +3 -16
- data/lib/elasticsearch/dsl/utils.rb +3 -16
- data/lib/elasticsearch/dsl/version.rb +4 -17
- data/spec/elasticsearch/dsl/search/aggregations/avg_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/cardinality_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/children_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/composite_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/date_histogram_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/date_range_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/extended_stats_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/filter_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/filters_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/geo_bounds_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/geo_distance_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/geo_grid_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/global_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/historgram_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/ip_range_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/max_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/min_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/missing_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/nested_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/percentile_ranks_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/percentiles_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/avg_bucket_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/bucket_script_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/bucket_selector_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/bucket_sort_spec.rb +91 -0
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/cumulative_sum_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/derivative_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/extended_stats_bucket_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/max_bucket_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/min_bucket_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/moving_avg_test_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/percentiles_bucket_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/serial_diff_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/stats_bucket_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/pipeline/sum_bucket_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/range_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/reverse_nested_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/scripted_metric_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/significant_terms_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/significant_text_spec.rb +163 -0
- data/spec/elasticsearch/dsl/search/aggregations/stats_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/sum_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/terms_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/top_hits_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/aggregations/value_count_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/collapse_spec.rb +80 -0
- data/spec/elasticsearch/dsl/search/filters/and_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/bool_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/exists_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/geo_bounding_box_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/geo_distance_range_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/geo_distance_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/geo_polygon_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/geo_shape_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/geohash_cell_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/has_child_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/has_parent_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/ids_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/indices_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/limit_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/match_all_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/missing_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/nested_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/not_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/or_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/prefix_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/query_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/range_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/regexp_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/script_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/term_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/terms_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/filters/type_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/bool_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/boosting_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/common_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/constant_score_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/dis_max_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/exists_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/filtered_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/function_score_spec.rb +14 -16
- data/spec/elasticsearch/dsl/search/queries/fuzzy_like_this_field_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/fuzzy_like_this_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/fuzzy_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/geo_shape_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/has_child_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/has_parent_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/ids_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/indices_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/inner_hits_spec.rb +131 -0
- data/spec/elasticsearch/dsl/search/queries/match_all_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/match_phrase_prefix_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/match_phrase_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/{mach_spec.rb → match_spec.rb} +3 -16
- data/spec/elasticsearch/dsl/search/queries/more_like_this_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/multi_match_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/nested_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/prefix_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/query_string_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/range_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/regexp_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/simple_query_string_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/span_first_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/span_multi_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/span_near_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/span_not_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/span_or_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/span_term_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/template_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/term_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/terms_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/top_children_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search/queries/wildcard_spec.rb +3 -16
- data/spec/elasticsearch/dsl/search_spec.rb +372 -0
- data/spec/spec_helper.rb +3 -16
- data/test/integration/search_aggregation_children_test.rb +3 -16
- data/test/integration/search_aggregation_geo_test.rb +3 -16
- data/test/integration/search_aggregation_nested_test.rb +3 -16
- data/test/integration/search_aggregations_test.rb +3 -16
- data/test/integration/search_filters_test.rb +3 -16
- data/test/integration/search_options_test.rb +3 -16
- data/test/integration/search_query_test.rb +3 -16
- data/test/integration/search_size_from_test.rb +3 -16
- data/test/integration/search_sort_test.rb +3 -16
- data/test/integration/search_suggest_test.rb +3 -16
- data/test/integration/search_test.rb +3 -16
- data/test/test_helper.rb +3 -16
- data/test/unit/dsl_test.rb +3 -16
- data/test/unit/search_aggregation_test.rb +3 -16
- data/test/unit/search_base_aggregation_component_test.rb +3 -16
- data/test/unit/search_base_component_test.rb +3 -16
- data/test/unit/search_filter_test.rb +3 -16
- data/test/unit/search_highlight_test.rb +3 -16
- data/test/unit/search_options_test.rb +11 -16
- data/test/unit/search_query_test.rb +3 -16
- data/test/unit/search_size_from_test.rb +3 -16
- data/test/unit/search_sort_test.rb +3 -16
- data/test/unit/search_suggest_test.rb +3 -16
- data/test/unit/search_test.rb +10 -16
- data/test/unit/utils_test.rb +3 -16
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c06f16111c1a5a433b67c1b7b3ea96fc1da1b7b06ef3d33a32c36d01a5f6313
|
4
|
+
data.tar.gz: bef717306ff360a26a3b9c3c84b5beb9821452404547f0af834c383c4a0d1d9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0b7a267f4c43c0cf9f095132f46a54c7d2a6e515e8868e343e003245e27e1e086ae6fb44314eb42c8ee93a4454385c2dbf7ec158bd224f510c908440452cea9
|
7
|
+
data.tar.gz: 0ba1b777aa2145ec8b1aa5aafa7ab2e06a90374c461d26dea09653d8878321af6687c0bd6171ebdcf9fc7f3380500a784e2fa947c2a7ab673b1232c7c50da22a
|
data/Gemfile
CHANGED
@@ -1,19 +1,6 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
3
|
+
# See the LICENSE file in the project root for more information
|
17
4
|
|
18
5
|
source 'https://rubygems.org'
|
19
6
|
|
data/README.md
CHANGED
@@ -239,6 +239,56 @@ NOTE: You have to enable dynamic scripting to be able to execute the `function_s
|
|
239
239
|
|
240
240
|
**Please see the extensive RDoc examples in the source code and the integration tests.**
|
241
241
|
|
242
|
+
## Accessing methods outside DSL blocks' scopes
|
243
|
+
|
244
|
+
Methods can be defined and called from within a block. This can be done for values like a `Hash`,
|
245
|
+
`String`, `Array`, etc. For example:
|
246
|
+
|
247
|
+
```ruby
|
248
|
+
def match_criteria
|
249
|
+
{ title: 'test' }
|
250
|
+
end
|
251
|
+
|
252
|
+
s = search do
|
253
|
+
query do
|
254
|
+
match match_criteria
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
s.to_hash
|
259
|
+
# => { query: { match: { title: 'test' } } }
|
260
|
+
|
261
|
+
```
|
262
|
+
|
263
|
+
To define subqueries in other methods, `self` must be passed to the method and the subquery must be defined in a block
|
264
|
+
passed to `instance_eval` called on the object argument. Otherwise, the subquery does not have access to the scope of
|
265
|
+
the block from which the method was called. For example:
|
266
|
+
|
267
|
+
```ruby
|
268
|
+
def not_clause(obj)
|
269
|
+
obj.instance_eval do
|
270
|
+
_not do
|
271
|
+
term color: 'red'
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
s = search do
|
277
|
+
query do
|
278
|
+
filtered do
|
279
|
+
filter do
|
280
|
+
not_clause(self)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
s.to_hash
|
287
|
+
# => { query: { filtered: { filter: { not: { term: { color: 'red' } } } } } }
|
288
|
+
|
289
|
+
```
|
290
|
+
|
291
|
+
|
242
292
|
## Development
|
243
293
|
|
244
294
|
To work on the code, clone the repository and install the dependencies:
|
@@ -261,21 +311,4 @@ see instructions in the main [README](../README.md#development).
|
|
261
311
|
|
262
312
|
## License
|
263
313
|
|
264
|
-
This software is licensed under the Apache 2 license
|
265
|
-
|
266
|
-
Licensed to Elasticsearch B.V. under one or more contributor
|
267
|
-
license agreements. See the NOTICE file distributed with
|
268
|
-
this work for additional information regarding copyright
|
269
|
-
ownership. Elasticsearch B.V. licenses this file to you under
|
270
|
-
the Apache License, Version 2.0 (the "License"); you may
|
271
|
-
not use this file except in compliance with the License.
|
272
|
-
You may obtain a copy of the License at
|
273
|
-
|
274
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
275
|
-
|
276
|
-
Unless required by applicable law or agreed to in writing,
|
277
|
-
software distributed under the License is distributed on an
|
278
|
-
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
279
|
-
KIND, either express or implied. See the License for the
|
280
|
-
specific language governing permissions and limitations
|
281
|
-
under the License.
|
314
|
+
This software is licensed under the [Apache 2 license](./LICENSE).
|
data/Rakefile
CHANGED
@@ -1,19 +1,6 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
3
|
+
# See the LICENSE file in the project root for more information
|
17
4
|
|
18
5
|
require "bundler/gem_tasks"
|
19
6
|
|
@@ -122,7 +109,7 @@ namespace :generate do
|
|
122
109
|
hits = JSON.load(response)['hits']['hits']
|
123
110
|
|
124
111
|
if hit = hits.first
|
125
|
-
doc_url = ("
|
112
|
+
doc_url = ("https://www.elastic.co" + hit['fields']['url']).gsub(/#.+$/, '') if hit['_score'] > 0.2
|
126
113
|
end
|
127
114
|
rescue Exception => e
|
128
115
|
puts "[!] ERROR: #{e.inspect}"
|
data/elasticsearch-dsl.gemspec
CHANGED
@@ -1,19 +1,6 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
3
|
+
# See the LICENSE file in the project root for more information
|
17
4
|
|
18
5
|
# coding: utf-8
|
19
6
|
lib = File.expand_path('../lib', __FILE__)
|
data/lib/elasticsearch-dsl.rb
CHANGED
@@ -1,18 +1,5 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
3
|
+
# See the LICENSE file in the project root for more information
|
17
4
|
|
18
5
|
require 'elasticsearch/dsl'
|
data/lib/elasticsearch/dsl.rb
CHANGED
@@ -1,19 +1,6 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
3
|
+
# See the LICENSE file in the project root for more information
|
17
4
|
|
18
5
|
require 'elasticsearch/dsl/version'
|
19
6
|
|
@@ -22,6 +9,7 @@ require 'elasticsearch/dsl/search/base_component'
|
|
22
9
|
require 'elasticsearch/dsl/search/base_compound_filter_component'
|
23
10
|
require 'elasticsearch/dsl/search/base_aggregation_component'
|
24
11
|
require 'elasticsearch/dsl/search/query'
|
12
|
+
require 'elasticsearch/dsl/search/collapse'
|
25
13
|
require 'elasticsearch/dsl/search/filter'
|
26
14
|
require 'elasticsearch/dsl/search/aggregation'
|
27
15
|
require 'elasticsearch/dsl/search/highlight'
|
@@ -1,19 +1,6 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
3
|
+
# See the LICENSE file in the project root for more information
|
17
4
|
|
18
5
|
module Elasticsearch
|
19
6
|
module DSL
|
@@ -58,7 +45,8 @@ module Elasticsearch
|
|
58
45
|
|
59
46
|
def initialize(*args, &block)
|
60
47
|
@options = Options.new *args
|
61
|
-
block
|
48
|
+
@block = block
|
49
|
+
@block.arity < 1 ? self.instance_eval(&@block) : @block.call(self) if @block
|
62
50
|
end
|
63
51
|
|
64
52
|
# DSL method for building or accessing the `query` part of a search definition
|
@@ -165,6 +153,19 @@ module Elasticsearch
|
|
165
153
|
end
|
166
154
|
end
|
167
155
|
|
156
|
+
# DSL method for building the `collapse` part of a search definition
|
157
|
+
#
|
158
|
+
# @return [self, Collapse]
|
159
|
+
#
|
160
|
+
def collapse(*args, &block)
|
161
|
+
if !args.empty? || block
|
162
|
+
@collapse = Collapse.new(*args, &block)
|
163
|
+
self
|
164
|
+
else
|
165
|
+
@collapse
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
168
169
|
# DSL method for building the `sort` part of a search definition
|
169
170
|
#
|
170
171
|
# @return [self]
|
@@ -178,6 +179,12 @@ module Elasticsearch
|
|
178
179
|
end
|
179
180
|
end
|
180
181
|
|
182
|
+
# Set the sort part of a search definition
|
183
|
+
#
|
184
|
+
def sort=(value)
|
185
|
+
@sort = value
|
186
|
+
end
|
187
|
+
|
181
188
|
# DSL method for building the `stored_fields` part of a search definition
|
182
189
|
#
|
183
190
|
# @return [self]
|
@@ -244,6 +251,8 @@ module Elasticsearch
|
|
244
251
|
if @options.respond_to? name
|
245
252
|
@options.__send__ name, *args, &block
|
246
253
|
self
|
254
|
+
elsif @block
|
255
|
+
@block.binding.eval('self').send(name, *args, &block)
|
247
256
|
else
|
248
257
|
super
|
249
258
|
end
|
@@ -265,6 +274,7 @@ module Elasticsearch
|
|
265
274
|
hash.update(from: @from) if @from
|
266
275
|
hash.update(suggest: @suggest.reduce({}) { |sum,item| sum.update item.last.to_hash }) if @suggest
|
267
276
|
hash.update(highlight: @highlight.to_hash) if @highlight
|
277
|
+
hash.update(collapse: @collapse.to_hash) if @collapse
|
268
278
|
hash.update(@options) unless @options.empty?
|
269
279
|
hash
|
270
280
|
end
|
@@ -1,19 +1,6 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
3
|
+
# See the LICENSE file in the project root for more information
|
17
4
|
|
18
5
|
module Elasticsearch
|
19
6
|
module DSL
|
@@ -46,8 +33,10 @@ module Elasticsearch
|
|
46
33
|
klass = Utils.__camelize(name)
|
47
34
|
if Aggregations.const_defined? klass
|
48
35
|
@value = Aggregations.const_get(klass).new *args, &block
|
36
|
+
elsif @block
|
37
|
+
@block.binding.eval('self').send(name, *args, &block)
|
49
38
|
else
|
50
|
-
|
39
|
+
super
|
51
40
|
end
|
52
41
|
end
|
53
42
|
|
@@ -1,19 +1,6 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
3
|
+
# See the LICENSE file in the project root for more information
|
17
4
|
|
18
5
|
module Elasticsearch
|
19
6
|
module DSL
|
@@ -30,7 +17,7 @@ module Elasticsearch
|
|
30
17
|
# end
|
31
18
|
# end
|
32
19
|
#
|
33
|
-
# @see
|
20
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-avg-aggregation.html
|
34
21
|
#
|
35
22
|
class Avg
|
36
23
|
include BaseComponent
|
@@ -1,19 +1,6 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
3
|
+
# See the LICENSE file in the project root for more information
|
17
4
|
|
18
5
|
module Elasticsearch
|
19
6
|
module DSL
|
@@ -31,7 +18,7 @@ module Elasticsearch
|
|
31
18
|
# end
|
32
19
|
# end
|
33
20
|
#
|
34
|
-
# @see
|
21
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html
|
35
22
|
#
|
36
23
|
class Cardinality
|
37
24
|
include BaseComponent
|
@@ -1,19 +1,6 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
3
|
+
# See the LICENSE file in the project root for more information
|
17
4
|
|
18
5
|
module Elasticsearch
|
19
6
|
module DSL
|
@@ -42,7 +29,7 @@ module Elasticsearch
|
|
42
29
|
#
|
43
30
|
# See the integration test for a full example.
|
44
31
|
#
|
45
|
-
# @see
|
32
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-children-aggregation.html
|
46
33
|
#
|
47
34
|
class Children
|
48
35
|
include BaseAggregationComponent
|
@@ -1,19 +1,6 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
3
|
+
# See the LICENSE file in the project root for more information
|
17
4
|
|
18
5
|
module Elasticsearch
|
19
6
|
module DSL
|