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.
Files changed (274) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -16
  3. data/README.md +51 -18
  4. data/Rakefile +4 -17
  5. data/elasticsearch-dsl.gemspec +3 -16
  6. data/lib/elasticsearch-dsl.rb +3 -16
  7. data/lib/elasticsearch/dsl.rb +4 -16
  8. data/lib/elasticsearch/dsl/search.rb +27 -17
  9. data/lib/elasticsearch/dsl/search/aggregation.rb +6 -17
  10. data/lib/elasticsearch/dsl/search/aggregations/avg.rb +4 -17
  11. data/lib/elasticsearch/dsl/search/aggregations/cardinality.rb +4 -17
  12. data/lib/elasticsearch/dsl/search/aggregations/children.rb +4 -17
  13. data/lib/elasticsearch/dsl/search/aggregations/composite.rb +3 -16
  14. data/lib/elasticsearch/dsl/search/aggregations/date_histogram.rb +4 -17
  15. data/lib/elasticsearch/dsl/search/aggregations/date_range.rb +4 -17
  16. data/lib/elasticsearch/dsl/search/aggregations/extended_stats.rb +3 -16
  17. data/lib/elasticsearch/dsl/search/aggregations/filter.rb +4 -17
  18. data/lib/elasticsearch/dsl/search/aggregations/filters.rb +4 -17
  19. data/lib/elasticsearch/dsl/search/aggregations/geo_bounds.rb +4 -17
  20. data/lib/elasticsearch/dsl/search/aggregations/geo_distance.rb +4 -17
  21. data/lib/elasticsearch/dsl/search/aggregations/geohash_grid.rb +4 -17
  22. data/lib/elasticsearch/dsl/search/aggregations/global.rb +3 -16
  23. data/lib/elasticsearch/dsl/search/aggregations/histogram.rb +4 -17
  24. data/lib/elasticsearch/dsl/search/aggregations/ip_range.rb +4 -17
  25. data/lib/elasticsearch/dsl/search/aggregations/max.rb +4 -17
  26. data/lib/elasticsearch/dsl/search/aggregations/min.rb +4 -17
  27. data/lib/elasticsearch/dsl/search/aggregations/missing.rb +3 -16
  28. data/lib/elasticsearch/dsl/search/aggregations/nested.rb +3 -16
  29. data/lib/elasticsearch/dsl/search/aggregations/percentile_ranks.rb +4 -17
  30. data/lib/elasticsearch/dsl/search/aggregations/percentiles.rb +4 -17
  31. data/lib/elasticsearch/dsl/search/aggregations/pipeline/avg_bucket.rb +3 -16
  32. data/lib/elasticsearch/dsl/search/aggregations/pipeline/bucket_script.rb +3 -16
  33. data/lib/elasticsearch/dsl/search/aggregations/pipeline/bucket_selector.rb +3 -16
  34. data/lib/elasticsearch/dsl/search/aggregations/pipeline/bucket_sort.rb +93 -0
  35. data/lib/elasticsearch/dsl/search/aggregations/pipeline/cumulative_sum.rb +3 -16
  36. data/lib/elasticsearch/dsl/search/aggregations/pipeline/derivative.rb +3 -16
  37. data/lib/elasticsearch/dsl/search/aggregations/pipeline/extended_stats_bucket.rb +3 -16
  38. data/lib/elasticsearch/dsl/search/aggregations/pipeline/max_bucket.rb +3 -16
  39. data/lib/elasticsearch/dsl/search/aggregations/pipeline/min_bucket.rb +3 -16
  40. data/lib/elasticsearch/dsl/search/aggregations/pipeline/moving_avg.rb +3 -16
  41. data/lib/elasticsearch/dsl/search/aggregations/pipeline/percentiles_bucket.rb +3 -16
  42. data/lib/elasticsearch/dsl/search/aggregations/pipeline/serial_diff.rb +3 -16
  43. data/lib/elasticsearch/dsl/search/aggregations/pipeline/stats_bucket.rb +3 -16
  44. data/lib/elasticsearch/dsl/search/aggregations/pipeline/sum_bucket.rb +3 -16
  45. data/lib/elasticsearch/dsl/search/aggregations/range.rb +3 -16
  46. data/lib/elasticsearch/dsl/search/aggregations/reverse_nested.rb +4 -17
  47. data/lib/elasticsearch/dsl/search/aggregations/scripted_metric.rb +4 -17
  48. data/lib/elasticsearch/dsl/search/aggregations/significant_terms.rb +4 -17
  49. data/lib/elasticsearch/dsl/search/aggregations/significant_text.rb +49 -0
  50. data/lib/elasticsearch/dsl/search/aggregations/stats.rb +3 -16
  51. data/lib/elasticsearch/dsl/search/aggregations/sum.rb +4 -17
  52. data/lib/elasticsearch/dsl/search/aggregations/terms.rb +3 -16
  53. data/lib/elasticsearch/dsl/search/aggregations/top_hits.rb +4 -17
  54. data/lib/elasticsearch/dsl/search/aggregations/value_count.rb +4 -17
  55. data/lib/elasticsearch/dsl/search/base_aggregation_component.rb +6 -17
  56. data/lib/elasticsearch/dsl/search/base_component.rb +16 -17
  57. data/lib/elasticsearch/dsl/search/base_compound_filter_component.rb +6 -17
  58. data/lib/elasticsearch/dsl/search/collapse.rb +82 -0
  59. data/lib/elasticsearch/dsl/search/filter.rb +6 -17
  60. data/lib/elasticsearch/dsl/search/filters/and.rb +4 -17
  61. data/lib/elasticsearch/dsl/search/filters/bool.rb +3 -16
  62. data/lib/elasticsearch/dsl/search/filters/exists.rb +4 -17
  63. data/lib/elasticsearch/dsl/search/filters/geo_bounding_box.rb +4 -17
  64. data/lib/elasticsearch/dsl/search/filters/geo_distance.rb +4 -17
  65. data/lib/elasticsearch/dsl/search/filters/geo_distance_range.rb +4 -17
  66. data/lib/elasticsearch/dsl/search/filters/geo_polygon.rb +4 -17
  67. data/lib/elasticsearch/dsl/search/filters/geo_shape.rb +4 -17
  68. data/lib/elasticsearch/dsl/search/filters/geohash_cell.rb +4 -17
  69. data/lib/elasticsearch/dsl/search/filters/has_child.rb +4 -17
  70. data/lib/elasticsearch/dsl/search/filters/has_parent.rb +4 -17
  71. data/lib/elasticsearch/dsl/search/filters/ids.rb +4 -17
  72. data/lib/elasticsearch/dsl/search/filters/indices.rb +4 -17
  73. data/lib/elasticsearch/dsl/search/filters/limit.rb +4 -17
  74. data/lib/elasticsearch/dsl/search/filters/match_all.rb +3 -16
  75. data/lib/elasticsearch/dsl/search/filters/missing.rb +4 -17
  76. data/lib/elasticsearch/dsl/search/filters/nested.rb +4 -17
  77. data/lib/elasticsearch/dsl/search/filters/not.rb +7 -18
  78. data/lib/elasticsearch/dsl/search/filters/or.rb +4 -17
  79. data/lib/elasticsearch/dsl/search/filters/prefix.rb +4 -17
  80. data/lib/elasticsearch/dsl/search/filters/query.rb +4 -17
  81. data/lib/elasticsearch/dsl/search/filters/range.rb +3 -16
  82. data/lib/elasticsearch/dsl/search/filters/regexp.rb +4 -17
  83. data/lib/elasticsearch/dsl/search/filters/script.rb +4 -17
  84. data/lib/elasticsearch/dsl/search/filters/term.rb +3 -16
  85. data/lib/elasticsearch/dsl/search/filters/terms.rb +4 -17
  86. data/lib/elasticsearch/dsl/search/filters/type.rb +4 -17
  87. data/lib/elasticsearch/dsl/search/highlight.rb +3 -16
  88. data/lib/elasticsearch/dsl/search/options.rb +5 -17
  89. data/lib/elasticsearch/dsl/search/queries/bool.rb +4 -17
  90. data/lib/elasticsearch/dsl/search/queries/boosting.rb +4 -17
  91. data/lib/elasticsearch/dsl/search/queries/common.rb +4 -17
  92. data/lib/elasticsearch/dsl/search/queries/constant_score.rb +4 -17
  93. data/lib/elasticsearch/dsl/search/queries/dis_max.rb +4 -17
  94. data/lib/elasticsearch/dsl/search/queries/exists.rb +3 -16
  95. data/lib/elasticsearch/dsl/search/queries/filtered.rb +4 -17
  96. data/lib/elasticsearch/dsl/search/queries/function_score.rb +5 -17
  97. data/lib/elasticsearch/dsl/search/queries/fuzzy.rb +4 -17
  98. data/lib/elasticsearch/dsl/search/queries/fuzzy_like_this.rb +4 -17
  99. data/lib/elasticsearch/dsl/search/queries/fuzzy_like_this_field.rb +4 -17
  100. data/lib/elasticsearch/dsl/search/queries/geo_shape.rb +3 -16
  101. data/lib/elasticsearch/dsl/search/queries/has_child.rb +4 -17
  102. data/lib/elasticsearch/dsl/search/queries/has_parent.rb +4 -17
  103. data/lib/elasticsearch/dsl/search/queries/ids.rb +4 -17
  104. data/lib/elasticsearch/dsl/search/queries/indices.rb +4 -17
  105. data/lib/elasticsearch/dsl/search/queries/inner_hits.rb +120 -0
  106. data/lib/elasticsearch/dsl/search/queries/match.rb +3 -16
  107. data/lib/elasticsearch/dsl/search/queries/match_all.rb +3 -16
  108. data/lib/elasticsearch/dsl/search/queries/match_phrase.rb +3 -16
  109. data/lib/elasticsearch/dsl/search/queries/match_phrase_prefix.rb +3 -16
  110. data/lib/elasticsearch/dsl/search/queries/more_like_this.rb +4 -17
  111. data/lib/elasticsearch/dsl/search/queries/multi_match.rb +4 -17
  112. data/lib/elasticsearch/dsl/search/queries/nested.rb +4 -17
  113. data/lib/elasticsearch/dsl/search/queries/prefix.rb +4 -17
  114. data/lib/elasticsearch/dsl/search/queries/query_string.rb +3 -16
  115. data/lib/elasticsearch/dsl/search/queries/range.rb +3 -16
  116. data/lib/elasticsearch/dsl/search/queries/regexp.rb +4 -17
  117. data/lib/elasticsearch/dsl/search/queries/simple_query_string.rb +4 -17
  118. data/lib/elasticsearch/dsl/search/queries/span_first.rb +4 -17
  119. data/lib/elasticsearch/dsl/search/queries/span_multi.rb +4 -17
  120. data/lib/elasticsearch/dsl/search/queries/span_near.rb +4 -17
  121. data/lib/elasticsearch/dsl/search/queries/span_not.rb +4 -17
  122. data/lib/elasticsearch/dsl/search/queries/span_or.rb +4 -17
  123. data/lib/elasticsearch/dsl/search/queries/span_term.rb +4 -17
  124. data/lib/elasticsearch/dsl/search/queries/template.rb +4 -17
  125. data/lib/elasticsearch/dsl/search/queries/term.rb +3 -16
  126. data/lib/elasticsearch/dsl/search/queries/terms.rb +4 -17
  127. data/lib/elasticsearch/dsl/search/queries/top_children.rb +4 -17
  128. data/lib/elasticsearch/dsl/search/queries/wildcard.rb +4 -17
  129. data/lib/elasticsearch/dsl/search/query.rb +6 -17
  130. data/lib/elasticsearch/dsl/search/sort.rb +3 -16
  131. data/lib/elasticsearch/dsl/search/suggest.rb +3 -16
  132. data/lib/elasticsearch/dsl/utils.rb +3 -16
  133. data/lib/elasticsearch/dsl/version.rb +4 -17
  134. data/spec/elasticsearch/dsl/search/aggregations/avg_spec.rb +3 -16
  135. data/spec/elasticsearch/dsl/search/aggregations/cardinality_spec.rb +3 -16
  136. data/spec/elasticsearch/dsl/search/aggregations/children_spec.rb +3 -16
  137. data/spec/elasticsearch/dsl/search/aggregations/composite_spec.rb +3 -16
  138. data/spec/elasticsearch/dsl/search/aggregations/date_histogram_spec.rb +3 -16
  139. data/spec/elasticsearch/dsl/search/aggregations/date_range_spec.rb +3 -16
  140. data/spec/elasticsearch/dsl/search/aggregations/extended_stats_spec.rb +3 -16
  141. data/spec/elasticsearch/dsl/search/aggregations/filter_spec.rb +3 -16
  142. data/spec/elasticsearch/dsl/search/aggregations/filters_spec.rb +3 -16
  143. data/spec/elasticsearch/dsl/search/aggregations/geo_bounds_spec.rb +3 -16
  144. data/spec/elasticsearch/dsl/search/aggregations/geo_distance_spec.rb +3 -16
  145. data/spec/elasticsearch/dsl/search/aggregations/geo_grid_spec.rb +3 -16
  146. data/spec/elasticsearch/dsl/search/aggregations/global_spec.rb +3 -16
  147. data/spec/elasticsearch/dsl/search/aggregations/historgram_spec.rb +3 -16
  148. data/spec/elasticsearch/dsl/search/aggregations/ip_range_spec.rb +3 -16
  149. data/spec/elasticsearch/dsl/search/aggregations/max_spec.rb +3 -16
  150. data/spec/elasticsearch/dsl/search/aggregations/min_spec.rb +3 -16
  151. data/spec/elasticsearch/dsl/search/aggregations/missing_spec.rb +3 -16
  152. data/spec/elasticsearch/dsl/search/aggregations/nested_spec.rb +3 -16
  153. data/spec/elasticsearch/dsl/search/aggregations/percentile_ranks_spec.rb +3 -16
  154. data/spec/elasticsearch/dsl/search/aggregations/percentiles_spec.rb +3 -16
  155. data/spec/elasticsearch/dsl/search/aggregations/pipeline/avg_bucket_spec.rb +3 -16
  156. data/spec/elasticsearch/dsl/search/aggregations/pipeline/bucket_script_spec.rb +3 -16
  157. data/spec/elasticsearch/dsl/search/aggregations/pipeline/bucket_selector_spec.rb +3 -16
  158. data/spec/elasticsearch/dsl/search/aggregations/pipeline/bucket_sort_spec.rb +91 -0
  159. data/spec/elasticsearch/dsl/search/aggregations/pipeline/cumulative_sum_spec.rb +3 -16
  160. data/spec/elasticsearch/dsl/search/aggregations/pipeline/derivative_spec.rb +3 -16
  161. data/spec/elasticsearch/dsl/search/aggregations/pipeline/extended_stats_bucket_spec.rb +3 -16
  162. data/spec/elasticsearch/dsl/search/aggregations/pipeline/max_bucket_spec.rb +3 -16
  163. data/spec/elasticsearch/dsl/search/aggregations/pipeline/min_bucket_spec.rb +3 -16
  164. data/spec/elasticsearch/dsl/search/aggregations/pipeline/moving_avg_test_spec.rb +3 -16
  165. data/spec/elasticsearch/dsl/search/aggregations/pipeline/percentiles_bucket_spec.rb +3 -16
  166. data/spec/elasticsearch/dsl/search/aggregations/pipeline/serial_diff_spec.rb +3 -16
  167. data/spec/elasticsearch/dsl/search/aggregations/pipeline/stats_bucket_spec.rb +3 -16
  168. data/spec/elasticsearch/dsl/search/aggregations/pipeline/sum_bucket_spec.rb +3 -16
  169. data/spec/elasticsearch/dsl/search/aggregations/range_spec.rb +3 -16
  170. data/spec/elasticsearch/dsl/search/aggregations/reverse_nested_spec.rb +3 -16
  171. data/spec/elasticsearch/dsl/search/aggregations/scripted_metric_spec.rb +3 -16
  172. data/spec/elasticsearch/dsl/search/aggregations/significant_terms_spec.rb +3 -16
  173. data/spec/elasticsearch/dsl/search/aggregations/significant_text_spec.rb +163 -0
  174. data/spec/elasticsearch/dsl/search/aggregations/stats_spec.rb +3 -16
  175. data/spec/elasticsearch/dsl/search/aggregations/sum_spec.rb +3 -16
  176. data/spec/elasticsearch/dsl/search/aggregations/terms_spec.rb +3 -16
  177. data/spec/elasticsearch/dsl/search/aggregations/top_hits_spec.rb +3 -16
  178. data/spec/elasticsearch/dsl/search/aggregations/value_count_spec.rb +3 -16
  179. data/spec/elasticsearch/dsl/search/collapse_spec.rb +80 -0
  180. data/spec/elasticsearch/dsl/search/filters/and_spec.rb +3 -16
  181. data/spec/elasticsearch/dsl/search/filters/bool_spec.rb +3 -16
  182. data/spec/elasticsearch/dsl/search/filters/exists_spec.rb +3 -16
  183. data/spec/elasticsearch/dsl/search/filters/geo_bounding_box_spec.rb +3 -16
  184. data/spec/elasticsearch/dsl/search/filters/geo_distance_range_spec.rb +3 -16
  185. data/spec/elasticsearch/dsl/search/filters/geo_distance_spec.rb +3 -16
  186. data/spec/elasticsearch/dsl/search/filters/geo_polygon_spec.rb +3 -16
  187. data/spec/elasticsearch/dsl/search/filters/geo_shape_spec.rb +3 -16
  188. data/spec/elasticsearch/dsl/search/filters/geohash_cell_spec.rb +3 -16
  189. data/spec/elasticsearch/dsl/search/filters/has_child_spec.rb +3 -16
  190. data/spec/elasticsearch/dsl/search/filters/has_parent_spec.rb +3 -16
  191. data/spec/elasticsearch/dsl/search/filters/ids_spec.rb +3 -16
  192. data/spec/elasticsearch/dsl/search/filters/indices_spec.rb +3 -16
  193. data/spec/elasticsearch/dsl/search/filters/limit_spec.rb +3 -16
  194. data/spec/elasticsearch/dsl/search/filters/match_all_spec.rb +3 -16
  195. data/spec/elasticsearch/dsl/search/filters/missing_spec.rb +3 -16
  196. data/spec/elasticsearch/dsl/search/filters/nested_spec.rb +3 -16
  197. data/spec/elasticsearch/dsl/search/filters/not_spec.rb +3 -16
  198. data/spec/elasticsearch/dsl/search/filters/or_spec.rb +3 -16
  199. data/spec/elasticsearch/dsl/search/filters/prefix_spec.rb +3 -16
  200. data/spec/elasticsearch/dsl/search/filters/query_spec.rb +3 -16
  201. data/spec/elasticsearch/dsl/search/filters/range_spec.rb +3 -16
  202. data/spec/elasticsearch/dsl/search/filters/regexp_spec.rb +3 -16
  203. data/spec/elasticsearch/dsl/search/filters/script_spec.rb +3 -16
  204. data/spec/elasticsearch/dsl/search/filters/term_spec.rb +3 -16
  205. data/spec/elasticsearch/dsl/search/filters/terms_spec.rb +3 -16
  206. data/spec/elasticsearch/dsl/search/filters/type_spec.rb +3 -16
  207. data/spec/elasticsearch/dsl/search/queries/bool_spec.rb +3 -16
  208. data/spec/elasticsearch/dsl/search/queries/boosting_spec.rb +3 -16
  209. data/spec/elasticsearch/dsl/search/queries/common_spec.rb +3 -16
  210. data/spec/elasticsearch/dsl/search/queries/constant_score_spec.rb +3 -16
  211. data/spec/elasticsearch/dsl/search/queries/dis_max_spec.rb +3 -16
  212. data/spec/elasticsearch/dsl/search/queries/exists_spec.rb +3 -16
  213. data/spec/elasticsearch/dsl/search/queries/filtered_spec.rb +3 -16
  214. data/spec/elasticsearch/dsl/search/queries/function_score_spec.rb +14 -16
  215. data/spec/elasticsearch/dsl/search/queries/fuzzy_like_this_field_spec.rb +3 -16
  216. data/spec/elasticsearch/dsl/search/queries/fuzzy_like_this_spec.rb +3 -16
  217. data/spec/elasticsearch/dsl/search/queries/fuzzy_spec.rb +3 -16
  218. data/spec/elasticsearch/dsl/search/queries/geo_shape_spec.rb +3 -16
  219. data/spec/elasticsearch/dsl/search/queries/has_child_spec.rb +3 -16
  220. data/spec/elasticsearch/dsl/search/queries/has_parent_spec.rb +3 -16
  221. data/spec/elasticsearch/dsl/search/queries/ids_spec.rb +3 -16
  222. data/spec/elasticsearch/dsl/search/queries/indices_spec.rb +3 -16
  223. data/spec/elasticsearch/dsl/search/queries/inner_hits_spec.rb +131 -0
  224. data/spec/elasticsearch/dsl/search/queries/match_all_spec.rb +3 -16
  225. data/spec/elasticsearch/dsl/search/queries/match_phrase_prefix_spec.rb +3 -16
  226. data/spec/elasticsearch/dsl/search/queries/match_phrase_spec.rb +3 -16
  227. data/spec/elasticsearch/dsl/search/queries/{mach_spec.rb → match_spec.rb} +3 -16
  228. data/spec/elasticsearch/dsl/search/queries/more_like_this_spec.rb +3 -16
  229. data/spec/elasticsearch/dsl/search/queries/multi_match_spec.rb +3 -16
  230. data/spec/elasticsearch/dsl/search/queries/nested_spec.rb +3 -16
  231. data/spec/elasticsearch/dsl/search/queries/prefix_spec.rb +3 -16
  232. data/spec/elasticsearch/dsl/search/queries/query_string_spec.rb +3 -16
  233. data/spec/elasticsearch/dsl/search/queries/range_spec.rb +3 -16
  234. data/spec/elasticsearch/dsl/search/queries/regexp_spec.rb +3 -16
  235. data/spec/elasticsearch/dsl/search/queries/simple_query_string_spec.rb +3 -16
  236. data/spec/elasticsearch/dsl/search/queries/span_first_spec.rb +3 -16
  237. data/spec/elasticsearch/dsl/search/queries/span_multi_spec.rb +3 -16
  238. data/spec/elasticsearch/dsl/search/queries/span_near_spec.rb +3 -16
  239. data/spec/elasticsearch/dsl/search/queries/span_not_spec.rb +3 -16
  240. data/spec/elasticsearch/dsl/search/queries/span_or_spec.rb +3 -16
  241. data/spec/elasticsearch/dsl/search/queries/span_term_spec.rb +3 -16
  242. data/spec/elasticsearch/dsl/search/queries/template_spec.rb +3 -16
  243. data/spec/elasticsearch/dsl/search/queries/term_spec.rb +3 -16
  244. data/spec/elasticsearch/dsl/search/queries/terms_spec.rb +3 -16
  245. data/spec/elasticsearch/dsl/search/queries/top_children_spec.rb +3 -16
  246. data/spec/elasticsearch/dsl/search/queries/wildcard_spec.rb +3 -16
  247. data/spec/elasticsearch/dsl/search_spec.rb +372 -0
  248. data/spec/spec_helper.rb +3 -16
  249. data/test/integration/search_aggregation_children_test.rb +3 -16
  250. data/test/integration/search_aggregation_geo_test.rb +3 -16
  251. data/test/integration/search_aggregation_nested_test.rb +3 -16
  252. data/test/integration/search_aggregations_test.rb +3 -16
  253. data/test/integration/search_filters_test.rb +3 -16
  254. data/test/integration/search_options_test.rb +3 -16
  255. data/test/integration/search_query_test.rb +3 -16
  256. data/test/integration/search_size_from_test.rb +3 -16
  257. data/test/integration/search_sort_test.rb +3 -16
  258. data/test/integration/search_suggest_test.rb +3 -16
  259. data/test/integration/search_test.rb +3 -16
  260. data/test/test_helper.rb +3 -16
  261. data/test/unit/dsl_test.rb +3 -16
  262. data/test/unit/search_aggregation_test.rb +3 -16
  263. data/test/unit/search_base_aggregation_component_test.rb +3 -16
  264. data/test/unit/search_base_component_test.rb +3 -16
  265. data/test/unit/search_filter_test.rb +3 -16
  266. data/test/unit/search_highlight_test.rb +3 -16
  267. data/test/unit/search_options_test.rb +11 -16
  268. data/test/unit/search_query_test.rb +3 -16
  269. data/test/unit/search_size_from_test.rb +3 -16
  270. data/test/unit/search_sort_test.rb +3 -16
  271. data/test/unit/search_suggest_test.rb +3 -16
  272. data/test/unit/search_test.rb +10 -16
  273. data/test/unit/utils_test.rb +3 -16
  274. metadata +19 -5
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -1,19 +1,6 @@
1
- # Licensed to Elasticsearch B.V. under one or more contributor
2
- # license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright
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 'spec_helper'
19
6
 
@@ -0,0 +1,372 @@
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
4
+
5
+ require 'spec_helper'
6
+
7
+ describe Elasticsearch::DSL::Search do
8
+
9
+ include Elasticsearch::DSL
10
+
11
+ describe '#initialize' do
12
+
13
+ let(:s) do
14
+ search do
15
+ query do
16
+ match title: 'test'
17
+ end
18
+ end
19
+ end
20
+
21
+ let(:expected_hash) do
22
+ { query: { match: { title: 'test' } } }
23
+ end
24
+
25
+ it 'creates the search definition' do
26
+ expect(s.to_hash).to eq(expected_hash)
27
+ end
28
+ end
29
+
30
+ context 'when a block is provided' do
31
+
32
+ context 'when the top-level scope is accessed in the block' do
33
+
34
+ context 'when the method is accessed from within a \'query\' block' do
35
+
36
+ let(:s) do
37
+ def query_value
38
+ { title: 'test' }
39
+ end
40
+
41
+ search do
42
+ query do
43
+ match query_value
44
+ end
45
+ end
46
+ end
47
+
48
+ let(:expected_hash) do
49
+ { query: { match: { title: 'test' } } }
50
+ end
51
+
52
+ it 'allows access to the containing scope' do
53
+ expect(s.to_hash).to eq(expected_hash)
54
+ end
55
+ end
56
+
57
+ context 'when the method is accessed from within a \'base_component\' block' do
58
+
59
+ let(:s) do
60
+ def sort_field
61
+ :category
62
+ end
63
+
64
+ search do
65
+ query do
66
+ match title: 'test'
67
+ end
68
+ sort do
69
+ by sort_field, order: 'desc'
70
+ end
71
+ end
72
+ end
73
+
74
+ let(:expected_hash) do
75
+ { query: { match: { title: 'test' } }, sort: [{ category: { order: 'desc'} }] }
76
+ end
77
+
78
+ it 'allows access to the containing scope' do
79
+ expect(s.to_hash).to eq(expected_hash)
80
+ end
81
+ end
82
+
83
+ context 'when the method is accessed from within a \'_not\' block' do
84
+
85
+ let(:s) do
86
+ def term_field
87
+ :color
88
+ end
89
+
90
+ search do
91
+ query do
92
+ filtered do
93
+ filter do
94
+ _not do
95
+ term term_field => 'red'
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+
103
+ let(:expected_hash) do
104
+ { query: { filtered: { filter: { not: { term: { color: 'red' } } } } } }
105
+ end
106
+
107
+ it 'allows access to the containing scope' do
108
+ expect(s.to_hash).to eq(expected_hash)
109
+ end
110
+ end
111
+
112
+ context 'when the method is accessed from within a \'aggregation\' block' do
113
+
114
+ let(:s) do
115
+ def sum_field
116
+ 'clicks'
117
+ end
118
+
119
+ def aggregation_name
120
+ :sum_clicks
121
+ end
122
+
123
+ search do
124
+ aggregation :clicks_for_tag_one do
125
+ filter terms: { tags: ['one'] } do
126
+ aggregation aggregation_name do
127
+ sum field: sum_field
128
+ end
129
+ end
130
+ end
131
+ end
132
+ end
133
+
134
+ let(:expected_hash) do
135
+ { aggregations: { clicks_for_tag_one: { filter: { terms: { tags: ['one'] } },
136
+ aggregations: { sum_clicks: { sum: { field: 'clicks' } } } } } }
137
+ end
138
+
139
+ it 'allows access to the containing scope' do
140
+ expect(s.to_hash).to eq(expected_hash)
141
+ end
142
+ end
143
+
144
+ context 'when the method is accessed from within a \'filter\' block' do
145
+
146
+ let(:s) do
147
+
148
+ def not_clause(obj)
149
+ obj.instance_eval do
150
+ _not do
151
+ term color: 'red'
152
+ end
153
+ end
154
+ end
155
+
156
+ search do
157
+ query do
158
+ filtered do
159
+ filter do
160
+ not_clause(self)
161
+ end
162
+ end
163
+ end
164
+ end
165
+ end
166
+
167
+ let(:expected_hash) do
168
+ { query: { filtered: { filter: { not: { term: { color: 'red' } } } } } }
169
+ end
170
+
171
+ it 'allows access to the containing scope' do
172
+ expect(s.to_hash).to eq(expected_hash)
173
+ end
174
+ end
175
+
176
+ context 'when the method is accessed from within a \'base_aggregation_component\' block' do
177
+
178
+ let(:s) do
179
+
180
+ def term_field
181
+ :body
182
+ end
183
+
184
+ search do
185
+ aggregation :interesting_terms do
186
+ significant_terms do
187
+ field :body
188
+ end
189
+ end
190
+ end
191
+ end
192
+
193
+ let(:expected_hash) do
194
+ { aggregations: { interesting_terms: { significant_terms: { field: :body } } } }
195
+ end
196
+
197
+ it 'allows access to the containing scope' do
198
+ expect(s.to_hash).to eq(expected_hash)
199
+ end
200
+ end
201
+
202
+ context 'when the method is accessed from within a \'base_compound_filter_component\' block' do
203
+
204
+ let(:s) do
205
+
206
+ def term_field
207
+ 'red'
208
+ end
209
+
210
+ search do
211
+ query do
212
+ filtered do
213
+ filter do
214
+ _and do
215
+ term color: term_field
216
+ term size: 'xxl'
217
+ end
218
+ end
219
+ end
220
+ end
221
+ end
222
+ end
223
+
224
+ let(:expected_hash) do
225
+ { query: { filtered: { filter: { and: [{ term: { color: 'red' } },
226
+ { term: { size: 'xxl' } }] } } } }
227
+ end
228
+
229
+ it 'allows access to the containing scope' do
230
+ expect(s.to_hash).to eq(expected_hash)
231
+ end
232
+ end
233
+ end
234
+
235
+ context 'when other methods are used to construct the query' do
236
+
237
+ def bool_query(obj)
238
+ obj.instance_eval do
239
+ bool do
240
+ must do
241
+ match foo: 'bar'
242
+ end
243
+ filter do
244
+ term foo: 'bar'
245
+ end
246
+ end
247
+ end
248
+ end
249
+
250
+ let(:my_search) do
251
+ search do
252
+ query do
253
+ bool_query(self)
254
+ end
255
+ end
256
+ end
257
+
258
+ it 'allows the subquery to be defined on the calling scope' do
259
+ expect(my_search.to_hash).to eq(query: { bool: { filter: [{ term: { foo: 'bar' } }],
260
+ must: [{ match: { foo: 'bar' } }] } })
261
+ end
262
+ end
263
+ end
264
+
265
+ describe '#collapse' do
266
+
267
+ let(:s) do
268
+ search do
269
+ query do
270
+ match title: 'test'
271
+ end
272
+ collapse :user do
273
+ max_concurrent_group_searches 4
274
+ inner_hits 'last_tweet' do
275
+ size 10
276
+ from 5
277
+ sort do
278
+ by :date, order: 'desc'
279
+ by :likes, order: 'asc'
280
+ end
281
+ end
282
+ end
283
+ end
284
+ end
285
+
286
+ let(:inner_hits_hash) do
287
+ { name: 'last_tweet',
288
+ size: 10,
289
+ from: 5,
290
+ sort: [ { date: { order: 'desc' } },
291
+ { likes: { order: 'asc' } }]
292
+ }
293
+ end
294
+
295
+ let(:expected_hash) do
296
+ { query: { match: { title: 'test' } },
297
+ collapse: { field: :user,
298
+ max_concurrent_group_searches: 4,
299
+ inner_hits: inner_hits_hash } }
300
+ end
301
+
302
+ it 'sets the field name' do
303
+ expect(s.to_hash[:collapse][:field]).to eq(:user)
304
+ end
305
+
306
+ it 'sets the max_concurrent_group_searches option' do
307
+ expect(s.to_hash[:collapse][:max_concurrent_group_searches]).to eq(4)
308
+ end
309
+
310
+ it 'sets the inner_hits' do
311
+ expect(s.to_hash[:collapse][:inner_hits]).to eq(inner_hits_hash)
312
+ end
313
+
314
+ it 'constructs the correct hash' do
315
+ expect(s.to_hash).to eq(expected_hash)
316
+ end
317
+ end
318
+
319
+ describe '#collapse' do
320
+
321
+ let(:s) do
322
+ search do
323
+ query do
324
+ match title: 'test'
325
+ end
326
+ collapse :user do
327
+ max_concurrent_group_searches 4
328
+ inner_hits 'last_tweet' do
329
+ size 10
330
+ from 5
331
+ sort do
332
+ by :date, order: 'desc'
333
+ by :likes, order: 'asc'
334
+ end
335
+ end
336
+ end
337
+ end
338
+ end
339
+
340
+ let(:inner_hits_hash) do
341
+ { name: 'last_tweet',
342
+ size: 10,
343
+ from: 5,
344
+ sort: [ { date: { order: 'desc' } },
345
+ { likes: { order: 'asc' } }]
346
+ }
347
+ end
348
+
349
+ let(:expected_hash) do
350
+ { query: { match: { title: 'test' } },
351
+ collapse: { field: :user,
352
+ max_concurrent_group_searches: 4,
353
+ inner_hits: inner_hits_hash } }
354
+ end
355
+
356
+ it 'sets the field name' do
357
+ expect(s.to_hash[:collapse][:field]).to eq(:user)
358
+ end
359
+
360
+ it 'sets the max_concurrent_group_searches option' do
361
+ expect(s.to_hash[:collapse][:max_concurrent_group_searches]).to eq(4)
362
+ end
363
+
364
+ it 'sets the inner_hits' do
365
+ expect(s.to_hash[:collapse][:inner_hits]).to eq(inner_hits_hash)
366
+ end
367
+
368
+ it 'constructs the correct hash' do
369
+ expect(s.to_hash).to eq(expected_hash)
370
+ end
371
+ end
372
+ end