elasticsearch-api 1.0.0.rc1 → 1.0.0.rc2

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.
data/Gemfile CHANGED
@@ -3,10 +3,14 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in elasticsearch-api.gemspec
4
4
  gemspec
5
5
 
6
- if File.exists? File.expand_path("../../elasticsearch-extensions", __FILE__)
7
- gem 'elasticsearch-extensions', :path => File.expand_path("../../elasticsearch-extensions", __FILE__), :require => true
6
+ if File.exists? File.expand_path("../../elasticsearch/elasticsearch.gemspec", __FILE__)
7
+ gem 'elasticsearch', :path => File.expand_path("../../elasticsearch", __FILE__), :require => false
8
8
  end
9
9
 
10
10
  if File.exists? File.expand_path("../../elasticsearch-transport", __FILE__)
11
11
  gem 'elasticsearch-transport', :path => File.expand_path("../../elasticsearch-transport", __FILE__), :require => true
12
12
  end
13
+
14
+ if File.exists? File.expand_path("../../elasticsearch-extensions", __FILE__)
15
+ gem 'elasticsearch-extensions', :path => File.expand_path("../../elasticsearch-extensions", __FILE__), :require => false
16
+ end
data/README.md CHANGED
@@ -54,17 +54,18 @@ require 'elasticsearch'
54
54
  client = Elasticsearch::Client.new log: true
55
55
 
56
56
  client.index index: 'myindex', type: 'mytype', id: 1, body: { title: 'Test' }
57
- # => {"ok"=>true, "_index"=>"myindex", ...}
57
+ # => {"_index"=>"myindex", ... "created"=>true}
58
58
 
59
59
  client.search index: 'myindex', body: { query: { match: { title: 'test' } } }
60
60
  # => {"took"=>2, ..., "hits"=>{"total":5, ...}}
61
61
  ```
62
62
 
63
- Full documentation is available at <http://rubydoc.info/gems/elasticsearch-api>.
63
+ Full documentation and examples are included as RDoc annotations in the source code
64
+ and available online at <http://rubydoc.info/gems/elasticsearch-api>.
64
65
 
65
66
  ### Usage with a custom client
66
67
 
67
- When you want to mix the library into you own client, it must conform to a following _contract_:
68
+ When you want to mix the library into your own client, it must conform to a following _contract_:
68
69
 
69
70
  * It responds to a `perform_request(method, path, params, body)` method,
70
71
  * the method returns an object with `status`, `body` and `headers` methods.
@@ -17,9 +17,13 @@ module Elasticsearch
17
17
  #
18
18
  # puts client.cat.count index: ['index-a', 'index-b']
19
19
  #
20
+ # @example Display header names in the output
21
+ #
22
+ # puts client.cat.count v: true
23
+ #
20
24
  # @example Return the information as Ruby objects
21
25
  #
22
- # client.cat.allocation format: 'json'
26
+ # client.cat.count format: 'json'
23
27
  #
24
28
  # @option arguments [List] :index A comma-separated list of index names to limit the returned information
25
29
  # @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
@@ -9,6 +9,14 @@ module Elasticsearch
9
9
  #
10
10
  # puts client.cat.health
11
11
  #
12
+ # @example Display header names in the output
13
+ #
14
+ # puts client.cat.health v: true
15
+ #
16
+ # @example Return the information as Ruby objects
17
+ #
18
+ # client.cat.health format: 'json'
19
+ #
12
20
  # @option arguments [Boolean] :ts Whether to display timestamp information
13
21
  # @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
14
22
  # @option arguments [Boolean] :v Display column headers as part of the output
@@ -9,6 +9,14 @@ module Elasticsearch
9
9
  #
10
10
  # puts client.cat.master
11
11
  #
12
+ # @example Display header names in the output
13
+ #
14
+ # puts client.cat.master v: true
15
+ #
16
+ # @example Return the information as Ruby objects
17
+ #
18
+ # client.cat.master format: 'json'
19
+ #
12
20
  # @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
13
21
  # @option arguments [Boolean] :v Display column headers as part of the output
14
22
  # @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
@@ -3,13 +3,35 @@ module Elasticsearch
3
3
  module Cat
4
4
  module Actions
5
5
 
6
- # TODO: Description
6
+ # Display information about cluster topology and nodes statistics
7
7
  #
8
- # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
8
+ # @example Display basic information about nodes in the cluster (host, node name, memory usage, master, etc.)
9
+ #
10
+ # puts client.cat.nodes
11
+ #
12
+ # @example Display header names in the output
13
+ #
14
+ # puts client.cat.nodes v: true
15
+ #
16
+ # @example Display only specific columns in the output (see the `help` parameter)
17
+ #
18
+ # puts client.cat.nodes h: %w(name version jdk disk.avail heap.percent load merges.total_time), v: true
19
+ #
20
+ # @example Display only specific columns in the output, using the short names
21
+ #
22
+ # puts client.cat.nodes h: 'n,v,j,d,hp,l,mtt', v: true
23
+ #
24
+ # @example Return the information as Ruby objects
25
+ #
26
+ # client.cat.nodes format: 'json'
27
+ #
28
+ # @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
29
+ # @option arguments [Boolean] :v Display column headers as part of the output
30
+ # @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
31
+ # @option arguments [Boolean] :help Return information about headers
32
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
33
+ # (default: false)
9
34
  # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
10
- # @option arguments [List] :h Comma-separated list of column names to display
11
- # @option arguments [Boolean] :help Return help information
12
- # @option arguments [Boolean] :v Verbose mode. Display column headers
13
35
  #
14
36
  # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-nodes.html
15
37
  #
@@ -25,7 +47,6 @@ module Elasticsearch
25
47
  path = "_cat/nodes"
26
48
 
27
49
  params = Utils.__validate_and_extract_params arguments, valid_params
28
-
29
50
  params[:h] = Utils.__listify(params[:h]) if params[:h]
30
51
 
31
52
  body = nil
@@ -9,6 +9,14 @@ module Elasticsearch
9
9
  #
10
10
  # puts client.cat.pending_tasks
11
11
  #
12
+ # @example Display header names in the output
13
+ #
14
+ # puts client.cat.pending_tasks v: true
15
+ #
16
+ # @example Return the information as Ruby objects
17
+ #
18
+ # client.cat.pending_tasks format: 'json'
19
+ #
12
20
  # @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
13
21
  # @option arguments [Boolean] :v Display column headers as part of the output
14
22
  # @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
@@ -30,6 +38,7 @@ module Elasticsearch
30
38
  method = 'GET'
31
39
  path = "_cat/pending_tasks"
32
40
  params = Utils.__validate_and_extract_params arguments, valid_params
41
+ params[:h] = Utils.__listify(params[:h]) if params[:h]
33
42
  body = nil
34
43
 
35
44
  perform_request(method, path, params, body).body
@@ -0,0 +1,56 @@
1
+ module Elasticsearch
2
+ module API
3
+ module Cat
4
+ module Actions
5
+
6
+ # Display thread pool statistics across nodes (use the `help` parameter to display a list
7
+ # of avaialable thread pools)
8
+ #
9
+ # @example Display information about all thread pools across nodes
10
+ #
11
+ # puts client.cat.thread_pool
12
+ #
13
+ # @example Display header names in the output
14
+ #
15
+ # puts client.cat.thread_pool v: true
16
+ #
17
+ # @example Display information about the indexing thread pool
18
+ #
19
+ # puts client.cat.thread_pool h: %w(h ip index.active index.size index.queue index.rejected), v: true
20
+ #
21
+ # @example Display information about the indexing and search threads, using the short names
22
+ #
23
+ # puts client.cat.thread_pool h: 'host,ia,is,iq,ir,sa,ss,sq,sr', v: true
24
+ #
25
+ # @option arguments [Boolean] :full_id Display the complete node ID
26
+ # @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
27
+ # @option arguments [Boolean] :v Display column headers as part of the output
28
+ # @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
29
+ # @option arguments [Boolean] :help Return information about headers
30
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
31
+ # (default: false)
32
+ # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
33
+ #
34
+ # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-thread-pool.html
35
+ #
36
+ def thread_pool(arguments={})
37
+ valid_params = [
38
+ :full_id,
39
+ :local,
40
+ :master_timeout,
41
+ :h,
42
+ :help,
43
+ :v ]
44
+
45
+ method = 'GET'
46
+ path = "_cat/thread_pool"
47
+ params = Utils.__validate_and_extract_params arguments, valid_params
48
+ params[:h] = Utils.__listify(params[:h]) if params[:h]
49
+ body = nil
50
+
51
+ perform_request(method, path, params, body).body
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module API
3
- VERSION = "1.0.0.rc1"
3
+ VERSION = "1.0.0.rc2"
4
4
  end
5
5
  end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ module Elasticsearch
4
+ module Test
5
+ class CatThreadPoolTest < ::Test::Unit::TestCase
6
+
7
+ context "Cat: Thread pool" 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 '_cat/thread_pool', url
14
+ assert_equal Hash.new, params
15
+ assert_nil body
16
+ true
17
+ end.returns(FakeResponse.new)
18
+
19
+ subject.cat.thread_pool
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+ end
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc1
4
+ version: 1.0.0.rc2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-09 00:00:00.000000000 Z
12
+ date: 2014-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -410,6 +410,7 @@ files:
410
410
  - lib/elasticsearch/api/actions/cat/pending_tasks.rb
411
411
  - lib/elasticsearch/api/actions/cat/recovery.rb
412
412
  - lib/elasticsearch/api/actions/cat/shards.rb
413
+ - lib/elasticsearch/api/actions/cat/thread_pool.rb
413
414
  - lib/elasticsearch/api/actions/clear_scroll.rb
414
415
  - lib/elasticsearch/api/actions/cluster/get_settings.rb
415
416
  - lib/elasticsearch/api/actions/cluster/health.rb
@@ -508,6 +509,7 @@ files:
508
509
  - test/unit/cat/pending_tasks_test.rb
509
510
  - test/unit/cat/recovery_test.rb
510
511
  - test/unit/cat/shards_test.rb
512
+ - test/unit/cat/thread_pool_test.rb
511
513
  - test/unit/clear_scroll_test.rb
512
514
  - test/unit/client_test.rb
513
515
  - test/unit/cluster/get_settings_test.rb
@@ -629,6 +631,7 @@ test_files:
629
631
  - test/unit/cat/pending_tasks_test.rb
630
632
  - test/unit/cat/recovery_test.rb
631
633
  - test/unit/cat/shards_test.rb
634
+ - test/unit/cat/thread_pool_test.rb
632
635
  - test/unit/clear_scroll_test.rb
633
636
  - test/unit/client_test.rb
634
637
  - test/unit/cluster/get_settings_test.rb