elasticsearch-api 5.0.3 → 5.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3188226786b2679f216c0d53b42b50161807487
4
- data.tar.gz: 180c234ec4778735f237338399e752110f74f3e8
3
+ metadata.gz: 2cb2788ca6e0c1ccc1b739be6fb09f755491fb3c
4
+ data.tar.gz: 3385a2f367ed82e6c039187c6c02c87ff726f2ad
5
5
  SHA512:
6
- metadata.gz: ddbb45d5e61db1ada854c55d12466acc53ead1908e3f89fe4df5e7c30a9c9c0b7cfc3fda09f8531c8863d1715ae6e66b777ee10bc72dfe8e6a91bf9143a05643
7
- data.tar.gz: 9aec54b25b788267b607af4b31bd94bf95ab499d88bd933290d951d555db9b1a49b922b6672a1fe7fde392225ff3cd6688ae556587907da4baf4da00a64ede3e
6
+ metadata.gz: 9cce9772d2b00e7e3075eb9147875db1ed873e8243cd8daf7cb5075ef9576bdff6f9da9d2fd906b6d5d3da353d812f9a15c6c7e7a9c8e17897b56719316b2882
7
+ data.tar.gz: db7a3603ce3702d8cac834774917f1d0b3ddb6960d955ffa50ef584293cc59bc826a6e8f374a5cb15baa38b0bb874acd0edbe2438078137e00f129773f5c59e6
@@ -12,19 +12,10 @@ module Elasticsearch
12
12
  def clear_scroll(arguments={})
13
13
  raise ArgumentError, "Required argument 'scroll_id' missing" unless arguments[:scroll_id]
14
14
 
15
- scroll_id = arguments[:body] || arguments.delete(:scroll_id)
16
-
17
- scroll_ids = case scroll_id
18
- when Array
19
- scroll_id.join(',')
20
- else
21
- scroll_id
22
- end
23
-
24
15
  method = HTTP_DELETE
25
- path = Utils.__pathify '_search/scroll'
16
+ path = Utils.__pathify '_search/scroll', Utils.__listify(arguments.delete(:scroll_id))
26
17
  params = {}
27
- body = scroll_ids
18
+ body = arguments[:body]
28
19
 
29
20
  perform_request(method, path, params, body).body
30
21
  end
@@ -10,13 +10,19 @@ module Elasticsearch
10
10
  #
11
11
  # @option arguments [String] :id The document ID (*Required*)
12
12
  # @option arguments [String] :index The name of the index (*Required*)
13
- # @option arguments [String] :type The type of the document (default: `_all`)
13
+ # @option arguments [String] :type The type of the document (use `_all` to fetch the first document matching the ID across all types) (*Required*)
14
+ # @option arguments [List] :stored_fields A comma-separated list of stored fields to return in the response
14
15
  # @option arguments [String] :parent The ID of the parent document
15
- # @option arguments [String] :preference Specify the node or shard the operation should be performed on
16
- # (default: random)
16
+ # @option arguments [String] :preference Specify the node or shard the operation should be performed on (default: random)
17
17
  # @option arguments [Boolean] :realtime Specify whether to perform the operation in realtime or search mode
18
18
  # @option arguments [Boolean] :refresh Refresh the shard containing the document before performing the operation
19
19
  # @option arguments [String] :routing Specific routing value
20
+ # @option arguments [List] :_source True or false to return the _source field or not, or a list of fields to return
21
+ # @option arguments [List] :_source_exclude A list of fields to exclude from the returned _source field
22
+ # @option arguments [List] :_source_include A list of fields to extract and return from the _source field
23
+ # @option arguments [Number] :version Explicit version number for concurrency control
24
+ # @option arguments [String] :version_type Specific version type (options: internal, external, external_gte, force)
25
+
20
26
  #
21
27
  # @see http://elasticsearch.org/guide/reference/api/get/
22
28
  #
@@ -26,11 +32,17 @@ module Elasticsearch
26
32
  arguments[:type] ||= UNDERSCORE_ALL
27
33
 
28
34
  valid_params = [
35
+ :stored_fields,
29
36
  :parent,
30
37
  :preference,
31
38
  :realtime,
32
39
  :refresh,
33
- :routing ]
40
+ :routing,
41
+ :_source,
42
+ :_source_exclude,
43
+ :_source_include,
44
+ :version,
45
+ :version_type ]
34
46
 
35
47
  method = HTTP_HEAD
36
48
  path = Utils.__pathify Utils.__escape(arguments[:index]),
@@ -0,0 +1,38 @@
1
+ module Elasticsearch
2
+ module API
3
+ module Actions
4
+
5
+ # Return the capabilities of fields among multiple indices
6
+ #
7
+ # @example
8
+ # client.field_caps fields: '*'
9
+ # # => { "fields" => "t"=>{"text"=>{"type"=>"text", "searchable"=>true, "aggregatable"=>false}} ...
10
+ #
11
+ # @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
12
+ # @option arguments [Hash] :body Field json objects containing an array of field names
13
+ # @option arguments [List] :fields A comma-separated list of field names (*Required*)
14
+ # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
15
+ # @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)
16
+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, none, all)
17
+ #
18
+ # @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html
19
+ #
20
+ def field_caps(arguments={})
21
+ raise ArgumentError, "Required argument 'fields' missing" unless arguments[:fields]
22
+
23
+ valid_params = [
24
+ :fields,
25
+ :ignore_unavailable,
26
+ :allow_no_indices,
27
+ :expand_wildcards ]
28
+
29
+ method = HTTP_GET
30
+ path = Utils.__pathify Utils.__listify(arguments[:index]), '_field_caps'
31
+ params = Utils.__validate_and_extract_params arguments, valid_params
32
+ body = arguments[:body]
33
+
34
+ perform_request(method, path, params, body).body
35
+ end
36
+ end
37
+ end
38
+ end
@@ -23,27 +23,17 @@ module Elasticsearch
23
23
  # client.indices.clear_cache field_data: true, fields: 'created_at', filter_cache: false, id_cache: false
24
24
  #
25
25
  # @option arguments [List] :index A comma-separated list of index name to limit the operation
26
- # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
27
- # no concrete indices. (This includes `_all` string or when no
28
- # indices have been specified)
29
- # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
30
- # are open, closed or both. (options: open, closed)
31
26
  # @option arguments [Boolean] :field_data Clear field data
32
27
  # @option arguments [Boolean] :fielddata Clear field data
33
- # @option arguments [List] :fields A comma-separated list of fields to clear when using the
34
- # `field_data` parameter(default: all)
35
- # @option arguments [Boolean] :filter Clear filter caches
36
- # @option arguments [Boolean] :filter_cache Clear filter caches
37
- # @option arguments [List] :filter_keys A comma-separated list of keys to clear when using the
38
- # `filter_cache` parameter (default: all)
39
- # @option arguments [Boolean] :id Clear ID caches for parent/child
40
- # @option arguments [Boolean] :id_cache Clear ID caches for parent/child
41
- # @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
42
- # `missing` ones (options: none, missing) @until 1.0
43
- # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
44
- # unavailable (missing, closed, etc)
28
+ # @option arguments [List] :fields A comma-separated list of fields to clear when using the `field_data` parameter (default: all)
29
+ # @option arguments [Boolean] :query Clear query caches
30
+ # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
31
+ # @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)
32
+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, none, all)
45
33
  # @option arguments [List] :index A comma-separated list of index name to limit the operation
46
34
  # @option arguments [Boolean] :recycler Clear the recycler cache
35
+ # @option arguments [Boolean] :request_cache Clear request cache
36
+ # @option arguments [Boolean] :request Clear request cache
47
37
  #
48
38
  # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clearcache.html
49
39
  #
@@ -52,16 +42,14 @@ module Elasticsearch
52
42
  :field_data,
53
43
  :fielddata,
54
44
  :fields,
55
- :filter,
56
- :filter_cache,
57
- :filter_keys,
58
- :id,
59
- :id_cache,
60
- :ignore_indices,
45
+ :query,
61
46
  :ignore_unavailable,
62
47
  :allow_no_indices,
63
48
  :expand_wildcards,
64
- :recycler ]
49
+ :index,
50
+ :recycler,
51
+ :request_cache,
52
+ :request ]
65
53
 
66
54
  method = HTTP_POST
67
55
  path = Utils.__pathify Utils.__listify(arguments[:index]), '_cache/clear'
@@ -28,16 +28,20 @@ module Elasticsearch
28
28
  #
29
29
  # @option arguments [List] :index A comma-separated list of index names to use as default
30
30
  # @option arguments [List] :type A comma-separated list of document types to use as default
31
- # @option arguments [Array<Hash>] :body An array of request definitions, each definition is a Hash;
32
- # pass the search definition as a `:search` argument
33
- # @option arguments [String] :search_type Search operation type (options: query_then_fetch, query_and_fetch,
34
- # dfs_query_then_fetch, dfs_query_and_fetch, count, scan)
31
+ # @option arguments [Hash] :body The request definitions (metadata-search request definition pairs), separated by newlines (*Required*)
32
+ # @option arguments [String] :search_type Search operation type (options: query_then_fetch, query_and_fetch, dfs_query_then_fetch, dfs_query_and_fetch)
33
+ # @option arguments [Number] :max_concurrent_searches Controls the maximum number of concurrent searches the multi search api will execute
34
+ # @option arguments [Boolean] :typed_keys Specify whether aggregation and suggester names should be prefixed by their respective types in the response
35
35
  #
36
- # @see http://www.elasticsearch.org/guide/reference/api/multi-search/
36
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-multi-search.html
37
37
  #
38
38
  def msearch(arguments={})
39
39
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
40
- valid_params = [ :search_type ]
40
+
41
+ valid_params = [
42
+ :search_type,
43
+ :max_concurrent_searches,
44
+ :typed_keys ]
41
45
 
42
46
  method = HTTP_GET
43
47
  path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_msearch' )
@@ -46,8 +46,7 @@ module Elasticsearch
46
46
  # should be maintained for scrolled search
47
47
  #
48
48
  # @see http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/scan-scroll.html#scan-scroll
49
- # @see http://www.elasticsearch.org/guide/reference/api/search/scroll/
50
- # @see http://www.elasticsearch.org/guide/reference/api/search/search-type/
49
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html
51
50
  #
52
51
  def scroll(arguments={})
53
52
  method = HTTP_GET
@@ -57,7 +56,7 @@ module Elasticsearch
57
56
  :scroll_id ]
58
57
 
59
58
  params = Utils.__validate_and_extract_params arguments, valid_params
60
- body = arguments[:body] || params.delete(:scroll_id)
59
+ body = arguments[:body]
61
60
 
62
61
  perform_request(method, path, params, body).body
63
62
  end
@@ -113,7 +113,9 @@ module Elasticsearch
113
113
  # @option arguments [Text] :suggest_text The source text for which the suggestions should be returned
114
114
  # @option arguments [Number] :terminate_after The maximum number of documents to collect for each shard
115
115
  # @option arguments [Time] :timeout Explicit operation timeout
116
+ # @option arguments [Boolean] :typed_keys Specify whether aggregation and suggester names should be prefixed by their respective types in the response
116
117
  # @option arguments [Boolean] :version Specify whether to return document version as part of a hit
118
+ # @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.
117
119
  #
118
120
  # @return [Hash]
119
121
  #
@@ -161,7 +163,9 @@ module Elasticsearch
161
163
  :suggest_text,
162
164
  :terminate_after,
163
165
  :timeout,
164
- :version ]
166
+ :typed_keys,
167
+ :version,
168
+ :batched_reduce_size ]
165
169
 
166
170
  method = HTTP_GET
167
171
  path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), UNDERSCORE_SEARCH )
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module API
3
- VERSION = "5.0.3"
3
+ VERSION = "5.0.4"
4
4
  end
5
5
  end
@@ -80,6 +80,7 @@ tracer.formatter = proc { |severity, datetime, progname, msg| "#{msg}\n" }
80
80
  #
81
81
  url = ENV.fetch('TEST_CLUSTER_URL', "http://localhost:#{ENV['TEST_CLUSTER_PORT'] || 9250}")
82
82
  $client ||= Elasticsearch::Client.new url: url
83
+ $helper_client ||= Elasticsearch::Client.new url: url
83
84
 
84
85
  $client.transport.logger = logger unless ENV['QUIET'] || ENV['CI']
85
86
  # $client.transport.tracer = tracer if ENV['CI']
@@ -294,20 +295,20 @@ suites.each do |suite|
294
295
  # --- Register context setup -------------------------------------------
295
296
  #
296
297
  setup do
297
- $client.indices.delete index: '_all', ignore: 404
298
- $client.indices.delete_template name: '*', ignore: 404
299
- $client.snapshot.delete repository: 'test_repo_create_1', snapshot: 'test_snapshot', ignore: 404
300
- $client.snapshot.delete repository: 'test_repo_restore_1', snapshot: 'test_snapshot', ignore: 404
301
- $client.snapshot.delete repository: 'test_cat_snapshots_1', snapshot: 'snap1', ignore: 404
302
- $client.snapshot.delete repository: 'test_cat_snapshots_1', snapshot: 'snap2', ignore: 404
303
- $client.snapshot.delete_repository repository: 'test_repo_create_1', ignore: 404
304
- $client.snapshot.delete_repository repository: 'test_repo_restore_1', ignore: 404
305
- $client.snapshot.delete_repository repository: 'test_repo_get_1', ignore: 404
306
- $client.snapshot.delete_repository repository: 'test_repo_get_2', ignore: 404
307
- $client.snapshot.delete_repository repository: 'test_repo_status_1', ignore: 404
308
- $client.snapshot.delete_repository repository: 'test_cat_repo_1', ignore: 404
309
- $client.snapshot.delete_repository repository: 'test_cat_repo_2', ignore: 404
310
- $client.snapshot.delete_repository repository: 'test_cat_snapshots_1', ignore: 404
298
+ $helper_client.indices.delete index: '_all', ignore: 404
299
+ $helper_client.indices.delete_template name: '*', ignore: 404
300
+ $helper_client.snapshot.delete repository: 'test_repo_create_1', snapshot: 'test_snapshot', ignore: 404
301
+ $helper_client.snapshot.delete repository: 'test_repo_restore_1', snapshot: 'test_snapshot', ignore: 404
302
+ $helper_client.snapshot.delete repository: 'test_cat_snapshots_1', snapshot: 'snap1', ignore: 404
303
+ $helper_client.snapshot.delete repository: 'test_cat_snapshots_1', snapshot: 'snap2', ignore: 404
304
+ $helper_client.snapshot.delete_repository repository: 'test_repo_create_1', ignore: 404
305
+ $helper_client.snapshot.delete_repository repository: 'test_repo_restore_1', ignore: 404
306
+ $helper_client.snapshot.delete_repository repository: 'test_repo_get_1', ignore: 404
307
+ $helper_client.snapshot.delete_repository repository: 'test_repo_get_2', ignore: 404
308
+ $helper_client.snapshot.delete_repository repository: 'test_repo_status_1', ignore: 404
309
+ $helper_client.snapshot.delete_repository repository: 'test_cat_repo_1', ignore: 404
310
+ $helper_client.snapshot.delete_repository repository: 'test_cat_repo_2', ignore: 404
311
+ $helper_client.snapshot.delete_repository repository: 'test_cat_snapshots_1', ignore: 404
311
312
  # FIXME: This shouldn't be needed -------------
312
313
  %w[
313
314
  test_cat_repo_1_loc
@@ -326,7 +327,7 @@ suites.each do |suite|
326
327
  # --- Register context teardown ----------------------------------------
327
328
  #
328
329
  teardown do
329
- $client.indices.delete index: '_all', ignore: 404
330
+ $helper_client.indices.delete index: '_all', ignore: 404
330
331
  end
331
332
 
332
333
  files = Dir[suite.join('*.{yml,yaml}')]
@@ -401,7 +402,7 @@ suites.each do |suite|
401
402
  ref = ENV['TEST_BUILD_REF'].to_s.gsub(/origin\//, '') || 'master'
402
403
  $stderr.puts "https://github.com/elasticsearch/elasticsearch/blob/#{ref}/rest-api-spec/test/" \
403
404
  + file.gsub(PATH.to_s, ''), ""
404
- $stderr.puts YAML.dump(test)
405
+ $stderr.puts YAML.dump(test) if ENV['DEBUG']
405
406
  end
406
407
  actions.each do |action|
407
408
  $stderr.puts "ACTION: #{action.inspect}" if ENV['DEBUG']
@@ -10,9 +10,9 @@ module Elasticsearch
10
10
  should "perform correct request" do
11
11
  subject.expects(:perform_request).with do |method, url, params, body|
12
12
  assert_equal 'DELETE', method
13
- assert_equal '_search/scroll', url
14
- assert_equal Hash.new, params
15
- assert_equal 'abc123', body
13
+ assert_equal '_search/scroll/abc123', url
14
+ assert_equal nil, params[:scroll_id]
15
+ assert_equal nil, body
16
16
  true
17
17
  end.returns(FakeResponse.new)
18
18
 
@@ -22,9 +22,9 @@ module Elasticsearch
22
22
  should "listify scroll IDs" do
23
23
  subject.expects(:perform_request).with do |method, url, params, body|
24
24
  assert_equal 'DELETE', method
25
- assert_equal '_search/scroll', url
26
- assert_equal Hash.new, params
27
- assert_equal 'abc123,def456', body
25
+ assert_equal '_search/scroll/abc123,def456', url
26
+ assert_equal nil, params[:scroll_id]
27
+ assert_equal nil, body
28
28
  true
29
29
  end.returns(FakeResponse.new)
30
30
 
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ module Elasticsearch
4
+ module Test
5
+ class FieldCapsTest < ::Test::Unit::TestCase
6
+
7
+ context "Field caps" do
8
+ subject { FakeClient.new }
9
+
10
+ should "perform correct request" do
11
+ subject.expects(:perform_request).with do |method, url, params, body|
12
+ assert_equal 'GET', method
13
+ assert_equal 'foo/_field_caps', url
14
+ assert_equal 'bar', params[:fields]
15
+ assert_equal nil, body
16
+ true
17
+ end.returns(FakeResponse.new)
18
+
19
+ subject.field_caps index: 'foo', fields: 'bar'
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -11,7 +11,8 @@ module Elasticsearch
11
11
  subject.expects(:perform_request).with do |method, url, params, body|
12
12
  assert_equal 'GET', method
13
13
  assert_equal '_search/scroll', url
14
- assert_equal 'cXVlcn...', body
14
+ assert_equal 'cXVlcn...', params[:scroll_id]
15
+ assert_equal nil, body
15
16
  true
16
17
  end.returns(FakeResponse.new)
17
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.3
4
+ version: 5.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-07 00:00:00.000000000 Z
11
+ date: 2017-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -332,8 +332,23 @@ dependencies:
332
332
  - - ">="
333
333
  - !ruby/object:Gem::Version
334
334
  version: '0'
335
- description: |
336
- Ruby API for Elasticsearch. See the `elasticsearch` gem for full integration.
335
+ - !ruby/object:Gem::Dependency
336
+ name: test-unit
337
+ requirement: !ruby/object:Gem::Requirement
338
+ requirements:
339
+ - - "~>"
340
+ - !ruby/object:Gem::Version
341
+ version: '2'
342
+ type: :development
343
+ prerelease: false
344
+ version_requirements: !ruby/object:Gem::Requirement
345
+ requirements:
346
+ - - "~>"
347
+ - !ruby/object:Gem::Version
348
+ version: '2'
349
+ description: 'Ruby API for Elasticsearch. See the `elasticsearch` gem for full integration.
350
+
351
+ '
337
352
  email:
338
353
  - karel.minarik@elasticsearch.org
339
354
  executables: []
@@ -391,6 +406,7 @@ files:
391
406
  - lib/elasticsearch/api/actions/delete_template.rb
392
407
  - lib/elasticsearch/api/actions/exists.rb
393
408
  - lib/elasticsearch/api/actions/explain.rb
409
+ - lib/elasticsearch/api/actions/field_caps.rb
394
410
  - lib/elasticsearch/api/actions/field_stats.rb
395
411
  - lib/elasticsearch/api/actions/get.rb
396
412
  - lib/elasticsearch/api/actions/get_script.rb
@@ -537,6 +553,7 @@ files:
537
553
  - test/unit/delete_template_test.rb
538
554
  - test/unit/exists_document_test.rb
539
555
  - test/unit/explain_document_test.rb
556
+ - test/unit/field_caps_test.rb
540
557
  - test/unit/field_stats_test.rb
541
558
  - test/unit/get_document_source_test.rb
542
559
  - test/unit/get_document_test.rb
@@ -660,7 +677,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
660
677
  version: '0'
661
678
  requirements: []
662
679
  rubyforge_project:
663
- rubygems_version: 2.2.2
680
+ rubygems_version: 2.6.10
664
681
  signing_key:
665
682
  specification_version: 4
666
683
  summary: Ruby API for Elasticsearch.
@@ -710,6 +727,7 @@ test_files:
710
727
  - test/unit/delete_template_test.rb
711
728
  - test/unit/exists_document_test.rb
712
729
  - test/unit/explain_document_test.rb
730
+ - test/unit/field_caps_test.rb
713
731
  - test/unit/field_stats_test.rb
714
732
  - test/unit/get_document_source_test.rb
715
733
  - test/unit/get_document_test.rb