elasticsearch-dsl 0.1.5 → 0.1.6
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/Rakefile +1 -1
 - data/elasticsearch-dsl.gemspec +4 -4
 - data/lib/elasticsearch/dsl/search.rb +14 -0
 - data/lib/elasticsearch/dsl/search/aggregations/range.rb +2 -1
 - data/lib/elasticsearch/dsl/search/filters/has_child.rb +1 -0
 - data/lib/elasticsearch/dsl/search/filters/has_parent.rb +1 -0
 - data/lib/elasticsearch/dsl/search/options.rb +0 -1
 - data/lib/elasticsearch/dsl/search/queries/has_child.rb +1 -0
 - data/lib/elasticsearch/dsl/search/queries/has_parent.rb +1 -0
 - data/lib/elasticsearch/dsl/search/queries/match.rb +1 -0
 - data/lib/elasticsearch/dsl/search/queries/match_phrase.rb +33 -0
 - data/lib/elasticsearch/dsl/search/queries/match_phrase_prefix.rb +32 -0
 - data/lib/elasticsearch/dsl/search/queries/simple_query_string.rb +4 -2
 - data/lib/elasticsearch/dsl/version.rb +1 -1
 - data/test/integration/search_aggregation_children_test.rb +8 -3
 - data/test/integration/search_aggregation_geo_test.rb +1 -1
 - data/test/integration/search_aggregation_nested_test.rb +14 -8
 - data/test/integration/search_aggregations_test.rb +14 -6
 - data/test/integration/search_filters_test.rb +31 -120
 - data/test/integration/search_query_test.rb +9 -1
 - data/test/integration/search_size_from_test.rb +5 -1
 - data/test/integration/search_sort_test.rb +4 -4
 - data/test/integration/search_suggest_test.rb +32 -11
 - data/test/integration/search_test.rb +1 -1
 - data/test/test_helper.rb +24 -5
 - data/test/unit/aggregations/avg_test.rb +1 -1
 - data/test/unit/aggregations/cardinality_test.rb +5 -5
 - data/test/unit/aggregations/children_test.rb +1 -1
 - data/test/unit/aggregations/date_histogram_test.rb +1 -1
 - data/test/unit/aggregations/date_range_test.rb +1 -1
 - data/test/unit/aggregations/extended_stats_test.rb +1 -1
 - data/test/unit/aggregations/filter_test.rb +1 -1
 - data/test/unit/aggregations/filters_test.rb +1 -1
 - data/test/unit/aggregations/geo_bounds_test.rb +1 -1
 - data/test/unit/aggregations/geo_distance_test.rb +1 -1
 - data/test/unit/aggregations/geohash_grid_test.rb +1 -1
 - data/test/unit/aggregations/global_test.rb +1 -1
 - data/test/unit/aggregations/histogram_test.rb +1 -1
 - data/test/unit/aggregations/ip_range_test.rb +1 -1
 - data/test/unit/aggregations/max_test.rb +1 -1
 - data/test/unit/aggregations/min_test.rb +1 -1
 - data/test/unit/aggregations/missing_test.rb +1 -1
 - data/test/unit/aggregations/nested_test.rb +1 -1
 - data/test/unit/aggregations/percentile_ranks_test.rb +1 -1
 - data/test/unit/aggregations/percentiles_test.rb +1 -1
 - data/test/unit/aggregations/pipeline/avg_bucket_test.rb +1 -1
 - data/test/unit/aggregations/pipeline/bucket_script_test.rb +1 -1
 - data/test/unit/aggregations/pipeline/bucket_selector_test.rb +1 -1
 - data/test/unit/aggregations/pipeline/cumulative_sum_test.rb +1 -1
 - data/test/unit/aggregations/pipeline/derivative_test.rb +1 -1
 - data/test/unit/aggregations/pipeline/extended_stats_bucket_test.rb +1 -1
 - data/test/unit/aggregations/pipeline/max_bucket_test.rb +1 -1
 - data/test/unit/aggregations/pipeline/min_bucket_test.rb +1 -1
 - data/test/unit/aggregations/pipeline/moving_avg_test.rb +1 -1
 - data/test/unit/aggregations/pipeline/percentiles_bucket_test.rb +1 -1
 - data/test/unit/aggregations/pipeline/serial_diff_test.rb +1 -1
 - data/test/unit/aggregations/pipeline/stats_bucket_test.rb +1 -1
 - data/test/unit/aggregations/pipeline/sum_bucket_test.rb +1 -1
 - data/test/unit/aggregations/range_test.rb +12 -1
 - data/test/unit/aggregations/reverse_nested_test.rb +2 -2
 - data/test/unit/aggregations/scripted_metric_test.rb +1 -1
 - data/test/unit/aggregations/significant_terms_test.rb +1 -1
 - data/test/unit/aggregations/stats_test.rb +1 -1
 - data/test/unit/aggregations/sum_test.rb +1 -1
 - data/test/unit/aggregations/terms_test.rb +1 -1
 - data/test/unit/aggregations/top_hits_test.rb +1 -1
 - data/test/unit/aggregations/value_count_test.rb +1 -1
 - data/test/unit/dsl_test.rb +1 -1
 - data/test/unit/filters/and_test.rb +1 -1
 - data/test/unit/filters/bool_test.rb +1 -1
 - data/test/unit/filters/exists_test.rb +1 -1
 - data/test/unit/filters/geo_bounding_box_test.rb +1 -1
 - data/test/unit/filters/geo_distance_range_test.rb +1 -1
 - data/test/unit/filters/geo_distance_test.rb +1 -1
 - data/test/unit/filters/geo_polygon_test.rb +1 -1
 - data/test/unit/filters/geo_shape_test.rb +5 -5
 - data/test/unit/filters/geohash_cell_test.rb +1 -1
 - data/test/unit/filters/has_child_test.rb +4 -2
 - data/test/unit/filters/has_parent_test.rb +4 -2
 - data/test/unit/filters/ids_test.rb +1 -1
 - data/test/unit/filters/indices_test.rb +1 -1
 - data/test/unit/filters/limit_test.rb +1 -1
 - data/test/unit/filters/match_all_test.rb +2 -2
 - data/test/unit/filters/missing_test.rb +1 -1
 - data/test/unit/filters/nested_test.rb +1 -1
 - data/test/unit/filters/not_test.rb +1 -1
 - data/test/unit/filters/or_test.rb +1 -1
 - data/test/unit/filters/prefix_test.rb +1 -1
 - data/test/unit/filters/query_test.rb +1 -1
 - data/test/unit/filters/range_test.rb +1 -1
 - data/test/unit/filters/regexp_test.rb +1 -1
 - data/test/unit/filters/script_test.rb +1 -1
 - data/test/unit/filters/term_test.rb +1 -1
 - data/test/unit/filters/terms_test.rb +1 -1
 - data/test/unit/filters/type_test.rb +5 -5
 - data/test/unit/queries/bool_test.rb +3 -3
 - data/test/unit/queries/boosting_test.rb +1 -1
 - data/test/unit/queries/common_test.rb +1 -1
 - data/test/unit/queries/constant_score_test.rb +1 -1
 - data/test/unit/queries/dis_max_test.rb +1 -1
 - data/test/unit/queries/exists_test.rb +1 -1
 - data/test/unit/queries/filtered_test.rb +1 -1
 - data/test/unit/queries/function_score_test.rb +1 -1
 - data/test/unit/queries/fuzzy_like_this_field_test.rb +5 -5
 - data/test/unit/queries/fuzzy_like_this_test.rb +1 -1
 - data/test/unit/queries/fuzzy_test.rb +1 -1
 - data/test/unit/queries/geo_shape_test.rb +1 -1
 - data/test/unit/queries/has_child_test.rb +4 -2
 - data/test/unit/queries/has_parent_test.rb +4 -2
 - data/test/unit/queries/ids_test.rb +1 -1
 - data/test/unit/queries/indices_test.rb +1 -1
 - data/test/unit/queries/match_all_test.rb +1 -1
 - data/test/unit/queries/match_phrase_prefix_test.rb +62 -0
 - data/test/unit/queries/match_phrase_test.rb +63 -0
 - data/test/unit/queries/match_test.rb +1 -1
 - data/test/unit/queries/more_like_this_test.rb +1 -1
 - data/test/unit/queries/multi_match_test.rb +1 -1
 - data/test/unit/queries/nested_test.rb +1 -1
 - data/test/unit/queries/prefix_test.rb +5 -5
 - data/test/unit/queries/query_string_test.rb +1 -1
 - data/test/unit/queries/range_test.rb +1 -1
 - data/test/unit/queries/regexp_test.rb +1 -1
 - data/test/unit/queries/simple_query_string_test.rb +6 -8
 - data/test/unit/queries/span_first_test.rb +1 -1
 - data/test/unit/queries/span_multi_test.rb +1 -1
 - data/test/unit/queries/span_near_test.rb +1 -1
 - data/test/unit/queries/span_not_test.rb +1 -1
 - data/test/unit/queries/span_or_test.rb +1 -1
 - data/test/unit/queries/span_term_test.rb +1 -1
 - data/test/unit/queries/template_test.rb +1 -1
 - data/test/unit/queries/term_test.rb +1 -1
 - data/test/unit/queries/terms_test.rb +1 -1
 - data/test/unit/queries/top_children_test.rb +1 -1
 - data/test/unit/queries/wildcard_test.rb +1 -1
 - data/test/unit/search_aggregation_test.rb +1 -1
 - data/test/unit/search_base_aggregation_component_test.rb +1 -1
 - data/test/unit/search_base_component_test.rb +1 -1
 - data/test/unit/search_filter_test.rb +1 -1
 - data/test/unit/search_highlight_test.rb +1 -1
 - data/test/unit/search_options_test.rb +1 -1
 - data/test/unit/search_query_test.rb +1 -1
 - data/test/unit/search_size_from_test.rb +1 -1
 - data/test/unit/search_sort_test.rb +1 -1
 - data/test/unit/search_suggest_test.rb +1 -1
 - data/test/unit/search_test.rb +3 -1
 - data/test/unit/utils_test.rb +1 -1
 - metadata +24 -32
 
| 
         @@ -7,7 +7,7 @@ module Elasticsearch 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                  context "Queries integration" do
         
     | 
| 
       9 
9 
     | 
    
         
             
                    startup do
         
     | 
| 
       10 
     | 
    
         
            -
                      Elasticsearch::Extensions::Test::Cluster.start( 
     | 
| 
      
 10 
     | 
    
         
            +
                      Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
         
     | 
| 
       11 
11 
     | 
    
         
             
                    end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                    setup do
         
     | 
| 
         @@ -25,6 +25,14 @@ module Elasticsearch 
     | 
|
| 
       25 
25 
     | 
    
         
             
                      end
         
     | 
| 
       26 
26 
     | 
    
         
             
                    end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
      
 28 
     | 
    
         
            +
                    context "for match_phrase_prefix query" do
         
     | 
| 
      
 29 
     | 
    
         
            +
                      should "find the document" do
         
     | 
| 
      
 30 
     | 
    
         
            +
                        response = @client.search index: 'test', body: search { query { match_phrase_prefix title: 'te' } }.to_hash
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                        assert_equal 1, response['hits']['total']
         
     | 
| 
      
 33 
     | 
    
         
            +
                      end
         
     | 
| 
      
 34 
     | 
    
         
            +
                    end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
       28 
36 
     | 
    
         
             
                    context "for query_string query" do
         
     | 
| 
       29 
37 
     | 
    
         
             
                      should "find the document" do
         
     | 
| 
       30 
38 
     | 
    
         
             
                        response = @client.search index: 'test', body: search { query { query_string { query 'te*' } } }.to_hash
         
     | 
| 
         @@ -7,7 +7,11 @@ module Elasticsearch 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                    context "Search results pagination" do
         
     | 
| 
       9 
9 
     | 
    
         
             
                      setup do
         
     | 
| 
      
 10 
     | 
    
         
            +
                        @client.indices.create index: 'test', body: {
         
     | 
| 
      
 11 
     | 
    
         
            +
                          mappings: { d: { properties: { title: { type: 'text', fields: { keyword: { type: 'keyword' } } } } } } }
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
       10 
13 
     | 
    
         
             
                        25.times { |i| @client.index index: 'test', type: 'd', id: i, body: { title: "Test #{sprintf('%03d', i)}" } }
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       11 
15 
     | 
    
         
             
                        @client.indices.refresh index: 'test'
         
     | 
| 
       12 
16 
     | 
    
         
             
                      end
         
     | 
| 
       13 
17 
     | 
    
         | 
| 
         @@ -26,7 +30,7 @@ module Elasticsearch 
     | 
|
| 
       26 
30 
     | 
    
         
             
                          query { match(:title) { query 'test' and type 'phrase_prefix' } }
         
     | 
| 
       27 
31 
     | 
    
         
             
                          size 5
         
     | 
| 
       28 
32 
     | 
    
         
             
                          from 5
         
     | 
| 
       29 
     | 
    
         
            -
                          sort { by  
     | 
| 
      
 33 
     | 
    
         
            +
                          sort { by 'title.keyword' }
         
     | 
| 
       30 
34 
     | 
    
         
             
                        }.to_hash
         
     | 
| 
       31 
35 
     | 
    
         | 
| 
       32 
36 
     | 
    
         
             
                        assert_equal 25, response['hits']['total']
         
     | 
| 
         @@ -7,13 +7,13 @@ module Elasticsearch 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                  context "Sorting integration" do
         
     | 
| 
       9 
9 
     | 
    
         
             
                    startup do
         
     | 
| 
       10 
     | 
    
         
            -
                      Elasticsearch::Extensions::Test::Cluster.start( 
     | 
| 
      
 10 
     | 
    
         
            +
                      Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
         
     | 
| 
       11 
11 
     | 
    
         
             
                    end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                    setup do
         
     | 
| 
       14 
14 
     | 
    
         
             
                      @client.indices.create index: 'test'
         
     | 
| 
       15 
     | 
    
         
            -
                      @client.index index: 'test', type: 'd', id: '1', body: { tags: ['one'], clicks:  
     | 
| 
       16 
     | 
    
         
            -
                      @client.index index: 'test', type: 'd', id: '2', body: { tags: ['one', 'two'], clicks:  
     | 
| 
      
 15 
     | 
    
         
            +
                      @client.index index: 'test', type: 'd', id: '1', body: { tags: ['one'], clicks: 15 }
         
     | 
| 
      
 16 
     | 
    
         
            +
                      @client.index index: 'test', type: 'd', id: '2', body: { tags: ['one', 'two'], clicks: 5 }
         
     | 
| 
       17 
17 
     | 
    
         
             
                      @client.index index: 'test', type: 'd', id: '3', body: { tags: ['one', 'three'], clicks: 20 }
         
     | 
| 
       18 
18 
     | 
    
         
             
                      @client.indices.refresh index: 'test'
         
     | 
| 
       19 
19 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -26,7 +26,7 @@ module Elasticsearch 
     | 
|
| 
       26 
26 
     | 
    
         
             
                          end
         
     | 
| 
       27 
27 
     | 
    
         
             
                        }.to_hash
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                        assert_same_elements ['3', ' 
     | 
| 
      
 29 
     | 
    
         
            +
                        assert_same_elements ['3', '1', '2'], response['hits']['hits'].map { |d| d['_id'] }
         
     | 
| 
       30 
30 
     | 
    
         
             
                      end
         
     | 
| 
       31 
31 
     | 
    
         
             
                    end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
         @@ -9,7 +9,7 @@ module Elasticsearch 
     | 
|
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                  context "Suggest integration" do
         
     | 
| 
       11 
11 
     | 
    
         
             
                    startup do
         
     | 
| 
       12 
     | 
    
         
            -
                      Elasticsearch::Extensions::Test::Cluster.start( 
     | 
| 
      
 12 
     | 
    
         
            +
                      Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
         
     | 
| 
       13 
13 
     | 
    
         
             
                    end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
                    setup do
         
     | 
| 
         @@ -17,10 +17,13 @@ module Elasticsearch 
     | 
|
| 
       17 
17 
     | 
    
         
             
                        mappings: {
         
     | 
| 
       18 
18 
     | 
    
         
             
                          d: {
         
     | 
| 
       19 
19 
     | 
    
         
             
                            properties: {
         
     | 
| 
       20 
     | 
    
         
            -
                              title: { type: ' 
     | 
| 
       21 
     | 
    
         
            -
                               
     | 
| 
       22 
     | 
    
         
            -
                                type: ' 
     | 
| 
       23 
     | 
    
         
            -
                                 
     | 
| 
      
 20 
     | 
    
         
            +
                              title: { type: 'text' },
         
     | 
| 
      
 21 
     | 
    
         
            +
                              suggest: {
         
     | 
| 
      
 22 
     | 
    
         
            +
                                type: 'object',
         
     | 
| 
      
 23 
     | 
    
         
            +
                                properties: {
         
     | 
| 
      
 24 
     | 
    
         
            +
                                  title:   { type: 'completion' },
         
     | 
| 
      
 25 
     | 
    
         
            +
                                  payload: { type: 'object', enabled: false }
         
     | 
| 
      
 26 
     | 
    
         
            +
                                }
         
     | 
| 
       24 
27 
     | 
    
         
             
                              }
         
     | 
| 
       25 
28 
     | 
    
         
             
                            }
         
     | 
| 
       26 
29 
     | 
    
         
             
                          }
         
     | 
| 
         @@ -29,32 +32,50 @@ module Elasticsearch 
     | 
|
| 
       29 
32 
     | 
    
         | 
| 
       30 
33 
     | 
    
         
             
                      @client.index index: 'test', type: 'd', id: '1', body: {
         
     | 
| 
       31 
34 
     | 
    
         
             
                        title: 'One',
         
     | 
| 
       32 
     | 
    
         
            -
                         
     | 
| 
      
 35 
     | 
    
         
            +
                        suggest: {
         
     | 
| 
      
 36 
     | 
    
         
            +
                          title: { input: ['one', 'uno', 'jedna'] },
         
     | 
| 
      
 37 
     | 
    
         
            +
                          payload: { id: '1' }
         
     | 
| 
      
 38 
     | 
    
         
            +
                        }
         
     | 
| 
      
 39 
     | 
    
         
            +
                      }
         
     | 
| 
       33 
40 
     | 
    
         
             
                      @client.index index: 'test', type: 'd', id: '2', body: {
         
     | 
| 
       34 
41 
     | 
    
         
             
                        title: 'Two',
         
     | 
| 
       35 
     | 
    
         
            -
                         
     | 
| 
      
 42 
     | 
    
         
            +
                        suggest: {
         
     | 
| 
      
 43 
     | 
    
         
            +
                          title: { input: ['two', 'due', 'dvě'] },
         
     | 
| 
      
 44 
     | 
    
         
            +
                          payload: { id: '2' }
         
     | 
| 
      
 45 
     | 
    
         
            +
                        }
         
     | 
| 
      
 46 
     | 
    
         
            +
                      }
         
     | 
| 
       36 
47 
     | 
    
         
             
                      @client.index index: 'test', type: 'd', id: '3', body: {
         
     | 
| 
       37 
48 
     | 
    
         
             
                        title: 'Three',
         
     | 
| 
       38 
     | 
    
         
            -
                         
     | 
| 
      
 49 
     | 
    
         
            +
                        suggest: {
         
     | 
| 
      
 50 
     | 
    
         
            +
                          title: { input: ['three', 'tres', 'tři'] },
         
     | 
| 
      
 51 
     | 
    
         
            +
                          payload: { id: '3' }
         
     | 
| 
      
 52 
     | 
    
         
            +
                        }
         
     | 
| 
      
 53 
     | 
    
         
            +
                      }
         
     | 
| 
       39 
54 
     | 
    
         
             
                      @client.indices.refresh index: 'test'
         
     | 
| 
       40 
55 
     | 
    
         
             
                    end
         
     | 
| 
       41 
56 
     | 
    
         | 
| 
       42 
57 
     | 
    
         
             
                    should "return suggestions" do
         
     | 
| 
       43 
58 
     | 
    
         
             
                      s = search do
         
     | 
| 
       44 
     | 
    
         
            -
                        suggest :title, text: 't', completion: { field: ' 
     | 
| 
      
 59 
     | 
    
         
            +
                        suggest :title, text: 't', completion: { field: 'suggest.title' }
         
     | 
| 
       45 
60 
     | 
    
         
             
                      end
         
     | 
| 
       46 
61 
     | 
    
         | 
| 
       47 
62 
     | 
    
         
             
                      response = @client.search index: 'test', body: s.to_hash
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                      assert_equal 2, response['suggest']['title'][0]['options'].size
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                      assert_same_elements %w[2 3], response['suggest']['title'][0]['options'].map { |d| d['_source']['suggest']['payload']['id'] }
         
     | 
| 
       49 
67 
     | 
    
         
             
                    end
         
     | 
| 
       50 
68 
     | 
    
         | 
| 
       51 
69 
     | 
    
         
             
                    should "return a single suggestion" do
         
     | 
| 
       52 
70 
     | 
    
         
             
                      s = search do
         
     | 
| 
       53 
     | 
    
         
            -
                        suggest :title, text: 'th', completion: { field: ' 
     | 
| 
      
 71 
     | 
    
         
            +
                        suggest :title, text: 'th', completion: { field: 'suggest.title' }
         
     | 
| 
       54 
72 
     | 
    
         
             
                      end
         
     | 
| 
       55 
73 
     | 
    
         | 
| 
       56 
74 
     | 
    
         
             
                      response = @client.search index: 'test', body: s.to_hash
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
       57 
76 
     | 
    
         
             
                      assert_equal 1, response['suggest']['title'][0]['options'].size
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                      assert_same_elements %w[3], response['suggest']['title'][0]['options'].map { |d| d['_source']['suggest']['payload']['id'] }
         
     | 
| 
       58 
79 
     | 
    
         
             
                    end
         
     | 
| 
       59 
80 
     | 
    
         
             
                  end
         
     | 
| 
       60 
81 
     | 
    
         
             
                end
         
     | 
| 
         @@ -34,7 +34,7 @@ module Elasticsearch 
     | 
|
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
                  context "The Search class" do
         
     | 
| 
       36 
36 
     | 
    
         
             
                    startup do
         
     | 
| 
       37 
     | 
    
         
            -
                      Elasticsearch::Extensions::Test::Cluster.start( 
     | 
| 
      
 37 
     | 
    
         
            +
                      Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
         
     | 
| 
       38 
38 
     | 
    
         
             
                    end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
                    setup do
         
     | 
    
        data/test/test_helper.rb
    CHANGED
    
    | 
         @@ -7,12 +7,15 @@ end 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            at_exit { Elasticsearch::Test::IntegrationTestCase.__run_at_exit_hooks }
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
            require ' 
     | 
| 
      
 10 
     | 
    
         
            +
            require 'minitest/autorun'
         
     | 
| 
       11 
11 
     | 
    
         
             
            require 'shoulda-context'
         
     | 
| 
       12 
12 
     | 
    
         
             
            require 'mocha/setup'
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
            require 'minitest/reporters'
         
     | 
| 
       15 
15 
     | 
    
         
             
            Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
         
     | 
| 
      
 16 
     | 
    
         
            +
            # Minitest::Reporters.use! [ Minitest::Reporters::SpecReporter.new,
         
     | 
| 
      
 17 
     | 
    
         
            +
            #                            Minitest::Reporters::JUnitReporter.new,
         
     | 
| 
      
 18 
     | 
    
         
            +
            #                            Minitest::Reporters::HtmlReporter.new ]
         
     | 
| 
       16 
19 
     | 
    
         | 
| 
       17 
20 
     | 
    
         
             
            require 'elasticsearch'
         
     | 
| 
       18 
21 
     | 
    
         
             
            require 'elasticsearch/extensions/test/cluster'
         
     | 
| 
         @@ -22,13 +25,29 @@ require 'elasticsearch/dsl' 
     | 
|
| 
       22 
25 
     | 
    
         | 
| 
       23 
26 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       24 
27 
     | 
    
         
             
              module Test
         
     | 
| 
       25 
     | 
    
         
            -
                 
     | 
| 
      
 28 
     | 
    
         
            +
                module Assertions
         
     | 
| 
      
 29 
     | 
    
         
            +
                  def assert_nothing_raised(*)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    yield
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                class UnitTestCase < ::Minitest::Test
         
     | 
| 
      
 35 
     | 
    
         
            +
                  include Assertions
         
     | 
| 
      
 36 
     | 
    
         
            +
                  alias_method :assert_not_nil, :refute_nil
         
     | 
| 
      
 37 
     | 
    
         
            +
                  alias_method :assert_raise, :assert_raises
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                class IntegrationTestCase < ::Minitest::Test
         
     | 
| 
      
 41 
     | 
    
         
            +
                  include Assertions
         
     | 
| 
      
 42 
     | 
    
         
            +
                  alias_method :assert_not_nil, :refute_nil
         
     | 
| 
      
 43 
     | 
    
         
            +
                  alias_method :assert_raise, :assert_raises
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
       26 
45 
     | 
    
         
             
                  include Elasticsearch::Extensions::Test
         
     | 
| 
       27 
46 
     | 
    
         
             
                  extend  StartupShutdown
         
     | 
| 
       28 
47 
     | 
    
         | 
| 
       29 
48 
     | 
    
         
             
                  startup do
         
     | 
| 
       30 
     | 
    
         
            -
                    Cluster.start( 
     | 
| 
       31 
     | 
    
         
            -
                                            && ! Elasticsearch::Extensions::Test::Cluster.running?
         
     | 
| 
      
 49 
     | 
    
         
            +
                    Cluster.start(number_of_nodes: 1) if ENV['SERVER'] \
         
     | 
| 
      
 50 
     | 
    
         
            +
                                            && ! Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
         
     | 
| 
       32 
51 
     | 
    
         
             
                  end
         
     | 
| 
       33 
52 
     | 
    
         | 
| 
       34 
53 
     | 
    
         
             
                  shutdown do
         
     | 
| 
         @@ -51,7 +70,7 @@ module Elasticsearch 
     | 
|
| 
       51 
70 
     | 
    
         
             
                      ANSI.ansi(severity[0] + ' ', color, :faint) + ANSI.ansi(msg, :white, :faint) + "\n"
         
     | 
| 
       52 
71 
     | 
    
         
             
                    end
         
     | 
| 
       53 
72 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                    @client = Elasticsearch::Client.new host: "localhost:#{@port}", logger: @logger
         
     | 
| 
      
 73 
     | 
    
         
            +
                    @client = Elasticsearch::Client.new host: "localhost:#{@port}", logger: (ENV['QUIET'] ? nil : @logger)
         
     | 
| 
       55 
74 
     | 
    
         
             
                    @version = @client.info['version']['number']
         
     | 
| 
       56 
75 
     | 
    
         
             
                  end
         
     | 
| 
       57 
76 
     | 
    
         | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class CardinalityTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class CardinalityTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "Cardinality agg" do
         
     | 
| 
         @@ -12,21 +12,21 @@ module Elasticsearch 
     | 
|
| 
       12 
12 
     | 
    
         
             
                      should "be converted to a Hash" do
         
     | 
| 
       13 
13 
     | 
    
         
             
                        assert_equal({ cardinality: {} }, subject.to_hash)
         
     | 
| 
       14 
14 
     | 
    
         
             
                      end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       16 
16 
     | 
    
         
             
                      should "have option methods" do
         
     | 
| 
       17 
17 
     | 
    
         
             
                        subject = Cardinality.new :foo
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       19 
19 
     | 
    
         
             
                        subject.field 'bar'
         
     | 
| 
       20 
20 
     | 
    
         
             
                        subject.precision_threshold 'bar'
         
     | 
| 
       21 
21 
     | 
    
         
             
                        subject.rehash 'bar'
         
     | 
| 
       22 
22 
     | 
    
         
             
                        subject.script 'bar'
         
     | 
| 
       23 
23 
     | 
    
         
             
                        subject.params 'bar'
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       25 
25 
     | 
    
         
             
                        assert_equal %w[ field params precision_threshold rehash script ],
         
     | 
| 
       26 
26 
     | 
    
         
             
                                     subject.to_hash[:cardinality][:foo].keys.map(&:to_s).sort
         
     | 
| 
       27 
27 
     | 
    
         
             
                        assert_equal 'bar', subject.to_hash[:cardinality][:foo][:field]
         
     | 
| 
       28 
28 
     | 
    
         
             
                      end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       30 
30 
     | 
    
         
             
                      should "take a block" do
         
     | 
| 
       31 
31 
     | 
    
         
             
                        subject = Cardinality.new :foo do
         
     | 
| 
       32 
32 
     | 
    
         
             
                          field 'bar'
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class ChildrenTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class ChildrenTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "Children aggregation" do
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class DateHistogramTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class DateHistogramTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "DateHistogram aggregation" do
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class DateRangeTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class DateRangeTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "DateRange aggregation" do
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class ExtendedStatsTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class ExtendedStatsTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "ExtendedStats agg" do
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class GeoBoundsTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class GeoBoundsTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "GeoBounds agg" do
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class GeoDistanceTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class GeoDistanceTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "GeoDistance aggregation" do
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class GeohashGridTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class GeohashGridTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "GeohashGrid aggregation" do
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class HistogramTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class HistogramTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "Histogram aggregation" do
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class IpRangeTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class IpRangeTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "IpRange aggregation" do
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class MissingTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class MissingTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "Missing aggregation" do
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class NestedTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class NestedTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "Nested aggregation" do
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class PercentileRanksTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class PercentileRanksTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "PercentileRanks agg" do
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class PercentilesTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class PercentilesTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "Percentiles agg" do
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Elasticsearch
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Test
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Aggregations
         
     | 
| 
       6 
     | 
    
         
            -
                  class AvgBucketTest < ::Test:: 
     | 
| 
      
 6 
     | 
    
         
            +
                  class AvgBucketTest < ::Elasticsearch::Test::UnitTestCase
         
     | 
| 
       7 
7 
     | 
    
         
             
                    include Elasticsearch::DSL::Search::Aggregations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    context "Avg Bucket agg" do
         
     |