Module: Elasticsearch::API::Indices::Actions
- Included in:
- IndicesClient
- Defined in:
- lib/elasticsearch/api/namespace/indices.rb,
lib/elasticsearch/api/actions/indices/open.rb,
lib/elasticsearch/api/actions/indices/close.rb,
lib/elasticsearch/api/actions/indices/flush.rb,
lib/elasticsearch/api/actions/indices/stats.rb,
lib/elasticsearch/api/actions/indices/create.rb,
lib/elasticsearch/api/actions/indices/delete.rb,
lib/elasticsearch/api/actions/indices/exists.rb,
lib/elasticsearch/api/actions/indices/status.rb,
lib/elasticsearch/api/actions/indices/analyze.rb,
lib/elasticsearch/api/actions/indices/refresh.rb,
lib/elasticsearch/api/actions/indices/optimize.rb,
lib/elasticsearch/api/actions/indices/recovery.rb,
lib/elasticsearch/api/actions/indices/segments.rb,
lib/elasticsearch/api/actions/indices/get_alias.rb,
lib/elasticsearch/api/actions/indices/put_alias.rb,
lib/elasticsearch/api/actions/indices/get_warmer.rb,
lib/elasticsearch/api/actions/indices/put_warmer.rb,
lib/elasticsearch/api/actions/indices/clear_cache.rb,
lib/elasticsearch/api/actions/indices/exists_type.rb,
lib/elasticsearch/api/actions/indices/get_aliases.rb,
lib/elasticsearch/api/actions/indices/get_mapping.rb,
lib/elasticsearch/api/actions/indices/put_mapping.rb,
lib/elasticsearch/api/actions/indices/delete_alias.rb,
lib/elasticsearch/api/actions/indices/exists_alias.rb,
lib/elasticsearch/api/actions/indices/get_settings.rb,
lib/elasticsearch/api/actions/indices/get_template.rb,
lib/elasticsearch/api/actions/indices/put_settings.rb,
lib/elasticsearch/api/actions/indices/put_template.rb,
lib/elasticsearch/api/actions/indices/delete_warmer.rb,
lib/elasticsearch/api/actions/indices/delete_mapping.rb,
lib/elasticsearch/api/actions/indices/snapshot_index.rb,
lib/elasticsearch/api/actions/indices/update_aliases.rb,
lib/elasticsearch/api/actions/indices/validate_query.rb,
lib/elasticsearch/api/actions/indices/delete_template.rb,
lib/elasticsearch/api/actions/indices/exists_template.rb,
lib/elasticsearch/api/actions/indices/get_field_mapping.rb
Instance Method Summary collapse
-
#analyze(arguments = {}) ⇒ Object
Return the result of the analysis process (tokens).
-
#clear_cache(arguments = {}) ⇒ Object
Clear caches and other auxiliary data structures.
-
#close(arguments = {}) ⇒ Object
Close an index (keep the data on disk, but deny operations with the index).
-
#create(arguments = {}) ⇒ Object
Create an index.
-
#delete(arguments = {}) ⇒ Object
Delete an index, list of indices, or all indices in the cluster.
-
#delete_alias(arguments = {}) ⇒ Object
Delete a single index alias.
-
#delete_mapping(arguments = {}) ⇒ Object
Delete all documents and mapping for a specific document type.
-
#delete_template(arguments = {}) ⇒ Object
Delete an index template.
-
#delete_warmer(arguments = {}) ⇒ Object
Delete one or more warmers for a list of indices.
-
#exists(arguments = {}) ⇒ true, false
Return true if the index (or all indices in a list) exists, false otherwise.
-
#exists_alias(arguments = {}) ⇒ Object
Return true if the specified alias exists, false otherwise.
-
#exists_template(arguments = {}) ⇒ Object
TODO: Description.
-
#exists_type(arguments = {}) ⇒ Object
Return true if the specified type exists, false otherwise.
-
#flush(arguments = {}) ⇒ Object
“Flush” the index or indices.
-
#get_alias(arguments = {}) ⇒ Object
Get information about a specific alias.
-
#get_aliases(arguments = {}) ⇒ Object
Get a list of all aliases, or aliases for a specific index.
-
#get_field_mapping(arguments = {}) ⇒ Object
Return the mapping definition for specific field (or fields).
-
#get_mapping(arguments = {}) ⇒ Object
Return the mapping definitions for all indices, or specific indices/types.
-
#get_settings(arguments = {}) ⇒ Object
Return the settings for all indices, or a list of indices.
-
#get_template(arguments = {}) ⇒ Object
Get a single index template.
-
#get_warmer(arguments = {}) ⇒ Object
Get one or more warmers for an index.
-
#open(arguments = {}) ⇒ Object
Open a previously closed index (see the #close API).
-
#optimize(arguments = {}) ⇒ Object
Perform an index optimization.
-
#put_alias(arguments = {}) ⇒ Object
Create or update a single index alias.
-
#put_mapping(arguments = {}) ⇒ Object
Create or update mapping.
-
#put_settings(arguments = {}) ⇒ Object
Update the settings for one or multiple indices.
-
#put_template(arguments = {}) ⇒ Object
Create or update an index template.
-
#put_warmer(arguments = {}) ⇒ Object
Create or update an index warmer.
-
#recovery(arguments = {}) ⇒ Object
Return information about shard recovery for one or more indices.
-
#refresh(arguments = {}) ⇒ Object
Refresh the index and to make the changes (creates, updates, deletes) searchable.
-
#segments(arguments = {}) ⇒ Object
Return information about segments for one or more indices.
-
#snapshot_index(arguments = {}) ⇒ Object
deprecated
Deprecated.
The shared gateway has been deprecated [github.com/elasticsearch/elasticsearch/issues/2458]
-
#stats(arguments = {}) ⇒ Object
Return statistical information about one or more indices.
-
#status(arguments = {}) ⇒ Object
Return information about one or more indices.
-
#update_aliases(arguments = {}) ⇒ Object
Perform multiple operation on index aliases in a single request.
-
#validate_query(arguments = {}) ⇒ Object
Validate a query.
Instance Method Details
#analyze(arguments = {}) ⇒ Object
Return the result of the analysis process (tokens)
Allows to “test-drive” the Elasticsearch analysis process by performing the analysis on the same text with different analyzers. An ad-hoc analysis chain can be built from specific tokenizer and filters.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/elasticsearch/api/actions/indices/analyze.rb', line 38 def analyze(arguments={}) valid_params = [ :analyzer, :field, :filters, :index, :prefer_local, :text, :tokenizer, :format ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_analyze' params = Utils.__validate_and_extract_params arguments, valid_params params[:filters] = Utils.__listify(params[:filters]) if params[:filters] body = arguments[:body] perform_request(method, path, params, body).body end |
#clear_cache(arguments = {}) ⇒ Object
Clear caches and other auxiliary data structures.
Can be performed against a specific index, or against all indices.
By default, all caches and data structures will be cleared. Pass a specific cache or structure name to clear just a single one.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/elasticsearch/api/actions/indices/clear_cache.rb', line 50 def clear_cache(arguments={}) valid_params = [ :field_data, :fielddata, :fields, :filter, :filter_cache, :filter_keys, :id, :id_cache, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :recycler ] method = 'POST' path = Utils.__pathify Utils.__listify(arguments[:index]), '_cache/clear' params = Utils.__validate_and_extract_params arguments, valid_params body = nil params[:fields] = Utils.__listify(params[:fields]) if params[:fields] perform_request(method, path, params, body).body end |
#close(arguments = {}) ⇒ Object
Close an index (keep the data on disk, but deny operations with the index).
A closed index can be opened again with the #close API.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/elasticsearch/api/actions/indices/close.rb', line 28 def close(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :timeout ] method = 'POST' path = Utils.__pathify Utils.__listify(arguments[:index]), '_close' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#create(arguments = {}) ⇒ Object
Create an index.
Pass the index ‘settings` and `mappings` in the `:body` attribute.
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/elasticsearch/api/actions/indices/create.rb', line 67 def create(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] valid_params = [ :timeout ] method = 'PUT' path = Utils.__pathify Utils.__escape(arguments[:index]) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#delete(arguments = {}) ⇒ Object
Delete an index, list of indices, or all indices in the cluster.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/elasticsearch/api/actions/indices/delete.rb', line 32 def delete(arguments={}) valid_params = [ :timeout ] method = 'DELETE' path = Utils.__pathify Utils.__listify(arguments[:index]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#delete_alias(arguments = {}) ⇒ Object
Delete a single index alias.
See the #update_aliases for performing operations with index aliases in bulk.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/elasticsearch/api/actions/indices/delete_alias.rb', line 20 def delete_alias(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] valid_params = [ :timeout ] method = 'DELETE' path = Utils.__pathify Utils.__escape(arguments[:index]), '_alias', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#delete_mapping(arguments = {}) ⇒ Object
Delete all documents and mapping for a specific document type.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/elasticsearch/api/actions/indices/delete_mapping.rb', line 13 def delete_mapping(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'type' missing" unless arguments[:type] method = 'DELETE' path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__escape(arguments[:type]) params = {} body = nil perform_request(method, path, params, body).body end |
#delete_template(arguments = {}) ⇒ Object
Delete an index template.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/elasticsearch/api/actions/indices/delete_template.rb', line 21 def delete_template(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] valid_params = [ :timeout ] method = 'DELETE' path = Utils.__pathify '_template', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body rescue Exception => e # NOTE: Use exception name, not full class in Elasticsearch::Client to allow client plugability if Array(arguments[:ignore]).include?(404) && e.class.to_s =~ /NotFound/; false else raise(e) end end |
#delete_warmer(arguments = {}) ⇒ Object
Delete one or more warmers for a list of indices.
20 21 22 23 24 25 26 27 28 |
# File 'lib/elasticsearch/api/actions/indices/delete_warmer.rb', line 20 def delete_warmer(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] method = 'DELETE' path = Utils.__pathify Utils.__listify(arguments[:index]), '_warmer', Utils.__listify(arguments[:name]) params = {} body = nil perform_request(method, path, params, body).body end |
#exists(arguments = {}) ⇒ true, false
Return true if the index (or all indices in a list) exists, false otherwise.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/elasticsearch/api/actions/indices/exists.rb', line 29 def exists(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :local ] method = 'HEAD' path = Utils.__listify(arguments[:index]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).status == 200 ? true : false rescue Exception => e if e.class.to_s =~ /NotFound/ || e. =~ /Not\s*Found|404/i false else raise e end end |
#exists_alias(arguments = {}) ⇒ Object
Return true if the specified alias exists, false otherwise.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elasticsearch/api/actions/indices/exists_alias.rb', line 28 def exists_alias(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :local ] method = 'HEAD' path = Utils.__pathify Utils.__listify(arguments[:index]), '_alias', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).status == 200 ? true : false rescue Exception => e if e.class.to_s =~ /NotFound/ || e. =~ /Not\s*Found|404/i false else raise e end end |
#exists_template(arguments = {}) ⇒ Object
TODO: Description
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/elasticsearch/api/actions/indices/exists_template.rb', line 13 def exists_template(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] valid_params = [ :local ] method = 'HEAD' path = Utils.__pathify '_template', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).status == 200 ? true : false rescue Exception => e if e.class.to_s =~ /NotFound/ || e. =~ /Not\s*Found|404/i false else raise e end end |
#exists_type(arguments = {}) ⇒ Object
Return true if the specified type exists, false otherwise.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/elasticsearch/api/actions/indices/exists_type.rb', line 25 def exists_type(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'type' missing" unless arguments[:type] valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :local ] method = 'HEAD' path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__escape(arguments[:type]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).status == 200 ? true : false rescue Exception => e if e.class.to_s =~ /NotFound/ || e. =~ /Not\s*Found|404/i false else raise e end end |
#flush(arguments = {}) ⇒ Object
The flush operation is handled automatically by Elasticsearch, you don’t need to perform it manually.
“Flush” the index or indices.
The “flush” operation clears the transaction log and memory and writes data to disk. It corresponds to a Lucene “commit” operation.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elasticsearch/api/actions/indices/flush.rb', line 31 def flush(arguments={}) valid_params = [ :force, :full, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :refresh ] method = 'POST' path = Utils.__pathify Utils.__listify(arguments[:index]), '_flush' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#get_alias(arguments = {}) ⇒ Object
Get information about a specific alias.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elasticsearch/api/actions/indices/get_alias.rb', line 32 def get_alias(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :local ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_alias', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#get_aliases(arguments = {}) ⇒ Object
Get a list of all aliases, or aliases for a specific index.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/elasticsearch/api/actions/indices/get_aliases.rb', line 20 def get_aliases(arguments={}) valid_params = [ :timeout, :local ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_aliases', Utils.__listify(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#get_field_mapping(arguments = {}) ⇒ Object
Return the mapping definition for specific field (or fields)
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/elasticsearch/api/actions/indices/get_field_mapping.rb', line 36 def get_field_mapping(arguments={}) raise ArgumentError, "Required argument 'field' missing" unless arguments[:field] valid_params = [ :include_defaults, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'GET' path = Utils.__pathify( Utils.__listify(arguments[:index]), '_mapping', Utils.__listify(arguments[:type]), 'field', Utils.__listify(arguments[:field]) ) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#get_mapping(arguments = {}) ⇒ Object
Return the mapping definitions for all indices, or specific indices/types.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/elasticsearch/api/actions/indices/get_mapping.rb', line 36 def get_mapping(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :local ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_mapping', Utils.__listify(arguments[:type]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#get_settings(arguments = {}) ⇒ Object
Return the settings for all indices, or a list of indices.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/elasticsearch/api/actions/indices/get_settings.rb', line 43 def get_settings(arguments={}) valid_params = [ :prefix, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :flat_settings, :local ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), arguments.delete(:prefix), '_settings', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#get_template(arguments = {}) ⇒ Object
Use the Cluster::Actions#state API to get a list of all templates.
Get a single index template.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/elasticsearch/api/actions/indices/get_template.rb', line 25 def get_template(arguments={}) valid_params = [ :flat_settings, :local ] method = 'GET' path = Utils.__pathify '_template', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#get_warmer(arguments = {}) ⇒ Object
Get one or more warmers for an index.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/elasticsearch/api/actions/indices/get_warmer.rb', line 41 def get_warmer(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'GET' path = Utils.__pathify( Utils.__listify(arguments[:index]), '_warmer', Utils.__escape(arguments[:name]) ) params = {} body = nil perform_request(method, path, params, body).body end |
#open(arguments = {}) ⇒ Object
Open a previously closed index (see the #close API).
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/elasticsearch/api/actions/indices/open.rb', line 26 def open(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :timeout ] method = 'POST' path = Utils.__pathify Utils.__escape(arguments[:index]), '_open' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#optimize(arguments = {}) ⇒ Object
The optimize operation is handled automatically by Elasticsearch, you don’t need to perform it manually. The operation is expensive in terms of resources (I/O, CPU, memory) and can take a long time to finish, potentially reducing operability of your cluster; schedule the manual optimization accordingly.
Perform an index optimization.
The “optimize” operation merges the index segments, increasing search performance. It corresponds to a Lucene “merge” operation.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/elasticsearch/api/actions/indices/optimize.rb', line 46 def optimize(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :flush, :force, :master_timeout, :max_num_segments, :only_expunge_deletes, :operation_threading, :refresh, :wait_for_merge ] method = 'POST' path = Utils.__pathify Utils.__listify(arguments[:index]), '_optimize' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#put_alias(arguments = {}) ⇒ Object
Create or update a single index alias.
See the #update_aliases for performing operations with index aliases in bulk.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/elasticsearch/api/actions/indices/put_alias.rb', line 26 def put_alias(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] valid_params = [ :timeout ] method = 'PUT' path = Utils.__pathify Utils.__escape(arguments[:index]), '_alias', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#put_mapping(arguments = {}) ⇒ Object
Create or update mapping.
Pass the mapping definition(s) in the ‘:body` argument.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/elasticsearch/api/actions/indices/put_mapping.rb', line 48 def put_mapping(arguments={}) raise ArgumentError, "Required argument 'type' missing" unless arguments[:type] raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :ignore_conflicts, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :master_timeout, :timeout ] method = 'PUT' path = Utils.__pathify Utils.__listify(arguments[:index]), '_mapping', Utils.__escape(arguments[:type]) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#put_settings(arguments = {}) ⇒ Object
Update the settings for one or multiple indices.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/elasticsearch/api/actions/indices/put_settings.rb', line 44 def put_settings(arguments={}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :master_timeout, :flat_settings ] method = 'PUT' path = Utils.__pathify Utils.__listify(arguments[:index]), '_settings' params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#put_template(arguments = {}) ⇒ Object
Create or update an index template.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/elasticsearch/api/actions/indices/put_template.rb', line 24 def put_template(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :create, :order, :timeout ] method = 'PUT' path = Utils.__pathify '_template', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#put_warmer(arguments = {}) ⇒ Object
Create or update an index warmer.
An index warmer will run before an index is refreshed, ie. available for search. It allows you to register “heavy” queries with popular filters, facets or sorts, increasing performance when the index is searched for the first time.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/elasticsearch/api/actions/indices/put_warmer.rb', line 40 def put_warmer(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'PUT' path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_warmer', Utils.__listify(arguments[:name]) ) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#recovery(arguments = {}) ⇒ Object
Return information about shard recovery for one or more indices
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/elasticsearch/api/actions/indices/recovery.rb', line 27 def recovery(arguments={}) valid_params = [ :detailed, :active_only, :human ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_recovery' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#refresh(arguments = {}) ⇒ Object
The refresh operation can adversely affect indexing throughput when used too frequently.
Refresh the index and to make the changes (creates, updates, deletes) searchable.
By default, Elasticsearch has a delay of 1 second until changes to an index are available for search; the delay is configurable, see #put_settings.
You can trigger this operation explicitely, for example when performing a sequence of commands in integration tests, or when you need to perform a manual “synchronization” of the index with an external system at given moment.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elasticsearch/api/actions/indices/refresh.rb', line 35 def refresh(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'POST' path = Utils.__pathify Utils.__listify(arguments[:index]), '_refresh' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#segments(arguments = {}) ⇒ Object
Return information about segments for one or more indices.
The response contains information about segment size, number of documents, deleted documents, etc. See also #optimize.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/elasticsearch/api/actions/indices/segments.rb', line 25 def segments(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_segments' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#snapshot_index(arguments = {}) ⇒ Object
The shared gateway has been deprecated [github.com/elasticsearch/elasticsearch/issues/2458]
When using the shared storage gateway, manually trigger the snapshot operation.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/elasticsearch/api/actions/indices/snapshot_index.rb', line 24 def snapshot_index(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'POST' path = Utils.__pathify Utils.__listify(arguments[:index]), '_gateway/snapshot' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#stats(arguments = {}) ⇒ Object
Return statistical information about one or more indices.
The response contains comprehensive statistical information about metrics related to index: how much time did indexing, search and other operations take, how much disk space it takes, how much memory filter caches or field data require, etc.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/elasticsearch/api/actions/indices/stats.rb', line 76 def stats(arguments={}) valid_parts = [ :docs, :fielddata, :filter_cache, :flush, :get, :indexing, :merge, :metric, :refresh, :search, :suggest, :store, :warmer ] valid_params = [ :fields, :completion_fields, :fielddata_fields, :groups, :level, :types, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'GET' parts = Utils.__extract_parts arguments, valid_parts path = Utils.__pathify Utils.__listify(arguments[:index]), '_stats', Utils.__listify(parts) params = Utils.__validate_and_extract_params arguments, valid_params params[:fields] = Utils.__listify(params[:fields]) if params[:fields] params[:groups] = Utils.__listify(params[:groups]) if params[:groups] body = nil perform_request(method, path, params, body).body end |
#status(arguments = {}) ⇒ Object
Return information about one or more indices
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/elasticsearch/api/actions/indices/status.rb', line 36 def status(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :recovery, :snapshot ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_status' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#update_aliases(arguments = {}) ⇒ Object
Perform multiple operation on index aliases in a single request.
Pass the ‘actions` (add, remove) in the `body` argument.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/elasticsearch/api/actions/indices/update_aliases.rb', line 33 def update_aliases(arguments={}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :timeout ] method = 'POST' path = "_aliases" params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#validate_query(arguments = {}) ⇒ Object
Validate a query
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/elasticsearch/api/actions/indices/validate_query.rb', line 57 def validate_query(arguments={}) valid_params = [ :q, :explain, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :source ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_validate/query' params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |