Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
19511eb
[API] Updated the compatibility matrix for 5.x
karmi Oct 12, 2016
7d84ad4
[API] Updated the parameters in the "Bulk" API for Elasticsearch 5.x
karmi Oct 18, 2016
cba4d92
[API] Added the `s` parameter to the "Cat" APIs
karmi Oct 18, 2016
172e0a5
[API] Added the `stored_fields` and `_source_*` parameters for Elasti…
karmi Oct 18, 2016
2f52282
[API] Added the "Cat Templates" API
karmi Oct 18, 2016
08e4cd5
[API] Added skipping the `warnings` feature in the YAML runner
karmi Oct 18, 2016
985b4de
Release 5.0.0.pre
karmi Oct 18, 2016
1e1ff36
Release 5.0.0
karmi Nov 7, 2016
7a82c4b
Updated the compatibility matrix in the main README
karmi Nov 16, 2016
6181b62
[API] Added support for the `full_id` parameter in the "Cat Nodes" API
karmi Nov 26, 2016
3efbf9a
[API] Fixed incorrect handling of `skip` declaration in the YAML tests
karmi Nov 26, 2016
2c29c20
[API] Fixed a typo in the "Index" API
Geesu Nov 14, 2016
19eb0c4
[API] Added a check to verify the `action` for YAML tests
karmi Dec 11, 2016
19940d4
[CLIENT] Added support for the `ignore` parameter in all API calls
karmi Dec 11, 2016
2af8aba
[API] Added the `ignore` parameter to "COMMON_QUERY_PARAMS"
karmi Dec 11, 2016
a1df7a8
[DSL] Added missing options to the `bool` query
ocowchun Oct 3, 2016
413437c
[EXT] Fixed incorrect name for the testing cluster "number of nodes" …
zamith Nov 11, 2016
eb4e801
[EXT] Added, that ES process is properly killed when determining version
sly7-7 Dec 5, 2016
6256b6a
[EXT] Fixed failing test for the test cluster
karmi Dec 15, 2016
f691c94
Removed the duplicate gem dependency in `elasticsearch-extensions` Ge…
karmi Dec 14, 2016
1e02d4e
[API] Updated the scan+scroll example for ES 2.x and 5.x
karmi Dec 16, 2016
5a85f63
[EXT] Fixed removing the data directory for ES 5 and 6 in the Test::C…
karmi Dec 16, 2016
6f734ac
[EXT] Improved the instructions for starting the test cluster
karmi Dec 18, 2016
ca2e2c4
[DSL] Allow calling the `filter` method for "Bool" query multiple times
tangopium Nov 12, 2016
73343cf
[DSL] Fixed, that multiple filters in a "Bool" query combine properly
betamatt Dec 13, 2016
c957e66
[DSL] Added getting the ES version in test helper setup
karmi Dec 19, 2016
22ca260
[DSL] Added an integration test for a "Bool" query with multiple filters
karmi Dec 19, 2016
c7f86a3
[DSL] Disabled the `verbose` and `warning` flags for unit and integra…
karmi Dec 19, 2016
537f3b4
[DSL] Added support for the `inner_hits` option of the Nested query
niuage Jun 15, 2016
d3edad3
[CLIENT] Changed `Fixnum` to `Integer` in the check for numerical values
TroySK Jan 2, 2017
d90f3cb
[API] Added the `include_segment_file_sizes` URL parameter to the "In…
karmi Jan 8, 2017
1e10094
[API] Added the 'rewrite' option to "Indices Validate Query" API
bkd Oct 10, 2016
1e464ac
[API] Fixed a typo in the "Ping" API
gaurish Sep 26, 2016
429a60c
[API] Fixed unused variables and bad indentation
yvbaida Aug 20, 2016
966fec4
[DSL] Updated the "More Like This" query
koenpunt Aug 12, 2016
8e601fe
[EXT] Fixed `Errno::ESRCH` exception when killing the process in Test…
betamatt Jan 3, 2017
85b76f3
[DSL] Added the "Exists" query to the DSL
karmi Jan 15, 2017
7301302
[API] Updated the "Delete By Query" API
karmi Jan 20, 2017
6a27fc2
Release 5.0.1
karmi Jan 21, 2017
d6d3002
[CLIENT] Added default value 'application/json' for the 'Content-Type…
karmi Feb 7, 2017
559a0a0
Release 5.0.2
karmi Feb 7, 2017
05cb609
[CLIENT] Added proper handling of headers in client options to the Ma…
karmi Feb 7, 2017
2ed7da0
Release 5.0.3
karmi Feb 7, 2017
009a900
[CLIENT] Fixed the bug with `nil` value of `retry_on_status`
macartur Jan 25, 2017
345a7dc
[CLIENT] Swallow logging of exceptions when the `ignore` is specified
aeroastro Jan 4, 2017
d6e2534
[CLIENT] Fixed double logging of failed responses
karmi Mar 17, 2017
161a8e9
[CLIENT] Fixed incorrect test behaviour when the `QUIET` environment …
karmi Mar 17, 2017
8c71a07
[EXT] Improved the profiling extension
karmi Mar 26, 2017
435b3b8
[API] Improved the YAML test runner
karmi Mar 26, 2017
9837d66
[API] Fixes for the "Scroll" API
karmi Mar 26, 2017
0545a1d
[API] Added missing arguments to the "Exists" API
karmi Mar 26, 2017
572d037
[API] Added missing parameters to the "Indices Clear Cache" API
karmi Mar 26, 2017
62f2e65
[API] Added missing parameters to the "Multi Search" API
karmi Mar 26, 2017
e6cdc9e
[API] Added missing parameters to the "Search" API
karmi Mar 26, 2017
d70b303
[EXT] Improved the error when the Elasticsearch script cannot be found
karmi Dec 18, 2016
2dd3f3f
[EXT] Added, that `Test::Cluster` does not log when ENV['QUIET'] is set
karmi Dec 23, 2016
5f49561
[EXT] Allow setting the `:quiet` parameter for Test::Cluster
karmi Dec 24, 2016
6806a8e
[EXT] Added, that a full path to the Elasticsearch launch script is t…
karmi Jan 15, 2017
49e4fbe
[EXT] Fixed, that `arguments[:timeout]` is used in `wait_for_green` a…
karmi Jan 25, 2017
fa2d8a1
[EXT] Changed, that `Test::Cluster` logs Elasticsearch output when DE…
karmi Jan 26, 2017
5a346cb
[EXT] Fixed incorrect formatting in `Test::Cluster.__cluster_info`
karmi Jan 26, 2017
1818ef0
[EXT] Allow passing the Elasticsearch version to the Test::Cluster ex…
bernabas Feb 21, 2017
c84b8fb
[EXT] Added that the timeout in `__determine_version` is configurable…
karmi Mar 26, 2017
6cf650d
[EXT] Improved the integration test for the `Test::Cluster` extension
karmi Mar 26, 2017
4251a95
[API] Fixed the failing unit tests for "Scroll" APIs
karmi Mar 26, 2017
2f891cc
[API] Changed, that the YAML test content is not printed unless `DEBU…
karmi Mar 26, 2017
d50e93b
[CI] Updated the Travis configuration
karmi Mar 26, 2017
20ad180
[EXT] Fixed failing tests for `Test::Cluster`
karmi Dec 23, 2016
2954d44
[EXT] Fix failing `unit/cluster_test.rb` on Ruby 2.4
karmi Jan 24, 2017
25338c4
[CI] Updated the TEST_BUILD_REF to `5.x`
karmi Mar 27, 2017
8a0dda4
[API] Added the "Field Capabilities" API
karmi Apr 6, 2017
1a0b049
Release 5.0.4
karmi Apr 7, 2017
c092f91
[CI] Updated Eelasticsearch on Travis to 5.3.0
karmi Apr 8, 2017
8a9130b
[API] Aded the "Get Task" API
karmi Jan 25, 2017
1e2d0a9
[API] Fixed handling of parameters in the "Rollover" API
karmi Apr 8, 2017
50c0c1f
[API] Added requirement for the `id` argument for the "Create" API
karmi Apr 8, 2017
f6eef38
[API] Added support for additional parameters to the "Rollover" API
karmi Apr 8, 2017
6974a27
[API] Added support for additional parameters to the "Cluster State" API
karmi Apr 8, 2017
e2f66fc
[API] Fixed incorrect handling of `catch` clauses in the YAML tests r…
karmi Apr 8, 2017
08c156f
[API] Fixed a failing unit test for the "Create Document" API
karmi Apr 8, 2017
be27b6f
[CI] Updated Elasticsearch on Travis to 5.4.0-SNAPSHOT version
karmi Apr 8, 2017
64a3186
[API] Removed unsupported parameters from the "Indices Flush" API
karmi May 15, 2017
796b817
[API] Added the "Remote Info" API
karmi May 4, 2017
2d395ae
[CLIENT] Added escaping of username and password in URL
bhuvanalakshmi Mar 28, 2017
a5864e5
[API] Fixed incorrect URL parameter in "Indices Flush" unit test
karmi May 24, 2017
e95e1cb
[API] Fixed incorrect handling of node ID in the "Nodes Stats" API
karmi Jul 30, 2017
40e4f0a
[DSL] Added the `match_phrase` and `match_phrase_prefix` queries
Jul 5, 2017
8e21fce
[DSL] Removed the `type` field from the "Match" query
Jul 11, 2017
8fbcd5d
[DSL] Added an integration test for the "match phrase prefix" query
karmi Jul 30, 2017
5035fd3
[API] Fix the path for indices exists_type? method & update docs
Sep 13, 2017
a808e27
[CI] Updated Elasticsearch on Travis to 5.5.3
Sep 13, 2017
807178f
[API] Added terminate_after parameter to Count action
dmitry-g Jun 19, 2017
500874d
[CLIENT] Don't block waiting for body on HEAD requests
ctrochalakis May 23, 2017
41595e4
Updated the test code with 'number_of_nodes' arguments when starting …
scouttyg Apr 20, 2017
5f43b98
Updated the compatibility table for 5.x
karmi Nov 15, 2017
c68b93f
Fixed, that trailing slash is removed from URL in Client#__extract_hosts
karmi Nov 20, 2017
1ad82d6
[API] Marked the `percolate` method as deprecated and added an exampl…
karmiq Jan 16, 2018
43f48b2
[API] Fixed, that `Utils.__report_unsupported_parameters` and `Utils.…
karmiq Jan 17, 2018
a9d21dd
[API] Update the Reindex API to support :slices
mstruve Feb 20, 2018
4152c1c
taylors changes
shawnregan Apr 4, 2018
a5dcebc
merge from latest 5.x
shawnregan Apr 26, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ branches:
- master
- travis
- 5.x
- 2.x

matrix:
include:
Expand All @@ -31,14 +30,14 @@ matrix:

- rvm: 2.4.0
jdk: oraclejdk8
env: TEST_SUITE=integration SERVER=start TEST_CLUSTER_LOGS=/tmp/log TEST_BUILD_REF=origin/master TEST_CLUSTER_COMMAND=/tmp/elasticsearch-6.0.0-beta1-SNAPSHOT/bin/elasticsearch
env: TEST_SUITE=integration SERVER=start TEST_CLUSTER_LOGS=/tmp/log TEST_BUILD_REF=origin/5.5 TEST_CLUSTER_COMMAND=/tmp/elasticsearch-5.5.3/bin/elasticsearch

before_install:
- gem update --system
- gem --version
- gem install bundler -v 1.14.3
- bundle version
- curl -sS https://snapshots.elastic.co/downloads/elasticsearch/elasticsearch-6.0.0-beta1-SNAPSHOT.tar.gz | tar xz -C /tmp
- curl -sS https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.3.tar.gz | tar xz -C /tmp
- rake setup
- rake elasticsearch:update

Expand Down
68 changes: 49 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,52 @@
## DSL:0.1.5

* Added support for the ["Exists" Query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html)
* Added missing `like` and `unlike` options to the ["More Like This" Query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html)
* Added missing `time_zone` option to the ["Query String" Query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html)
* Added missing `inner_hits` option to the [Nested Query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html)
* Allow calling the `filter` method for the [Bool Query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html) multiple times
* Added missing `minimum_should_match`, `prefix_length`, `max_expansions`, `fuzzy_rewrite`, `analyzer`, `lenient`, `zero_terms_query` and `cutoff_frequency` options to the [Match Query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html)
* Added missing `minimum_should_match` and `boost` options to the [Bool Query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html)
* Refactored the [Aggregations](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html) collection into its own `AggregationsCollection` class

## EXT:0.0.23

* Fixed removing the data directory for Elasticsearch 5 and 6 in the test cluster
* Added, that Elasticsearch process is properly killed when determining version
* Updated the test cluster class to be compatible Elasticsearch 6.x
* Added `the max_local_storage_nodes` setting to the start command arguments for Elasticsearch 5.x
* Improved the documentation and error messsages for the test cluster
* Updated the "Reindex" extension for Elasticsearch 5.x
## 5.0.4

### Client

* Fixed incorrect test behaviour when the `QUIET` environment variable is set
* Fixed double logging of failed responses
* Swallow logging of exceptions when the `ignore` is specified
* Fixed the bug with `nil` value of `retry_on_status`

### API

* Added the "Field Capabilities" API
* Changed, that the YAML test content is not printed unless `DEBUG` is set
* Fixed the failing unit tests for "Scroll" APIs
* Added missing parameters to the "Search" API
* Added missing parameters to the "Multi Search" API
* Added missing parameters to the "Indices Clear Cache" API
* Added missing arguments to the "Exists" API
* Fixes for the "Scroll" API
* Improved the YAML test runner

## 5.0.3

### Client

* Added proper handling of headers in client options to the Manticore adapter

## 5.0.2

### Client

* Added default value 'application/json' for the 'Content-Type' header

## 5.0.0

### API

* Updated the parameters for Elasticsearch 5.x APIs
* Added Elasticsearch 5.x APIs

## 2.0.0

* Added deprecation notices to API methods and parameters not supported on Elasticsearch 2.x

## 1.1.0

### API

* Added deprecation notices to API methods and arguments not supported on Elasticsearch 1.x

## DSL:0.1.4

Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ namespace :test do

desc "Run unit tests in all subprojects"
task :unit do
Rake::Task['test:ci_reporter'].invoke if ENV['CI']
puts "Ruby [#{RUBY_VERSION}]" if defined? RUBY_VERSION
subprojects.each do |project|
puts '-'*80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ module Actions
#
# @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string for all indices
# @option arguments [Boolean] :force Whether a flush should be forced even if it is not necessarily needed ie.
# if no changes will be committed to the index. (Internal)
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
# no concrete indices. (This includes `_all` string or when no
# indices have been specified)
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
# are open, closed or both. (options: open, closed)
# @option arguments [Boolean] :wait_if_ongoing If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is true. If set to false the flush will be skipped iff if another flush operation is already running.
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
# unavailable (missing, closed, etc)
# @option arguments [Boolean] :wait_if_ongoing If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. If set to false the flush will be skipped if another flush operation is already running. (Default: true)
#
# @see http://www.elasticsearch.org/guide/reference/api/admin-indices-flush/
#
Expand All @@ -29,7 +30,8 @@ def flush(arguments={})
:wait_if_ongoing,
:ignore_unavailable,
:allow_no_indices,
:expand_wildcards ]
:expand_wildcards
]

method = HTTP_POST
path = Utils.__pathify Utils.__listify(arguments[:index]), '_flush'
Expand Down
47 changes: 6 additions & 41 deletions elasticsearch-api/lib/elasticsearch/api/actions/percolate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,11 @@ module Actions
# Percolator allows you to register queries and then evaluate a document against them:
# the IDs of matching queries are returned in the response.
#
# @example Register queries named "alert-1" and "alert-2" for the "my-index" index
# @deprecated The `_percolate` API has been deprecated in favour of a special field mapping and the
# `percolate` query;
# see https://www.elastic.co/guide/en/elasticsearch/reference/5.5/breaking_50_percolator.html
#
# client.index index: 'my-index',
# type: '.percolator',
# id: 'alert-1',
# body: { query: { query_string: { query: 'foo' } } }
#
# client.index index: 'my-index',
# type: '.percolator',
# id: 'alert-2',
# body: { query: { query_string: { query: 'bar' } } }
#
# @example Evaluate a custom document (passed as `:doc`) against the queries
#
# client.percolate index: 'my-index', type: 'my-type', body: { doc: { title: "Foo" } }
# # => {..., matches: [ {_index: 'my-index', _id: 'alert-1'} ]}
#
# client.percolate index: 'my-index', type: 'my-type', body: { doc: { title: "Foo Bar" } }
# # => {..., matches: [ {_index: 'my-index', _id: 'alert-2'}, {_index: 'my-index', _id: 'alert-1'} ] }
#
# @example Evaluate an existing document against the queries
#
# client.index index: 'my-index', type: 'my-type', id: 123, body: { title: "Foo Bar" }
#
# client.percolate index: 'my-index', type: 'my-type', id: '123'
# # => { ..., matches: [ {_index: 'my-index', _id: 'alert-2'}, { _index: 'my-index', _id: 'alert-1'} ] }
#
# @example Register a query with custom `priority` property
#
# client.index index: 'my-index',
# type: '.percolator',
# id: 'alert-high-1',
# body: { query: { query_string: { query: 'foo' } },
# priority: 'high' }
#
# @example Evaluate a document against "high priority" percolator queries
#
# client.percolate index: 'my-index', type: 'my-type', body: {
# doc: { title: "Foo" },
# filter: { term: { priority: 'high' } }
# }
# # => {..., matches: [ {_index: 'my-index', _id: 'alert-high-1'} ]}
# See full example for Elasticsearch 5.x and higher in <https://github.com/elastic/elasticsearch-ruby/blob/master/examples/percolator/percolator_alerts.rb>
#
# @option arguments [String] :index The index of the document being percolated. (*Required*)
# @option arguments [String] :type The type of the document being percolated. (*Required*)
Expand All @@ -75,6 +38,8 @@ module Actions
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-percolate.html
#
def percolate(arguments={})
Utils.__report_unsupported_method :percolate

raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]

Expand Down
7 changes: 5 additions & 2 deletions elasticsearch-api/lib/elasticsearch/api/actions/reindex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ module Actions
# @option arguments [String] :consistency Explicit write consistency setting for the operation
# (Options: one, quorum, all)
# @option arguments [Boolean] :wait_for_completion Whether the request should block and wait until
# the operation has completed
# the operation has completed
# @option arguments [Float] :requests_per_second The throttling for this request in sub-requests per second.
# 0 means set no throttling (default)
# @option arguments [Integer] :slices The number of slices this request should be divided into.
# Defaults to 1 meaning the request isn't sliced into sub-requests.
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html
#
Expand All @@ -56,7 +58,8 @@ def reindex(arguments={})
:timeout,
:consistency,
:wait_for_completion,
:requests_per_second ]
:requests_per_second,
:slices ]
method = 'POST'
path = "_reindex"
params = Utils.__validate_and_extract_params arguments, valid_params
Expand Down
6 changes: 1 addition & 5 deletions elasticsearch-api/lib/elasticsearch/api/actions/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ module Actions
# @option arguments [Boolean] :typed_keys Specify whether aggregation and suggester names should be prefixed by their respective types in the response
# @option arguments [Boolean] :version Specify whether to return document version as part of a hit
# @option arguments [Number] :batched_reduce_size The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.
# @option arguments [Number] :max_concurrent_shard_requests The number of concurrent shard requests this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. The default grows with the number of nodes in the cluster but is at most 256.
# @option arguments [Number] :pre_filter_shard_size A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. (Default: 128)
#
# @return [Hash]
#
Expand Down Expand Up @@ -167,9 +165,7 @@ def search(arguments={})
:timeout,
:typed_keys,
:version,
:batched_reduce_size,
:max_concurrent_shard_requests,
:pre_filter_shard_size ]
:batched_reduce_size ]

method = HTTP_GET
path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), UNDERSCORE_SEARCH )
Expand Down
12 changes: 7 additions & 5 deletions elasticsearch-api/lib/elasticsearch/api/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,12 @@ def __report_unsupported_parameters(arguments, params=[])
end

unless messages.empty?
messages << "Suppress this warning by the `-WO` command line flag."

if STDERR.tty?
STDERR.puts messages.map { |m| "\e[31;1m#{m}\e[0m" }.join("\n")
Kernel.warn messages.map { |m| "\e[31;1m#{m}\e[0m" }.join("\n")
else
STDERR.puts messages.join("\n")
Kernel.warn messages.join("\n")
end
end
end
Expand All @@ -249,12 +251,12 @@ def __report_unsupported_method(name)
message += " in `#{source}`"
end

message += ". This method is not supported in the version you're using: #{Elasticsearch::API::VERSION}, and will be removed in the next release."
message += ". This method is not supported in the version you're using: #{Elasticsearch::API::VERSION}, and will be removed in the next release. Suppress this warning by the `-WO` command line flag."

if STDERR.tty?
STDERR.puts "\e[31;1m#{message}\e[0m"
Kernel.warn "\e[31;1m#{message}\e[0m"
else
STDERR.puts message
Kernel.warn message
end
end

Expand Down
2 changes: 1 addition & 1 deletion elasticsearch-api/lib/elasticsearch/api/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Elasticsearch
module API
VERSION = "6.0.0.pre"
VERSION = "5.0.4"
end
end
16 changes: 8 additions & 8 deletions elasticsearch-api/test/unit/utils_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ class UtilsTest < ::Test::Unit::TestCase
arguments = { :foo => 'bar', :moo => 'bam', :baz => 'qux' }
unsupported_params = [:foo, :moo]

STDERR.expects(:puts).with do |message|
assert_equal 2, message.split("\n").size
Kernel.expects(:warn).with do |message|
assert_equal 2, message.split("\n").reject { |l| l.include? 'Suppress this warning' }.size
true
end

Expand All @@ -265,9 +265,9 @@ class UtilsTest < ::Test::Unit::TestCase
arguments = { :foo => 'bar', :moo => 'bam', :baz => 'qux' }
unsupported_params = [ { :foo => { :explanation => 'NOT_SUPPORTED' } } ]

STDERR.expects(:puts).with do |message|
Kernel.expects(:warn).with do |message|
assert_match /NOT_SUPPORTED/, message
assert_equal 1, message.split("\n").size
assert_equal 1, message.split("\n").reject { |l| l.include? 'Suppress this warning' }.size
true
end

Expand All @@ -278,9 +278,9 @@ class UtilsTest < ::Test::Unit::TestCase
arguments = { :foo => 'bar', :moo => 'bam', :baz => 'qux' }
unsupported_params = [ { :foo => { :explanation => 'NOT_SUPPORTED'} }, :moo ]

STDERR.expects(:puts).with do |message|
Kernel.expects(:warn).with do |message|
assert_match /NOT_SUPPORTED/, message
assert_equal 2, message.split("\n").size
assert_equal 2, message.split("\n").reject { |l| l.include? 'Suppress this warning' }.size
true
end

Expand All @@ -291,15 +291,15 @@ class UtilsTest < ::Test::Unit::TestCase
arguments = { :moo => 'bam', :baz => 'qux' }
unsupported_params = [:foo]

STDERR.expects(:puts).never
Kernel.expects(:warn).never

__report_unsupported_parameters(arguments, unsupported_params)
end
end

context "__report_unsupported_method" do
should "print the warning" do
STDERR.expects(:puts).with do |message|
Kernel.expects(:warn).with do |message|
assert_match /foo/, message
true
end
Expand Down
4 changes: 2 additions & 2 deletions elasticsearch-dsl/lib/elasticsearch/dsl/search/aggregation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ def method_missing(name, *args, &block)
# Defines an aggregation nested in another one
#
def aggregation(*args, &block)
# call
#call
@value.__send__ :aggregation, *args, &block
end

# Returns the aggregations
#
def aggregations
# call
#call
@value.__send__ :aggregations
end

Expand Down
27 changes: 22 additions & 5 deletions elasticsearch-dsl/lib/elasticsearch/dsl/search/queries/exists.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,35 @@ module DSL
module Search
module Queries

# A filter which returns documents which have at least one non-`null` value in the specified field
# (ie. the reverse of the `missing` filter)
# Returns documents that have at least one non-null value in the field.
#
# @example
# @example Find documents with non-empty "name" property
#
# search do
# query do
# exists field: 'occupation'
# exists do
# field 'name'
# end
# end
# end
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/5.0/query-dsl-exists-query.html
# @note The "Exists" query can be used as a "Missing" query in a "Bool" query "Must Not" context.
#
# @example Find documents with an empty "name" property
#
# search do
# query do
# bool do
# must_not do
# exists do
# field 'name'
# end
# end
# end
# end
# end
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/5.1/query-dsl-exists-query.html
#
class Exists
include BaseComponent
Expand Down
Loading