elastomer-client 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +7 -7
- data/docs/README.md +8 -8
- data/docs/client.md +19 -19
- data/docs/cluster.md +8 -8
- data/docs/docs.md +9 -9
- data/docs/index.md +8 -9
- data/lib/elastomer/client.rb +4 -4
- data/lib/elastomer/client/bulk.rb +7 -7
- data/lib/elastomer/client/cluster.rb +10 -10
- data/lib/elastomer/client/delete_by_query.rb +1 -1
- data/lib/elastomer/client/docs.rb +24 -24
- data/lib/elastomer/client/index.rb +51 -37
- data/lib/elastomer/client/multi_search.rb +2 -2
- data/lib/elastomer/client/nodes.rb +4 -4
- data/lib/elastomer/client/repository.rb +6 -6
- data/lib/elastomer/client/scroller.rb +4 -4
- data/lib/elastomer/client/snapshot.rb +6 -6
- data/lib/elastomer/client/template.rb +3 -3
- data/lib/elastomer/client/warmer.rb +3 -3
- data/lib/elastomer/middleware/opaque_id.rb +2 -2
- data/lib/elastomer/notifications.rb +3 -3
- data/lib/elastomer/version.rb +1 -1
- data/test/client/index_test.rb +50 -4
- data/test/test_helper.rb +6 -5
- metadata +3 -3
@@ -30,7 +30,7 @@ module Elastomer
|
|
30
30
|
# :wait_for_nodes - the request waits until the specified number N of nodes is available
|
31
31
|
# :timeout - how long to wait [default is "30s"]
|
32
32
|
#
|
33
|
-
# See
|
33
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html
|
34
34
|
#
|
35
35
|
# Returns the response as a Hash
|
36
36
|
def health( params = {} )
|
@@ -48,7 +48,7 @@ module Elastomer
|
|
48
48
|
# :metrics - list of metrics to select as an Array
|
49
49
|
# :indices - a single index name or an Array of index names
|
50
50
|
#
|
51
|
-
# See
|
51
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-state.html
|
52
52
|
#
|
53
53
|
# Returns the response as a Hash
|
54
54
|
def state( params = {} )
|
@@ -63,7 +63,7 @@ module Elastomer
|
|
63
63
|
#
|
64
64
|
# params - Parameters Hash
|
65
65
|
#
|
66
|
-
# See
|
66
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-stats.html
|
67
67
|
#
|
68
68
|
# Returns the response as a Hash
|
69
69
|
def stats( params = {} )
|
@@ -76,7 +76,7 @@ module Elastomer
|
|
76
76
|
#
|
77
77
|
# params - Parameters Hash
|
78
78
|
#
|
79
|
-
# See
|
79
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-pending.html
|
80
80
|
#
|
81
81
|
# Returns the response as a Hash
|
82
82
|
def pending_tasks( params = {} )
|
@@ -97,7 +97,7 @@ module Elastomer
|
|
97
97
|
#
|
98
98
|
# params - Parameters Hash
|
99
99
|
#
|
100
|
-
# See
|
100
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html
|
101
101
|
#
|
102
102
|
# Returns the response as a Hash
|
103
103
|
def get_settings( params = {} )
|
@@ -113,7 +113,7 @@ module Elastomer
|
|
113
113
|
# body - The new settings as a Hash or a JSON encoded String
|
114
114
|
# params - Parameters Hash
|
115
115
|
#
|
116
|
-
# See
|
116
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html
|
117
117
|
#
|
118
118
|
# Returns the response as a Hash
|
119
119
|
def update_settings( body, params = {} )
|
@@ -143,7 +143,7 @@ module Elastomer
|
|
143
143
|
# { :allocate => { :index => 'test', :shard => 1, :node => 'node3' }}
|
144
144
|
# ])
|
145
145
|
#
|
146
|
-
# See
|
146
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-reroute.html
|
147
147
|
#
|
148
148
|
# Returns the response as a Hash
|
149
149
|
def reroute( commands, params = {} )
|
@@ -166,7 +166,7 @@ module Elastomer
|
|
166
166
|
#
|
167
167
|
# params - Parameters Hash
|
168
168
|
#
|
169
|
-
# See
|
169
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-shutdown.html
|
170
170
|
#
|
171
171
|
# Returns the response as a Hash
|
172
172
|
def shutdown( params = {} )
|
@@ -187,7 +187,7 @@ module Elastomer
|
|
187
187
|
# get_aliases
|
188
188
|
# get_aliases( :index => 'users' )
|
189
189
|
#
|
190
|
-
# See
|
190
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
|
191
191
|
#
|
192
192
|
# Returns the response body as a Hash
|
193
193
|
def get_aliases( params = {} )
|
@@ -213,7 +213,7 @@ module Elastomer
|
|
213
213
|
# { :add => { :index => 'users-2', :alias => 'users' }}
|
214
214
|
# ])
|
215
215
|
#
|
216
|
-
# See
|
216
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
|
217
217
|
#
|
218
218
|
# Returns the response body as a Hash
|
219
219
|
def update_aliases( actions, params = {} )
|
@@ -22,7 +22,7 @@ module Elastomer
|
|
22
22
|
# # same thing but using the URI request method
|
23
23
|
# delete_by_query(nil, { :q => '*:*', :type => 'tweet' })
|
24
24
|
#
|
25
|
-
# See
|
25
|
+
# See https://www.elastic.co/guide/en/elasticsearch/plugins/current/delete-by-query-usage.html
|
26
26
|
#
|
27
27
|
# Returns a Hash of statistics about the delete operations, for example:
|
28
28
|
#
|
@@ -8,7 +8,7 @@ module Elastomer
|
|
8
8
|
# name - The name of the index as a String (optional)
|
9
9
|
# type - The document type as a String (optional)
|
10
10
|
#
|
11
|
-
# See
|
11
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs.html
|
12
12
|
#
|
13
13
|
# Returns a Docs instance.
|
14
14
|
def docs( name = nil, type = nil )
|
@@ -38,8 +38,8 @@ module Elastomer
|
|
38
38
|
# new document will be created using POST semantics.
|
39
39
|
#
|
40
40
|
# There are several other document attributes that control how
|
41
|
-
#
|
42
|
-
# refer to the
|
41
|
+
# Elasticsearch will index the document. They are listed below. Please
|
42
|
+
# refer to the Elasticsearch documentation for a full explanation of each
|
43
43
|
# and how it affects the indexing process.
|
44
44
|
#
|
45
45
|
# :_id
|
@@ -62,7 +62,7 @@ module Elastomer
|
|
62
62
|
# document - The document (as a Hash or JSON encoded String) to add to the index
|
63
63
|
# params - Parameters Hash
|
64
64
|
#
|
65
|
-
# See
|
65
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html
|
66
66
|
#
|
67
67
|
# Returns the response body as a Hash
|
68
68
|
def index( document, params = {} )
|
@@ -88,7 +88,7 @@ module Elastomer
|
|
88
88
|
# params - Parameters Hash
|
89
89
|
# :id - the ID of the document to delete
|
90
90
|
#
|
91
|
-
# See
|
91
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html
|
92
92
|
#
|
93
93
|
# Returns the response body as a Hash
|
94
94
|
def delete( params = {} )
|
@@ -102,7 +102,7 @@ module Elastomer
|
|
102
102
|
# params - Parameters Hash
|
103
103
|
# :id - the ID of the document to get
|
104
104
|
#
|
105
|
-
# See
|
105
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html#docs-get
|
106
106
|
#
|
107
107
|
# Returns the response body as a Hash
|
108
108
|
def get( params = {} )
|
@@ -116,7 +116,7 @@ module Elastomer
|
|
116
116
|
# params - Parameters Hash
|
117
117
|
# :id - the ID of the document to check
|
118
118
|
#
|
119
|
-
# See
|
119
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html#docs-get
|
120
120
|
#
|
121
121
|
# Returns true if the document exists
|
122
122
|
def exists?( params = {} )
|
@@ -131,7 +131,7 @@ module Elastomer
|
|
131
131
|
# params - Parameters Hash
|
132
132
|
# :id - the ID of the document
|
133
133
|
#
|
134
|
-
# See
|
134
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html#_source
|
135
135
|
#
|
136
136
|
# Returns the response body as a Hash
|
137
137
|
def source( params = {} )
|
@@ -139,12 +139,12 @@ module Elastomer
|
|
139
139
|
response.body
|
140
140
|
end
|
141
141
|
|
142
|
-
# Allows to get multiple documents based on an index, type, and id (and possibly routing).
|
142
|
+
# Allows you to get multiple documents based on an index, type, and id (and possibly routing).
|
143
143
|
#
|
144
144
|
# body - The request body as a Hash or a JSON encoded String
|
145
145
|
# params - Parameters Hash
|
146
146
|
#
|
147
|
-
# See
|
147
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html
|
148
148
|
#
|
149
149
|
# Returns the response body as a Hash
|
150
150
|
def multi_get( body, params = {} )
|
@@ -161,7 +161,7 @@ module Elastomer
|
|
161
161
|
# script - The script (as a Hash) used to update the document in place
|
162
162
|
# params - Parameters Hash
|
163
163
|
#
|
164
|
-
# See
|
164
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html
|
165
165
|
#
|
166
166
|
# Returns the response body as a Hash
|
167
167
|
def update( script, params = {} )
|
@@ -189,9 +189,9 @@ module Elastomer
|
|
189
189
|
# # same thing but using the URI request method
|
190
190
|
# search(:q => '*:*', :type => 'tweet')
|
191
191
|
#
|
192
|
-
# See
|
193
|
-
# See
|
194
|
-
# See
|
192
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html
|
193
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-uri-request.html
|
194
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html
|
195
195
|
#
|
196
196
|
# Returns the response body as a hash
|
197
197
|
def search( query, params = nil )
|
@@ -211,7 +211,7 @@ module Elastomer
|
|
211
211
|
# :preference - which shard replicas to execute the search request on
|
212
212
|
# :local - boolean value to use local cluster state
|
213
213
|
#
|
214
|
-
# See
|
214
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html
|
215
215
|
#
|
216
216
|
# Returns the response body as a hash
|
217
217
|
def search_shards( params = {} )
|
@@ -236,7 +236,7 @@ module Elastomer
|
|
236
236
|
# # same thing but using the URI request method
|
237
237
|
# count(:q => '*:*', :type => 'tweet')
|
238
238
|
#
|
239
|
-
# See
|
239
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html
|
240
240
|
#
|
241
241
|
# Returns the response body as a Hash
|
242
242
|
def count( query, params = nil )
|
@@ -300,7 +300,7 @@ module Elastomer
|
|
300
300
|
# params - Parameters Hash
|
301
301
|
# :id - the ID of the document to get
|
302
302
|
#
|
303
|
-
# See
|
303
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html
|
304
304
|
#
|
305
305
|
# Returns the response body as a hash
|
306
306
|
def termvector( params = {} )
|
@@ -311,14 +311,14 @@ module Elastomer
|
|
311
311
|
alias_method :term_vector, :termvector
|
312
312
|
alias_method :term_vectors, :termvector
|
313
313
|
|
314
|
-
# Multi termvectors API allows
|
314
|
+
# Multi termvectors API allows you to get multiple termvectors based on
|
315
315
|
# an index, type and id. The response includes a docs array with all the
|
316
316
|
# fetched termvectors, each element having the structure provided by the
|
317
317
|
# `termvector` API.
|
318
318
|
#
|
319
319
|
# params - Parameters Hash
|
320
320
|
#
|
321
|
-
# See
|
321
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html
|
322
322
|
#
|
323
323
|
# Returns the response body as a hash
|
324
324
|
def multi_termvectors( body, params = {} )
|
@@ -348,7 +348,7 @@ Percolate
|
|
348
348
|
# more_like_this({:from => 5, :size => 10}, :mlt_fields => "title",
|
349
349
|
# :min_term_freq => 1, :type => "doc1", :id => 1)
|
350
350
|
#
|
351
|
-
# See
|
351
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-more-like-this.html
|
352
352
|
#
|
353
353
|
# Returns the response body as a hash
|
354
354
|
def more_like_this( query, params = nil )
|
@@ -372,7 +372,7 @@ Percolate
|
|
372
372
|
#
|
373
373
|
# explain(:q => "message:search", :id => 1)
|
374
374
|
#
|
375
|
-
# See
|
375
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html
|
376
376
|
#
|
377
377
|
# Returns the response body as a hash
|
378
378
|
def explain( query, params = nil )
|
@@ -397,7 +397,7 @@ Percolate
|
|
397
397
|
# # same thing but using the URI query parameter
|
398
398
|
# validate(:q => "post_date:foo", :explain => true)
|
399
399
|
#
|
400
|
-
# See
|
400
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-validate.html
|
401
401
|
#
|
402
402
|
# Returns the response body as a hash
|
403
403
|
def validate( query, params = nil )
|
@@ -453,7 +453,7 @@ Percolate
|
|
453
453
|
# document['_source']
|
454
454
|
# end
|
455
455
|
#
|
456
|
-
# See
|
456
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html
|
457
457
|
#
|
458
458
|
# Returns a new Scroller instance
|
459
459
|
def scroll( query, opts = {} )
|
@@ -509,7 +509,7 @@ Percolate
|
|
509
509
|
# ...
|
510
510
|
# end
|
511
511
|
#
|
512
|
-
# See
|
512
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html
|
513
513
|
#
|
514
514
|
# Returns the response body as a Hash
|
515
515
|
def multi_search( params = {}, &block )
|
@@ -2,7 +2,7 @@ module Elastomer
|
|
2
2
|
class Client
|
3
3
|
|
4
4
|
# Provides access to index-level API commands. An index name is required for
|
5
|
-
# these API calls. If you want to operate on all
|
5
|
+
# these API calls. If you want to operate on all indices - flushing all
|
6
6
|
# indices, for example - then you will need to use the "_all" index name.
|
7
7
|
#
|
8
8
|
# You can override the index name for one-off calls by passing in the
|
@@ -17,7 +17,7 @@ module Elastomer
|
|
17
17
|
|
18
18
|
class Index
|
19
19
|
# Create a new index client for making API requests that pertain to
|
20
|
-
# the health and management individual indexes.
|
20
|
+
# the health and management of individual indexes.
|
21
21
|
#
|
22
22
|
# client - Elastomer::Client used for HTTP requests to the server
|
23
23
|
# name - The name of the index as a String or an Array of names
|
@@ -35,8 +35,8 @@ module Elastomer
|
|
35
35
|
# params - Parameters Hash
|
36
36
|
# :type - optional type mapping as a String
|
37
37
|
#
|
38
|
-
# See
|
39
|
-
# and
|
38
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html
|
39
|
+
# and https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-types-exists.html
|
40
40
|
#
|
41
41
|
# Returns true if the index (or type) exists
|
42
42
|
def exists?( params = {} )
|
@@ -50,7 +50,7 @@ module Elastomer
|
|
50
50
|
# body - The index settings and mappings as a Hash or a JSON encoded String
|
51
51
|
# params - Parameters Hash
|
52
52
|
#
|
53
|
-
# See
|
53
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html
|
54
54
|
#
|
55
55
|
# Returns the response body as a Hash
|
56
56
|
def create( body, params = {} )
|
@@ -62,7 +62,7 @@ module Elastomer
|
|
62
62
|
#
|
63
63
|
# params - Parameters Hash
|
64
64
|
#
|
65
|
-
# See
|
65
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html
|
66
66
|
#
|
67
67
|
# Returns the response body as a Hash
|
68
68
|
def delete( params = {} )
|
@@ -74,7 +74,7 @@ module Elastomer
|
|
74
74
|
#
|
75
75
|
# params - Parameters Hash
|
76
76
|
#
|
77
|
-
# See
|
77
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html
|
78
78
|
#
|
79
79
|
# Returns the response body as a Hash
|
80
80
|
def open( params = {} )
|
@@ -86,7 +86,7 @@ module Elastomer
|
|
86
86
|
#
|
87
87
|
# params - Parameters Hash
|
88
88
|
#
|
89
|
-
# See
|
89
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html
|
90
90
|
#
|
91
91
|
# Returns the response body as a Hash
|
92
92
|
def close( params = {} )
|
@@ -98,7 +98,7 @@ module Elastomer
|
|
98
98
|
#
|
99
99
|
# params - Parameters Hash
|
100
100
|
#
|
101
|
-
# See
|
101
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-settings.html
|
102
102
|
#
|
103
103
|
# Returns the response body as a Hash
|
104
104
|
def get_settings( params = {} )
|
@@ -112,7 +112,7 @@ module Elastomer
|
|
112
112
|
# body - The index settings as a Hash or a JSON encoded String
|
113
113
|
# params - Parameters Hash
|
114
114
|
#
|
115
|
-
# See
|
115
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html
|
116
116
|
#
|
117
117
|
# Returns the response body as a Hash
|
118
118
|
def update_settings( body, params = {} )
|
@@ -126,7 +126,7 @@ module Elastomer
|
|
126
126
|
# params - Parameters Hash
|
127
127
|
# :type - specific document type as a String or Array of Strings
|
128
128
|
#
|
129
|
-
# See
|
129
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html
|
130
130
|
#
|
131
131
|
# Returns the response body as a Hash
|
132
132
|
def get_mapping( params = {} )
|
@@ -141,7 +141,7 @@ module Elastomer
|
|
141
141
|
# body - The mapping values to update as a Hash or a JSON encoded String
|
142
142
|
# params - Parameters Hash
|
143
143
|
#
|
144
|
-
# See
|
144
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html
|
145
145
|
#
|
146
146
|
# Returns the response body as a Hash
|
147
147
|
def update_mapping( type, body, params = {} )
|
@@ -156,7 +156,7 @@ module Elastomer
|
|
156
156
|
# type - Name of the mapping to update as a String
|
157
157
|
# params - Parameters Hash
|
158
158
|
#
|
159
|
-
# See
|
159
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-mapping.html
|
160
160
|
#
|
161
161
|
# Returns the response body as a Hash
|
162
162
|
def delete_mapping( type, params = {} )
|
@@ -168,7 +168,7 @@ module Elastomer
|
|
168
168
|
#
|
169
169
|
# params - Parameters Hash
|
170
170
|
#
|
171
|
-
# See
|
171
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
|
172
172
|
#
|
173
173
|
# Returns the response body as a Hash
|
174
174
|
def get_aliases( params = {} )
|
@@ -181,7 +181,7 @@ module Elastomer
|
|
181
181
|
#
|
182
182
|
# name - Name of the alias to look up
|
183
183
|
# params - Parameters Hash
|
184
|
-
# :ignore_unavailable - What to do
|
184
|
+
# :ignore_unavailable - What to do if a specified index name doesn’t
|
185
185
|
# exist. If set to `true` then those indices are ignored.
|
186
186
|
#
|
187
187
|
# Examples
|
@@ -189,7 +189,7 @@ module Elastomer
|
|
189
189
|
# index.get_alias("*") # returns all aliases for the current index
|
190
190
|
# index.get_alias("issue*") # returns all aliases starting with "issue"
|
191
191
|
#
|
192
|
-
# See
|
192
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
|
193
193
|
#
|
194
194
|
# Returns the response body as a Hash
|
195
195
|
def get_alias( name, params = {} )
|
@@ -208,7 +208,7 @@ module Elastomer
|
|
208
208
|
#
|
209
209
|
# index.add_alias("foo", :routing => "foo")
|
210
210
|
#
|
211
|
-
# See
|
211
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
|
212
212
|
#
|
213
213
|
# Returns the response body as a Hash
|
214
214
|
def add_alias( name, params = {} )
|
@@ -226,7 +226,7 @@ module Elastomer
|
|
226
226
|
# index.delete_alias("foo")
|
227
227
|
# index.delete_alias(["foo", "bar"])
|
228
228
|
#
|
229
|
-
# See
|
229
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
|
230
230
|
#
|
231
231
|
# Returns the response body as a Hash
|
232
232
|
def delete_alias( name, params = {} )
|
@@ -234,12 +234,13 @@ module Elastomer
|
|
234
234
|
response.body
|
235
235
|
end
|
236
236
|
|
237
|
-
#
|
237
|
+
# Perform the analysis process on some text and return the tokens
|
238
|
+
# breakdown of the text.
|
238
239
|
#
|
239
240
|
# text - The text to analyze as a String
|
240
241
|
# params - Parameters Hash
|
241
242
|
#
|
242
|
-
# See
|
243
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html
|
243
244
|
#
|
244
245
|
# Returns the response body as a Hash
|
245
246
|
def analyze( text, params = {} )
|
@@ -253,7 +254,7 @@ module Elastomer
|
|
253
254
|
# params - Parameters Hash
|
254
255
|
# :index - set to "_all" to refresh all indices
|
255
256
|
#
|
256
|
-
# See
|
257
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-refresh.html
|
257
258
|
#
|
258
259
|
# Returns the response body as a Hash
|
259
260
|
def refresh( params = {} )
|
@@ -266,7 +267,7 @@ module Elastomer
|
|
266
267
|
# params - Parameters Hash
|
267
268
|
# :index - set to "_all" to flush all indices
|
268
269
|
#
|
269
|
-
# See
|
270
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-flush.html
|
270
271
|
#
|
271
272
|
# Returns the response body as a Hash
|
272
273
|
def flush( params = {} )
|
@@ -280,7 +281,7 @@ module Elastomer
|
|
280
281
|
# params - Parameters Hash
|
281
282
|
# :index - set to "_all" to optimize all indices
|
282
283
|
#
|
283
|
-
# See
|
284
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-optimize.html
|
284
285
|
#
|
285
286
|
# Returns the response body as a Hash
|
286
287
|
def optimize( params = {} )
|
@@ -296,7 +297,7 @@ module Elastomer
|
|
296
297
|
#
|
297
298
|
# params - Parameters Hash
|
298
299
|
#
|
299
|
-
# See
|
300
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/0.90/indices-gateway-snapshot.html
|
300
301
|
#
|
301
302
|
# Returns the response body as a Hash
|
302
303
|
def snapshot( params = {} )
|
@@ -304,12 +305,12 @@ module Elastomer
|
|
304
305
|
response.body
|
305
306
|
end
|
306
307
|
|
307
|
-
# Provides insight into
|
308
|
+
# Provides insight into ongoing index shard recoveries. Recovery status
|
308
309
|
# may be reported for specific indices, or cluster-wide.
|
309
310
|
#
|
310
311
|
# params - Parameters Hash
|
311
312
|
#
|
312
|
-
# See
|
313
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-recovery.html
|
313
314
|
#
|
314
315
|
# Returns the response body as a Hash
|
315
316
|
def recovery( params = {} )
|
@@ -323,7 +324,7 @@ module Elastomer
|
|
323
324
|
# params - Parameters Hash
|
324
325
|
# :index - set to "_all" to clear all index caches
|
325
326
|
#
|
326
|
-
# See
|
327
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clearcache.html
|
327
328
|
#
|
328
329
|
# Returns the response body as a Hash
|
329
330
|
def clear_cache( params = {} )
|
@@ -336,7 +337,7 @@ module Elastomer
|
|
336
337
|
#
|
337
338
|
# params - Parameters Hash
|
338
339
|
#
|
339
|
-
# See
|
340
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html
|
340
341
|
#
|
341
342
|
# Returns the response body as a Hash
|
342
343
|
def stats( params = {} )
|
@@ -351,7 +352,7 @@ module Elastomer
|
|
351
352
|
#
|
352
353
|
# params - Parameters Hash
|
353
354
|
#
|
354
|
-
# See
|
355
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-status.html
|
355
356
|
#
|
356
357
|
# Returns the response body as a Hash
|
357
358
|
def status( params = {} )
|
@@ -364,7 +365,7 @@ module Elastomer
|
|
364
365
|
#
|
365
366
|
# params - Parameters Hash
|
366
367
|
#
|
367
|
-
# See
|
368
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-segments.html
|
368
369
|
#
|
369
370
|
# Returns the response body as a Hash
|
370
371
|
def segments( params = {} )
|
@@ -377,13 +378,26 @@ module Elastomer
|
|
377
378
|
#
|
378
379
|
# type - The document type as a String
|
379
380
|
#
|
380
|
-
# See
|
381
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs.html
|
381
382
|
#
|
382
383
|
# Returns a Docs instance.
|
383
384
|
def docs( type = nil )
|
384
385
|
client.docs name, type
|
385
386
|
end
|
386
387
|
|
388
|
+
# Exposes the `/_suggest` endpoint of the Elasticsearch API.
|
389
|
+
#
|
390
|
+
# query - The query body as a Hash
|
391
|
+
# params - Parameters Hash
|
392
|
+
#
|
393
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html
|
394
|
+
#
|
395
|
+
# Returns the response body as a Hash
|
396
|
+
def suggest(query, params = {})
|
397
|
+
response = client.post "{/index}/_suggest", update_params(params, :body => query, :action => "index.suggest")
|
398
|
+
response.body
|
399
|
+
end
|
400
|
+
|
387
401
|
# Perform bulk indexing and/or delete operations. The current index name
|
388
402
|
# will be passed to the bulk API call as part of the request parameters.
|
389
403
|
#
|
@@ -403,7 +417,7 @@ module Elastomer
|
|
403
417
|
# ...
|
404
418
|
# end
|
405
419
|
#
|
406
|
-
# See
|
420
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
|
407
421
|
#
|
408
422
|
# Returns the response body as a Hash
|
409
423
|
def bulk( params = {}, &block )
|
@@ -431,7 +445,7 @@ module Elastomer
|
|
431
445
|
# document['_source']
|
432
446
|
# end
|
433
447
|
#
|
434
|
-
# See
|
448
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html
|
435
449
|
#
|
436
450
|
# Returns a new Scroller instance
|
437
451
|
def scroll( query, opts = {} )
|
@@ -460,7 +474,7 @@ module Elastomer
|
|
460
474
|
# document['_source']
|
461
475
|
# end
|
462
476
|
#
|
463
|
-
# See
|
477
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html
|
464
478
|
#
|
465
479
|
# Returns a new Scroller instance
|
466
480
|
def scan( query, opts = {} )
|
@@ -473,7 +487,7 @@ module Elastomer
|
|
473
487
|
# will be passed to the multi_search API call as part of the request
|
474
488
|
# parameters.
|
475
489
|
#
|
476
|
-
# See
|
490
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html
|
477
491
|
#
|
478
492
|
# params - Parameters Hash that will be passed to the API call.
|
479
493
|
# block - Required block that is used to accumulate searches.
|
@@ -491,7 +505,7 @@ module Elastomer
|
|
491
505
|
# ...
|
492
506
|
# end
|
493
507
|
#
|
494
|
-
# See
|
508
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html
|
495
509
|
#
|
496
510
|
# Returns the response body as a Hash
|
497
511
|
def multi_search( params = {}, &block )
|
@@ -541,7 +555,7 @@ module Elastomer
|
|
541
555
|
# index.warmer('warmer1').get
|
542
556
|
# index.warmer('warmer1').delete
|
543
557
|
#
|
544
|
-
# See
|
558
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-warmers.html
|
545
559
|
#
|
546
560
|
# Returns a new Warmer instance
|
547
561
|
def warmer(warmer_name)
|