elasticsearch-api 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/elasticsearch-api.gemspec +3 -2
- data/lib/elasticsearch/api.rb +2 -1
- data/lib/elasticsearch/api/actions/abort_benchmark.rb +27 -0
- data/lib/elasticsearch/api/actions/benchmark.rb +62 -0
- data/lib/elasticsearch/api/actions/cat/fielddata.rb +49 -0
- data/lib/elasticsearch/api/actions/cluster/health.rb +5 -1
- data/lib/elasticsearch/api/actions/cluster/state.rb +2 -1
- data/lib/elasticsearch/api/actions/count_percolate.rb +1 -1
- data/lib/elasticsearch/api/actions/delete.rb +1 -1
- data/lib/elasticsearch/api/actions/get.rb +4 -0
- data/lib/elasticsearch/api/actions/index.rb +22 -2
- data/lib/elasticsearch/api/actions/indices/get_template.rb +5 -1
- data/lib/elasticsearch/api/actions/indices/optimize.rb +3 -0
- data/lib/elasticsearch/api/actions/indices/put_template.rb +2 -3
- data/lib/elasticsearch/api/actions/indices/recovery.rb +42 -0
- data/lib/elasticsearch/api/actions/indices/stats.rb +42 -36
- data/lib/elasticsearch/api/actions/list_benchmarks.rb +29 -0
- data/lib/elasticsearch/api/actions/mlt.rb +39 -1
- data/lib/elasticsearch/api/actions/nodes/info.rb +11 -9
- data/lib/elasticsearch/api/actions/percolate.rb +1 -1
- data/lib/elasticsearch/api/actions/scroll.rb +20 -2
- data/lib/elasticsearch/api/actions/search.rb +3 -2
- data/lib/elasticsearch/api/actions/search_shards.rb +41 -0
- data/lib/elasticsearch/api/actions/search_template.rb +61 -0
- data/lib/elasticsearch/api/actions/snapshot/create.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/restore.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/status.rb +40 -0
- data/lib/elasticsearch/api/utils.rb +23 -1
- data/lib/elasticsearch/api/version.rb +1 -1
- data/test/integration/yaml_test_runner.rb +1 -0
- data/test/unit/abort_benchmark_test.rb +26 -0
- data/test/unit/benchmark_test.rb +26 -0
- data/test/unit/cat/fielddata_test.rb +38 -0
- data/test/unit/indices/recovery_test.rb +26 -0
- data/test/unit/indices/stats_test.rb +5 -14
- data/test/unit/list_benchmarks_test.rb +26 -0
- data/test/unit/nodes/info_test.rb +21 -0
- data/test/unit/search_shards_test.rb +26 -0
- data/test/unit/search_template_test.rb +26 -0
- data/test/unit/snapshot/status_test.rb +38 -0
- data/test/unit/utils_test.rb +8 -0
- metadata +43 -53
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZGQwODMzZmNlYjgzMjE4OTQ4OGI4ZGIzM2VkYTA1NjAyZTYwZDI3ZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZjY0YzIzZWUyOTA3YjFkYjFhZjc5NjNlN2UwMWM2NmFhZDViNzZkYw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZmQyYmNiYzI0ODI4MzFiYmExZDU3Njc1ZmVlOGNmMTZkNGUxMWJjNzE3Yzhi
|
10
|
+
ZjllODY2OTAzMjViZDBhZGJkYjU5OGRjNWNhYmE1NzYwM2JlNmM4NDZkZDRl
|
11
|
+
YmVhZDM0MmJkNjhmMzU2MjBlZmYyNjBjMTdmOGQ0NWI3YWRlY2M=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDA5NzA2MjI5MDE1YjE1M2RlYzBjNmM0NTA2MDRjMzlmMTkwODA2M2MwNzc3
|
14
|
+
YjgyM2NkMDZjZTIxZDY2ODIxNzg5NDk3ZjczMDY0Yjg2ZDFhYzIyODI5OTgz
|
15
|
+
ZjcxNmQ3MTg0NTI3NzRjNjVhYTQ3MjYxYjYxODIwZTQ4NDg1Yzg=
|
data/elasticsearch-api.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_development_dependency "elasticsearch-transport"
|
30
30
|
|
31
31
|
if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
|
32
|
+
s.add_development_dependency "minitest", "~> 4.0"
|
32
33
|
s.add_development_dependency "elasticsearch-extensions"
|
33
34
|
end
|
34
35
|
|
@@ -52,13 +53,13 @@ Gem::Specification.new do |s|
|
|
52
53
|
end
|
53
54
|
|
54
55
|
if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
|
55
|
-
s.add_development_dependency "ruby-prof" unless defined?
|
56
|
+
s.add_development_dependency "ruby-prof" unless defined?(JRUBY_VERSION) || defined?(Rubinius)
|
56
57
|
s.add_development_dependency "jbuilder"
|
57
58
|
s.add_development_dependency "escape_utils" unless defined? JRUBY_VERSION
|
58
59
|
s.add_development_dependency "simplecov"
|
59
60
|
s.add_development_dependency "simplecov-rcov"
|
60
61
|
s.add_development_dependency "cane"
|
61
|
-
s.add_development_dependency "require-prof"
|
62
|
+
s.add_development_dependency "require-prof" unless defined?(JRUBY_VERSION) || defined?(Rubinius)
|
62
63
|
s.add_development_dependency "coveralls"
|
63
64
|
end
|
64
65
|
|
data/lib/elasticsearch/api.rb
CHANGED
@@ -21,7 +21,8 @@ module Elasticsearch
|
|
21
21
|
|
22
22
|
COMMON_QUERY_PARAMS = [
|
23
23
|
:format, # Search, Cat, ...
|
24
|
-
:pretty
|
24
|
+
:pretty, # Pretty-print the response
|
25
|
+
:human # Return numeric values in human readable format
|
25
26
|
]
|
26
27
|
|
27
28
|
# Auto-include all namespaces in the receiver
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Actions
|
4
|
+
|
5
|
+
# Abort a running benchmark
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
#
|
9
|
+
# client.abort_benchmark name: 'my_benchmark'
|
10
|
+
#
|
11
|
+
# @option arguments [String] :name A benchmark name
|
12
|
+
#
|
13
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html
|
14
|
+
#
|
15
|
+
def abort_benchmark(arguments={})
|
16
|
+
valid_params = [
|
17
|
+
]
|
18
|
+
method = 'POST'
|
19
|
+
path = "_bench/abort/#{arguments[:name]}"
|
20
|
+
params = {}
|
21
|
+
body = nil
|
22
|
+
|
23
|
+
perform_request(method, path, params, body).body
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Actions
|
4
|
+
|
5
|
+
# Run a single query, or a set of queries, and return statistics on their performance
|
6
|
+
#
|
7
|
+
# @example Return statistics for a single query
|
8
|
+
#
|
9
|
+
# client.benchmark body: {
|
10
|
+
# name: 'my_benchmark',
|
11
|
+
# competitors: [
|
12
|
+
# {
|
13
|
+
# name: 'query_1',
|
14
|
+
# requests: [
|
15
|
+
# { query: { match: { _all: 'a*' } } }
|
16
|
+
# ]
|
17
|
+
# }
|
18
|
+
# ]
|
19
|
+
# }
|
20
|
+
#
|
21
|
+
# @example Return statistics for a set of "competing" queries
|
22
|
+
#
|
23
|
+
# client.benchmark body: {
|
24
|
+
# name: 'my_benchmark',
|
25
|
+
# competitors: [
|
26
|
+
# {
|
27
|
+
# name: 'query_a',
|
28
|
+
# requests: [
|
29
|
+
# { query: { match: { _all: 'a*' } } }
|
30
|
+
# ]
|
31
|
+
# },
|
32
|
+
# {
|
33
|
+
# name: 'query_b',
|
34
|
+
# requests: [
|
35
|
+
# { query: { match: { _all: 'b*' } } }
|
36
|
+
# ]
|
37
|
+
# }
|
38
|
+
# ]
|
39
|
+
# }
|
40
|
+
#
|
41
|
+
# @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string
|
42
|
+
# to perform the operation on all indices
|
43
|
+
# @option arguments [String] :type The name of the document type
|
44
|
+
# @option arguments [Hash] :body The search definition using the Query DSL
|
45
|
+
# @option arguments [Boolean] :verbose Specify whether to return verbose statistics about each iteration
|
46
|
+
# (default: false)
|
47
|
+
#
|
48
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html
|
49
|
+
#
|
50
|
+
def benchmark(arguments={})
|
51
|
+
valid_params = [
|
52
|
+
:verbose ]
|
53
|
+
method = 'PUT'
|
54
|
+
path = "_bench"
|
55
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
56
|
+
body = arguments[:body]
|
57
|
+
|
58
|
+
perform_request(method, path, params, body).body
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Cat
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Return information about field data usage across the cluster
|
7
|
+
#
|
8
|
+
# @example Return the total size of field data
|
9
|
+
#
|
10
|
+
# client.cat.fielddata
|
11
|
+
#
|
12
|
+
# @example Return both the total size and size for specific fields
|
13
|
+
#
|
14
|
+
# client.cat.fielddata fields: 'title,body'
|
15
|
+
#
|
16
|
+
# @option arguments [List] :fields A comma-separated list of fields to include in the output
|
17
|
+
# @option arguments [String] :bytes The unit in which to display byte values (options: b, k, m, g)
|
18
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
19
|
+
# (default: false)
|
20
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
21
|
+
# @option arguments [List] :h Comma-separated list of column names to display
|
22
|
+
# @option arguments [Boolean] :help Return help information
|
23
|
+
# @option arguments [Boolean] :v Verbose mode. Display column headers
|
24
|
+
#
|
25
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-fielddata.html
|
26
|
+
#
|
27
|
+
def fielddata(arguments={})
|
28
|
+
valid_params = [
|
29
|
+
:bytes,
|
30
|
+
:local,
|
31
|
+
:master_timeout,
|
32
|
+
:h,
|
33
|
+
:help,
|
34
|
+
:v,
|
35
|
+
:fields ]
|
36
|
+
|
37
|
+
fields = arguments.delete(:fields)
|
38
|
+
|
39
|
+
method = 'GET'
|
40
|
+
path = Utils.__pathify "_cat/fielddata", Utils.__listify(fields)
|
41
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
42
|
+
body = nil
|
43
|
+
|
44
|
+
perform_request(method, path, params, body).body
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -5,10 +5,14 @@ module Elasticsearch
|
|
5
5
|
|
6
6
|
# Returns information about cluster "health".
|
7
7
|
#
|
8
|
-
# @example
|
8
|
+
# @example Get the cluster health information
|
9
9
|
#
|
10
10
|
# client.cluster.health
|
11
11
|
#
|
12
|
+
# @example Block the request until the cluster is in the "yellow" state
|
13
|
+
#
|
14
|
+
# client.cluster.health wait_for_status: 'yellow'
|
15
|
+
#
|
12
16
|
# @option arguments [String] :index Limit the information returned to a specific index
|
13
17
|
# @option arguments [String] :level Specify the level of detail for returned information
|
14
18
|
# (options: cluster, indices, shards)
|
@@ -12,7 +12,8 @@ module Elasticsearch
|
|
12
12
|
# @option arguments [List] :index A comma-separated list of index names; use `_all` or omit to
|
13
13
|
# perform the operation on all indices
|
14
14
|
# @option arguments [List] :metric Limit the information returned to the specified metrics
|
15
|
-
# (options: _all, blocks, index_templates, metadata, nodes, routing_table
|
15
|
+
# (options: _all, blocks, index_templates, metadata, nodes, routing_table,
|
16
|
+
# master_node, version)
|
16
17
|
# @option arguments [List] :index_templates A comma separated list to return specific index templates when
|
17
18
|
# returning metadata
|
18
19
|
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
@@ -44,7 +44,7 @@ module Elasticsearch
|
|
44
44
|
# @option arguments [String] :percolate_index The index to percolate the document into. Defaults to passed `index`.
|
45
45
|
# @option arguments [String] :percolate_type The type to percolate document into. Defaults to passed `type`.
|
46
46
|
# @option arguments [Number] :version Explicit version number for concurrency control
|
47
|
-
# @option arguments [String] :version_type Specific version type (options: internal, external)
|
47
|
+
# @option arguments [String] :version_type Specific version type (options: internal, external, external_gte, force)
|
48
48
|
#
|
49
49
|
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-percolate.html
|
50
50
|
#
|
@@ -24,7 +24,7 @@ module Elasticsearch
|
|
24
24
|
# @option arguments [String] :routing Specific routing value
|
25
25
|
# @option arguments [Time] :timeout Explicit operation timeout
|
26
26
|
# @option arguments [Number] :version Explicit version number for concurrency control
|
27
|
-
# @option arguments [String] :version_type Specific version type (options: internal, external)
|
27
|
+
# @option arguments [String] :version_type Specific version type (options: internal, external, external_gte, force)
|
28
28
|
#
|
29
29
|
# @see http://elasticsearch.org/guide/reference/api/delete/
|
30
30
|
#
|
@@ -22,6 +22,8 @@ module Elasticsearch
|
|
22
22
|
# @option arguments [Boolean] :realtime Specify whether to perform the operation in realtime or search mode
|
23
23
|
# @option arguments [Boolean] :refresh Refresh the shard containing the document before performing the operation
|
24
24
|
# @option arguments [String] :routing Specific routing value
|
25
|
+
# @option arguments [Number] :version Explicit version number for concurrency control
|
26
|
+
# @option arguments [String] :version_type Specific version type (options: internal, external, external_gte, force)
|
25
27
|
# @option arguments [String] :_source Specify whether the _source field should be returned,
|
26
28
|
# or a list of fields to return
|
27
29
|
# @option arguments [String] :_source_exclude A list of fields to exclude from the returned _source field
|
@@ -41,6 +43,8 @@ module Elasticsearch
|
|
41
43
|
:realtime,
|
42
44
|
:refresh,
|
43
45
|
:routing,
|
46
|
+
:version,
|
47
|
+
:version_type,
|
44
48
|
:_source,
|
45
49
|
:_source_include,
|
46
50
|
:_source_exclude ]
|
@@ -16,7 +16,6 @@ module Elasticsearch
|
|
16
16
|
# By default, the document will be available for {Actions#get} immediately, for {Actions#search} only
|
17
17
|
# after an index refresh operation has been performed (either automatically or manually).
|
18
18
|
#
|
19
|
-
#
|
20
19
|
# @example Create or update a document `myindex/mytype/1`
|
21
20
|
#
|
22
21
|
# client.index index: 'myindex',
|
@@ -30,6 +29,27 @@ module Elasticsearch
|
|
30
29
|
# counter: 1
|
31
30
|
# }
|
32
31
|
#
|
32
|
+
# @example Refresh the index after the operation (useful e.g. in integration tests)
|
33
|
+
#
|
34
|
+
# client.index index: 'myindex', type: 'mytype', id: '1', body: { title: 'TEST' }, refresh: true
|
35
|
+
# client.search index: 'myindex', q: 'title:test'
|
36
|
+
#
|
37
|
+
# @example Create a document with a specific expiration time (TTL)
|
38
|
+
#
|
39
|
+
# # Decrease the default housekeeping interval first:
|
40
|
+
# client.cluster.put_settings body: { transient: { 'indices.ttl.interval' => '1s' } }
|
41
|
+
#
|
42
|
+
# # Enable the `_ttl` property for all types within the index
|
43
|
+
# client.indices.create index: 'myindex', body: { mappings: { mytype: { _ttl: { enabled: true } } } }
|
44
|
+
#
|
45
|
+
# client.index index: 'myindex', type: 'mytype', id: '1', body: { title: 'TEST' }, ttl: '5s'
|
46
|
+
#
|
47
|
+
# sleep 3 and client.get index: 'myindex', type: 'mytype', id: '1'
|
48
|
+
# # => {"_index"=>"myindex" ... "_source"=>{"title"=>"TEST"}}
|
49
|
+
#
|
50
|
+
# sleep 3 and client.get index: 'myindex', type: 'mytype', id: '1'
|
51
|
+
# # => Elasticsearch::Transport::Transport::Errors::NotFound: [404] ...
|
52
|
+
#
|
33
53
|
# @option arguments [String] :id Document ID (optional, will be auto-generated if missing)
|
34
54
|
# @option arguments [String] :index The name of the index (*Required*)
|
35
55
|
# @option arguments [String] :type The type of the document (*Required*)
|
@@ -46,7 +66,7 @@ module Elasticsearch
|
|
46
66
|
# @option arguments [Time] :timestamp Explicit timestamp for the document
|
47
67
|
# @option arguments [Duration] :ttl Expiration time for the document
|
48
68
|
# @option arguments [Number] :version Explicit version number for concurrency control
|
49
|
-
# @option arguments [String] :version_type Specific version type (options: internal, external)
|
69
|
+
# @option arguments [String] :version_type Specific version type (options: internal, external, external_gte, force)
|
50
70
|
#
|
51
71
|
# @see http://elasticsearch.org/guide/reference/api/index_/
|
52
72
|
#
|
@@ -5,13 +5,17 @@ module Elasticsearch
|
|
5
5
|
|
6
6
|
# Get a single index template.
|
7
7
|
#
|
8
|
+
# @example Get all templates
|
9
|
+
#
|
10
|
+
# client.indices.get_template
|
11
|
+
#
|
8
12
|
# @example Get a template named _mytemplate_
|
9
13
|
#
|
10
14
|
# client.indices.get_template name: 'mytemplate'
|
11
15
|
#
|
12
16
|
# @note Use the {Cluster::Actions#state} API to get a list of all templates.
|
13
17
|
#
|
14
|
-
# @option arguments [String] :name The name of the template (
|
18
|
+
# @option arguments [String] :name The name of the template (supports wildcards)
|
15
19
|
#
|
16
20
|
# @see http://www.elasticsearch.org/guide/reference/api/admin-indices-templates/
|
17
21
|
#
|
@@ -25,6 +25,8 @@ module Elasticsearch
|
|
25
25
|
# are open, closed or both. (options: open, closed)
|
26
26
|
# @option arguments [Boolean] :flush Specify whether the index should be flushed after performing the operation
|
27
27
|
# (default: true)
|
28
|
+
# @option arguments [Boolean] :force Force a merge operation to run, even when the index has a single segment
|
29
|
+
# (default: true)
|
28
30
|
# @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
|
29
31
|
# `missing` ones (options: none, missing) @until 1.0
|
30
32
|
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
|
@@ -48,6 +50,7 @@ module Elasticsearch
|
|
48
50
|
:allow_no_indices,
|
49
51
|
:expand_wildcards,
|
50
52
|
:flush,
|
53
|
+
:force,
|
51
54
|
:master_timeout,
|
52
55
|
:max_num_segments,
|
53
56
|
:only_expunge_deletes,
|
@@ -5,11 +5,10 @@ module Elasticsearch
|
|
5
5
|
|
6
6
|
# Create or update an index template.
|
7
7
|
#
|
8
|
-
#
|
9
8
|
# @example Create a template for all indices starting with `logs-`
|
10
9
|
#
|
11
|
-
# client.indices.put_template :
|
12
|
-
# :
|
10
|
+
# client.indices.put_template name: 'foo',
|
11
|
+
# body: { template: 'logs-*', settings: { 'index.number_of_shards' => 1 } }
|
13
12
|
#
|
14
13
|
# @option arguments [String] :name The name of the template (*Required*)
|
15
14
|
# @option arguments [Hash] :body The template definition (*Required*)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Indices
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Return information about shard recovery for one or more indices
|
7
|
+
#
|
8
|
+
# @example Get recovery information for a single index
|
9
|
+
#
|
10
|
+
# client.indices.recovery index: 'foo'
|
11
|
+
#
|
12
|
+
# @example Get detailed recovery information for multiple indices
|
13
|
+
#
|
14
|
+
# client.indices.recovery index: ['foo', 'bar'], detailed: true
|
15
|
+
#
|
16
|
+
# @example Get recovery information for all indices
|
17
|
+
#
|
18
|
+
# client.indices.recovery
|
19
|
+
#
|
20
|
+
# @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
|
21
|
+
# @option arguments [Boolean] :detailed Whether to display detailed information about shard recovery
|
22
|
+
# @option arguments [Boolean] :active_only Display only those recoveries that are currently on-going
|
23
|
+
# @option arguments [Boolean] :human Whether to return time and byte values in human readable format
|
24
|
+
#
|
25
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-recovery.html
|
26
|
+
#
|
27
|
+
def recovery(arguments={})
|
28
|
+
valid_params = [
|
29
|
+
:detailed,
|
30
|
+
:active_only,
|
31
|
+
:human ]
|
32
|
+
method = 'GET'
|
33
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_recovery'
|
34
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
35
|
+
body = nil
|
36
|
+
|
37
|
+
perform_request(method, path, params, body).body
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -9,35 +9,34 @@ module Elasticsearch
|
|
9
9
|
# how much time did indexing, search and other operations take, how much disk space it takes,
|
10
10
|
# how much memory filter caches or field data require, etc.
|
11
11
|
#
|
12
|
-
# @example Get
|
12
|
+
# @example Get all available statistics for all indices
|
13
13
|
#
|
14
14
|
# client.indices.stats
|
15
15
|
#
|
16
|
-
# @example Get
|
16
|
+
# @example Get statistics for a single index
|
17
17
|
#
|
18
|
-
# client.indices.stats index: 'foo'
|
18
|
+
# client.indices.stats index: 'foo'
|
19
19
|
#
|
20
20
|
# @example Get statistics about documents and disk size for multiple indices
|
21
21
|
#
|
22
|
-
# client.indices.stats index: ['foo', 'bar'],
|
22
|
+
# client.indices.stats index: ['foo', 'bar'], docs: true, store: true
|
23
23
|
#
|
24
|
-
# @example Get statistics about filter cache and field data
|
24
|
+
# @example Get statistics about filter cache and field data for all fields
|
25
25
|
#
|
26
|
-
# client.indices.stats
|
26
|
+
# client.indices.stats fielddata: true, filter_cache: true
|
27
27
|
#
|
28
|
-
# @example Get statistics about
|
28
|
+
# @example Get statistics about filter cache and field data for specific fields
|
29
29
|
#
|
30
|
-
# client.indices.stats
|
30
|
+
# client.indices.stats fielddata: true, filter_cache: true, fields: 'created_at,tags'
|
31
31
|
#
|
32
|
-
# @
|
32
|
+
# @example Get statistics about filter cache and field data per field for all fields
|
33
|
+
#
|
34
|
+
# client.indices.stats fielddata: true, filter_cache: true, fields: '*'
|
35
|
+
#
|
36
|
+
# @example Get statistics about searches, with segmentation for different search groups
|
37
|
+
#
|
38
|
+
# client.indices.stats search: true, groups: ['groupA', 'groupB']
|
33
39
|
#
|
34
|
-
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
|
35
|
-
# no concrete indices. (This includes `_all` string or when no
|
36
|
-
# indices have been specified)
|
37
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
|
38
|
-
# are open, closed or both. (options: open, closed)
|
39
|
-
# @option arguments [Boolean] :all Return all available information
|
40
|
-
# @option arguments [Boolean] :clear Reset the default level of detail
|
41
40
|
# @option arguments [Boolean] :docs Return information about indexed and deleted documents
|
42
41
|
# @option arguments [Boolean] :fielddata Return information about field data
|
43
42
|
# @option arguments [Boolean] :fields A comma-separated list of fields for `fielddata` metric (supports wildcards)
|
@@ -46,51 +45,58 @@ module Elasticsearch
|
|
46
45
|
# @option arguments [Boolean] :get Return information about get operations
|
47
46
|
# @option arguments [Boolean] :groups A comma-separated list of search groups for `search` statistics
|
48
47
|
# @option arguments [Boolean] :id_cache Return information about ID cache
|
49
|
-
# @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
|
50
|
-
# `missing` ones (options: none, missing) @until 1.0
|
51
|
-
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
|
52
|
-
# unavailable (missing, closed, etc)
|
53
48
|
# @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string
|
54
49
|
# to perform the operation on all indices
|
55
50
|
# @option arguments [Boolean] :indexing Return information about indexing operations
|
56
|
-
# @option arguments [List] :
|
57
|
-
# in the `indexing` statistics
|
51
|
+
# @option arguments [List] :types A comma-separated list of document types to include in the `indexing` info
|
58
52
|
# @option arguments [Boolean] :merge Return information about merge operations
|
59
53
|
# @option arguments [Boolean] :refresh Return information about refresh operations
|
60
54
|
# @option arguments [Boolean] :search Return information about search operations; use the `groups` parameter to
|
61
55
|
# include information for specific search groups
|
62
|
-
# @option arguments [List] :
|
63
|
-
#
|
56
|
+
# @option arguments [List] :groups A comma-separated list of search groups to include in the `search` statistics
|
57
|
+
# @option arguments [Boolean] :suggest Return information about suggest statistics
|
64
58
|
# @option arguments [Boolean] :store Return information about the size of the index
|
65
59
|
# @option arguments [Boolean] :warmer Return information about warmers
|
60
|
+
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
|
61
|
+
# unavailable (missing, closed, etc)
|
62
|
+
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
|
63
|
+
# no concrete indices. (This includes `_all` string or when no
|
64
|
+
# indices have been specified)
|
65
|
+
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
|
66
|
+
# are open, closed or both. (options: open, closed)
|
66
67
|
#
|
67
|
-
# @see http://elasticsearch.org/guide/reference/
|
68
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-stats.html
|
68
69
|
#
|
69
70
|
def stats(arguments={})
|
70
|
-
|
71
|
-
:all,
|
72
|
-
:clear,
|
71
|
+
valid_parts = [
|
73
72
|
:docs,
|
74
73
|
:fielddata,
|
75
|
-
:fields,
|
76
74
|
:filter_cache,
|
77
75
|
:flush,
|
78
76
|
:get,
|
79
|
-
:groups,
|
80
|
-
:id_cache,
|
81
|
-
:ignore_indices,
|
82
|
-
:ignore_unavailable,
|
83
|
-
:allow_no_indices,
|
84
|
-
:expand_wildcards,
|
85
77
|
:indexing,
|
86
78
|
:merge,
|
87
79
|
:refresh,
|
88
80
|
:search,
|
81
|
+
:suggest,
|
89
82
|
:store,
|
90
83
|
:warmer ]
|
91
84
|
|
85
|
+
valid_params = [
|
86
|
+
:fields,
|
87
|
+
:completion_fields,
|
88
|
+
:fielddata_fields,
|
89
|
+
:groups,
|
90
|
+
:types,
|
91
|
+
:ignore_indices,
|
92
|
+
:ignore_unavailable,
|
93
|
+
:allow_no_indices,
|
94
|
+
:expand_wildcards ]
|
95
|
+
|
92
96
|
method = 'GET'
|
93
|
-
|
97
|
+
|
98
|
+
parts = Utils.__extract_parts arguments, valid_parts
|
99
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_stats', Utils.__listify(parts)
|
94
100
|
|
95
101
|
params = Utils.__validate_and_extract_params arguments, valid_params
|
96
102
|
params[:fields] = Utils.__listify(params[:fields]) if params[:fields]
|