Module: Elasticsearch::API::Indices::Actions
- Included in:
- IndicesClient
- Defined in:
- lib/elasticsearch/api/namespace/indices.rb,
lib/elasticsearch/api/actions/indices/get.rb,
lib/elasticsearch/api/actions/indices/open.rb,
lib/elasticsearch/api/actions/indices/clone.rb,
lib/elasticsearch/api/actions/indices/close.rb,
lib/elasticsearch/api/actions/indices/flush.rb,
lib/elasticsearch/api/actions/indices/split.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/freeze.rb,
lib/elasticsearch/api/actions/indices/shrink.rb,
lib/elasticsearch/api/actions/indices/analyze.rb,
lib/elasticsearch/api/actions/indices/refresh.rb,
lib/elasticsearch/api/actions/indices/upgrade.rb,
lib/elasticsearch/api/actions/indices/recovery.rb,
lib/elasticsearch/api/actions/indices/rollover.rb,
lib/elasticsearch/api/actions/indices/segments.rb,
lib/elasticsearch/api/actions/indices/unfreeze.rb,
lib/elasticsearch/api/actions/indices/add_block.rb,
lib/elasticsearch/api/actions/indices/get_alias.rb,
lib/elasticsearch/api/actions/indices/put_alias.rb,
lib/elasticsearch/api/actions/indices/forcemerge.rb,
lib/elasticsearch/api/actions/indices/clear_cache.rb,
lib/elasticsearch/api/actions/indices/exists_type.rb,
lib/elasticsearch/api/actions/indices/get_mapping.rb,
lib/elasticsearch/api/actions/indices/get_upgrade.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/flush_synced.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/shard_stores.rb,
lib/elasticsearch/api/actions/indices/resolve_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/params_registry.rb,
lib/elasticsearch/api/actions/indices/get_field_mapping.rb,
lib/elasticsearch/api/actions/indices/simulate_template.rb,
lib/elasticsearch/api/actions/indices/get_index_template.rb,
lib/elasticsearch/api/actions/indices/put_index_template.rb,
lib/elasticsearch/api/actions/indices/delete_index_template.rb,
lib/elasticsearch/api/actions/indices/exists_index_template.rb,
lib/elasticsearch/api/actions/indices/simulate_index_template.rb
Defined Under Namespace
Modules: ParamsRegistry
Instance Method Summary collapse
-
#add_block(arguments = {}) ⇒ Object
Adds a block to an index.
-
#analyze(arguments = {}) ⇒ Object
Performs the analysis process on a text and return the tokens breakdown of the text.
-
#clear_cache(arguments = {}) ⇒ Object
Clears all or specific caches for one or more indices.
-
#clone(arguments = {}) ⇒ Object
Clones an index.
-
#close(arguments = {}) ⇒ Object
Closes an index.
-
#create(arguments = {}) ⇒ Object
Creates an index with optional settings and mappings.
-
#delete(arguments = {}) ⇒ Object
Deletes an index.
-
#delete_alias(arguments = {}) ⇒ Object
Deletes an alias.
-
#delete_index_template(arguments = {}) ⇒ Object
Deletes an index template.
-
#delete_template(arguments = {}) ⇒ Object
Deletes an index template.
-
#exists(arguments = {}) ⇒ Object
(also: #exists?)
Returns information about whether a particular index exists.
-
#exists_alias(arguments = {}) ⇒ Object
(also: #exists_alias?)
Returns information about whether a particular alias exists.
-
#exists_index_template(arguments = {}) ⇒ Object
(also: #exists_index_template?)
Returns information about whether a particular index template exists.
-
#exists_template(arguments = {}) ⇒ Object
(also: #exists_template?)
Returns information about whether a particular index template exists.
-
#exists_type(arguments = {}) ⇒ Object
(also: #exists_type?)
Returns information about whether a particular document type exists.
-
#flush(arguments = {}) ⇒ Object
Performs the flush operation on one or more indices.
-
#flush_synced(arguments = {}) ⇒ Object
Performs a synced flush operation on one or more indices.
-
#forcemerge(arguments = {}) ⇒ Object
Performs the force merge operation on one or more indices.
-
#freeze(arguments = {}) ⇒ Object
In order to keep indices available and queryable for a longer period but at the same time reduce their hardware requirements they can be transitioned into a frozen state.
-
#get(arguments = {}) ⇒ Object
Returns information about one or more indices.
-
#get_alias(arguments = {}) ⇒ Object
Returns an alias.
-
#get_field_mapping(arguments = {}) ⇒ Object
Returns mapping for one or more fields.
-
#get_index_template(arguments = {}) ⇒ Object
Returns an index template.
-
#get_mapping(arguments = {}) ⇒ Object
Returns mappings for one or more indices.
-
#get_settings(arguments = {}) ⇒ Object
Returns settings for one or more indices.
-
#get_template(arguments = {}) ⇒ Object
Returns an index template.
-
#get_upgrade(arguments = {}) ⇒ Object
DEPRECATED Returns a progress status of current upgrade.
-
#open(arguments = {}) ⇒ Object
Opens an index.
-
#put_alias(arguments = {}) ⇒ Object
Creates or updates an alias.
-
#put_index_template(arguments = {}) ⇒ Object
Creates or updates an index template.
-
#put_mapping(arguments = {}) ⇒ Object
Updates the index mappings.
-
#put_settings(arguments = {}) ⇒ Object
Updates the index settings.
-
#put_template(arguments = {}) ⇒ Object
Creates or updates an index template.
-
#recovery(arguments = {}) ⇒ Object
Returns information about ongoing index shard recoveries.
-
#refresh(arguments = {}) ⇒ Object
Performs the refresh operation in one or more indices.
-
#resolve_index(arguments = {}) ⇒ Object
Returns information about any matching indices, aliases, and data streams This functionality is Experimental and may be changed or removed completely in a future release.
-
#rollover(arguments = {}) ⇒ Object
Updates an alias to point to a new index when the existing index is considered to be too large or too old.
-
#segments(arguments = {}) ⇒ Object
Provides low-level information about segments in a Lucene index.
-
#shard_stores(arguments = {}) ⇒ Object
Provides store information for shard copies of indices.
-
#shrink(arguments = {}) ⇒ Object
Allow to shrink an existing index into a new index with fewer primary shards.
-
#simulate_index_template(arguments = {}) ⇒ Object
Simulate matching the given index name against the index templates in the system.
-
#simulate_template(arguments = {}) ⇒ Object
Simulate resolving the given template name or body.
-
#split(arguments = {}) ⇒ Object
Allows you to split an existing index into a new index with more primary shards.
-
#stats(arguments = {}) ⇒ Object
Provides statistics on operations happening in an index.
-
#unfreeze(arguments = {}) ⇒ Object
In order to keep indices available and queryable for a longer period but at the same time reduce their hardware requirements they can be transitioned into a frozen state.
-
#update_aliases(arguments = {}) ⇒ Object
Updates index aliases.
-
#upgrade(arguments = {}) ⇒ Object
DEPRECATED Upgrades to the current version of Lucene.
-
#validate_query(arguments = {}) ⇒ Object
Allows a user to validate a potentially expensive query without executing it.
Instance Method Details
#add_block(arguments = {}) ⇒ Object
Adds a block to an index.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/elasticsearch/api/actions/indices/add_block.rb', line 35 def add_block(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'block' missing" unless arguments[:block] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) _block = arguments.delete(:block) method = Elasticsearch::API::HTTP_PUT path = "#{Utils.__listify(_index)}/_block/#{Utils.__listify(_block)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#analyze(arguments = {}) ⇒ Object
Performs the analysis process on a text and return the tokens breakdown of the text.
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/analyze.rb', line 30 def analyze(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = if arguments[:body] Elasticsearch::API::HTTP_POST else Elasticsearch::API::HTTP_GET end path = if _index "#{Utils.__listify(_index)}/_analyze" else "_analyze" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#clear_cache(arguments = {}) ⇒ Object
Clears all or specific caches for one or more indices.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/elasticsearch/api/actions/indices/clear_cache.rb', line 36 def clear_cache(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = if _index "#{Utils.__listify(_index)}/_cache/clear" else "_cache/clear" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#clone(arguments = {}) ⇒ Object
Clones an index
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/clone.rb', line 34 def clone(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'target' missing" unless arguments[:target] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) _target = arguments.delete(:target) method = Elasticsearch::API::HTTP_PUT path = "#{Utils.__listify(_index)}/_clone/#{Utils.__listify(_target)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#close(arguments = {}) ⇒ Object
Closes an index.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elasticsearch/api/actions/indices/close.rb', line 35 def close(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = "#{Utils.__listify(_index)}/_close" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#create(arguments = {}) ⇒ Object
Creates an index with optional settings and mappings.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/elasticsearch/api/actions/indices/create.rb', line 34 def create(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_PUT path = "#{Utils.__listify(_index)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#delete(arguments = {}) ⇒ Object
Deletes an index.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/elasticsearch/api/actions/indices/delete.rb', line 34 def delete(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_DELETE path = "#{Utils.__listify(_index)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body } else perform_request(method, path, params, body, headers).body end end |
#delete_alias(arguments = {}) ⇒ Object
Deletes an alias.
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/delete_alias.rb', line 32 def delete_alias(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_DELETE path = if _index && _name "#{Utils.__listify(_index)}/_aliases/#{Utils.__listify(_name)}" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#delete_index_template(arguments = {}) ⇒ Object
Deletes an index template.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/elasticsearch/api/actions/indices/delete_index_template.rb', line 31 def delete_index_template(arguments = {}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] headers = arguments.delete(:headers) || {} arguments = arguments.clone _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_DELETE path = "_index_template/#{Utils.__listify(_name)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#delete_template(arguments = {}) ⇒ Object
Deletes an index template.
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/delete_template.rb', line 31 def delete_template(arguments = {}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] headers = arguments.delete(:headers) || {} arguments = arguments.clone _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_DELETE path = "_template/#{Utils.__listify(_name)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body } else perform_request(method, path, params, body, headers).body end end |
#exists(arguments = {}) ⇒ Object Also known as: exists?
Returns information about whether a particular index exists.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/elasticsearch/api/actions/indices/exists.rb', line 35 def exists(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_HEAD path = "#{Utils.__listify(_index)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil Utils.__rescue_from_not_found do perform_request(method, path, params, body, headers).status == 200 ? true : false end end |
#exists_alias(arguments = {}) ⇒ Object Also known as: exists_alias?
Returns information about whether a particular alias exists.
34 35 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/exists_alias.rb', line 34 def exists_alias(arguments = {}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] headers = arguments.delete(:headers) || {} arguments = arguments.clone _name = arguments.delete(:name) _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_HEAD path = if _index && _name "#{Utils.__listify(_index)}/_alias/#{Utils.__listify(_name)}" else "_alias/#{Utils.__listify(_name)}" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil Utils.__rescue_from_not_found do perform_request(method, path, params, body, headers).status == 200 ? true : false end end |
#exists_index_template(arguments = {}) ⇒ Object Also known as: exists_index_template?
Returns information about whether a particular index template exists.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/elasticsearch/api/actions/indices/exists_index_template.rb', line 32 def exists_index_template(arguments = {}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] headers = arguments.delete(:headers) || {} arguments = arguments.clone _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_HEAD path = "_index_template/#{Utils.__listify(_name)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#exists_template(arguments = {}) ⇒ Object Also known as: exists_template?
Returns information about whether a particular index template exists.
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_template.rb', line 32 def exists_template(arguments = {}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] headers = arguments.delete(:headers) || {} arguments = arguments.clone _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_HEAD path = "_template/#{Utils.__listify(_name)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil Utils.__rescue_from_not_found do perform_request(method, path, params, body, headers).status == 200 ? true : false end end |
#exists_type(arguments = {}) ⇒ Object Also known as: exists_type?
Returns information about whether a particular document type exists. (DEPRECATED)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/elasticsearch/api/actions/indices/exists_type.rb', line 34 def exists_type(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'type' missing" unless arguments[:type] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) _type = arguments.delete(:type) method = Elasticsearch::API::HTTP_HEAD path = "#{Utils.__listify(_index)}/_mapping/#{Utils.__listify(_type)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil Utils.__rescue_from_not_found do perform_request(method, path, params, body, headers).status == 200 ? true : false end end |
#flush(arguments = {}) ⇒ Object
Performs the flush operation on one or more indices.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/elasticsearch/api/actions/indices/flush.rb', line 34 def flush(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = if _index "#{Utils.__listify(_index)}/_flush" else "_flush" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#flush_synced(arguments = {}) ⇒ Object
Performs a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead
*Deprecation notice*: Synced flush is deprecated and will be removed in 8.0. Use flush instead. Deprecated since version 7.6.0
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/flush_synced.rb', line 37 def flush_synced(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = if _index "#{Utils.__listify(_index)}/_flush/synced" else "_flush/synced" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body } else perform_request(method, path, params, body, headers).body end end |
#forcemerge(arguments = {}) ⇒ Object
Performs the force merge operation on one or more indices.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/elasticsearch/api/actions/indices/forcemerge.rb', line 35 def forcemerge(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = if _index "#{Utils.__listify(_index)}/_forcemerge" else "_forcemerge" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#freeze(arguments = {}) ⇒ Object
This feature is available in the Platinum distribution of Elasticsearch.
In order to keep indices available and queryable for a longer period but at the same time reduce their
hardware requirements they can be transitioned into a frozen state. Once an index is frozen, all of its
transient shard memory (aside from mappings and analyzers) is moved to persistent storage.
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/freeze.rb', line 32 def freeze(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] valid_params = [ :timeout, :master_timeout, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :wait_for_active_shards ] arguments = arguments.clone index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = Elasticsearch::API::Utils.__pathify Elasticsearch::API::Utils.__listify(index), '_freeze' params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params perform_request(method, path, params).body end |
#get(arguments = {}) ⇒ Object
Returns information about one or more indices.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/elasticsearch/api/actions/indices/get.rb', line 37 def get(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = "#{Utils.__listify(_index)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#get_alias(arguments = {}) ⇒ Object
Returns an alias.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/elasticsearch/api/actions/indices/get_alias.rb', line 34 def get_alias(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _name = arguments.delete(:name) _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = if _index && _name "#{Utils.__listify(_index)}/_alias/#{Utils.__listify(_name)}" elsif _index "#{Utils.__listify(_index)}/_alias" elsif _name "_alias/#{Utils.__listify(_name)}" else "_alias" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#get_field_mapping(arguments = {}) ⇒ Object
Returns mapping for one or more fields.
*Deprecation notice*: Specifying types in urls has been deprecated Deprecated since version 7.0.0
42 43 44 45 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/get_field_mapping.rb', line 42 def get_field_mapping(arguments = {}) _fields = arguments.delete(:field) || arguments.delete(:fields) raise ArgumentError, "Required argument 'field' missing" unless _fields headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) _type = arguments.delete(:type) method = Elasticsearch::API::HTTP_GET path = if _index && _type && _fields "#{Utils.__listify(_index)}/_mapping/#{Utils.__listify(_type)}/field/#{Utils.__listify(_fields)}" elsif _index && _fields "#{Utils.__listify(_index)}/_mapping/field/#{Utils.__listify(_fields)}" elsif _type && _fields "_mapping/#{Utils.__listify(_type)}/field/#{Utils.__listify(_fields)}" else "_mapping/field/#{Utils.__listify(_fields)}" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#get_index_template(arguments = {}) ⇒ Object
Returns an index template.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/elasticsearch/api/actions/indices/get_index_template.rb', line 32 def get_index_template(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_GET path = if _name "_index_template/#{Utils.__listify(_name)}" else "_index_template" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#get_mapping(arguments = {}) ⇒ Object
Returns mappings for one or more indices.
*Deprecation notice*: Specifying types in urls has been deprecated Deprecated since version 7.0.0
41 42 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_mapping.rb', line 41 def get_mapping(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) _type = arguments.delete(:type) method = Elasticsearch::API::HTTP_GET path = if _index && _type "#{Utils.__listify(_index)}/_mapping/#{Utils.__listify(_type)}" elsif _index "#{Utils.__listify(_index)}/_mapping" elsif _type "_mapping/#{Utils.__listify(_type)}" else "_mapping" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#get_settings(arguments = {}) ⇒ Object
Returns settings for one or more indices.
37 38 39 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/get_settings.rb', line 37 def get_settings(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_GET path = if _index && _name "#{Utils.__listify(_index)}/_settings/#{Utils.__listify(_name)}" elsif _index "#{Utils.__listify(_index)}/_settings" elsif _name "_settings/#{Utils.__listify(_name)}" else "_settings" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#get_template(arguments = {}) ⇒ Object
Returns an index template.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elasticsearch/api/actions/indices/get_template.rb', line 33 def get_template(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_GET path = if _name "_template/#{Utils.__listify(_name)}" else "_template" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#get_upgrade(arguments = {}) ⇒ Object
DEPRECATED Returns a progress status of current upgrade.
*Deprecation notice*: The _upgrade API is no longer useful and will be removed. Instead, see _reindex API. Deprecated since version 8.0.0
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/elasticsearch/api/actions/indices/get_upgrade.rb', line 37 def get_upgrade(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = if _index "#{Utils.__listify(_index)}/_upgrade" else "_upgrade" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#open(arguments = {}) ⇒ Object
Opens an index.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elasticsearch/api/actions/indices/open.rb', line 35 def open(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = "#{Utils.__listify(_index)}/_open" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#put_alias(arguments = {}) ⇒ Object
Creates or updates an alias.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/elasticsearch/api/actions/indices/put_alias.rb', line 33 def put_alias(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_PUT path = if _index && _name "#{Utils.__listify(_index)}/_aliases/#{Utils.__listify(_name)}" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#put_index_template(arguments = {}) ⇒ Object
Creates or updates an index template.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/elasticsearch/api/actions/indices/put_index_template.rb', line 33 def put_index_template(arguments = {}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] headers = arguments.delete(:headers) || {} arguments = arguments.clone _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_PUT path = "_index_template/#{Utils.__listify(_name)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#put_mapping(arguments = {}) ⇒ Object
Updates the index mappings.
*Deprecation notice*: Specifying types in urls has been deprecated Deprecated since version 7.0.0
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/elasticsearch/api/actions/indices/put_mapping.rb', line 43 def put_mapping(arguments = {}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) _type = arguments.delete(:type) method = Elasticsearch::API::HTTP_PUT path = if _index && _type "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_mappings" elsif _index "#{Utils.__listify(_index)}/_mappings" elsif _type "_mappings/#{Utils.__listify(_type)}" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#put_settings(arguments = {}) ⇒ Object
Updates the index settings.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/elasticsearch/api/actions/indices/put_settings.rb', line 37 def put_settings(arguments = {}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_PUT path = if _index "#{Utils.__listify(_index)}/_settings" else "_settings" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#put_template(arguments = {}) ⇒ Object
Creates or updates an index template.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elasticsearch/api/actions/indices/put_template.rb', line 34 def put_template(arguments = {}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] headers = arguments.delete(:headers) || {} arguments = arguments.clone _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_PUT path = "_template/#{Utils.__listify(_name)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#recovery(arguments = {}) ⇒ Object
Returns information about ongoing index shard recoveries.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elasticsearch/api/actions/indices/recovery.rb', line 31 def recovery(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = if _index "#{Utils.__listify(_index)}/_recovery" else "_recovery" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#refresh(arguments = {}) ⇒ Object
Performs the refresh operation in one or more indices.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/elasticsearch/api/actions/indices/refresh.rb', line 32 def refresh(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = if _index "#{Utils.__listify(_index)}/_refresh" else "_refresh" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#resolve_index(arguments = {}) ⇒ Object
Returns information about any matching indices, aliases, and data streams This functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/elasticsearch/api/actions/indices/resolve_index.rb', line 34 def resolve_index(arguments = {}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] headers = arguments.delete(:headers) || {} arguments = arguments.clone _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_GET path = "_resolve/index/#{Utils.__listify(_name)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#rollover(arguments = {}) ⇒ Object
Updates an alias to point to a new index when the existing index is considered to be too large or too old.
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/rollover.rb', line 37 def rollover(arguments = {}) raise ArgumentError, "Required argument 'alias' missing" unless arguments[:alias] headers = arguments.delete(:headers) || {} arguments = arguments.clone _alias = arguments.delete(:alias) _new_index = arguments.delete(:new_index) method = Elasticsearch::API::HTTP_POST path = if _alias && _new_index "#{Utils.__listify(_alias)}/_rollover/#{Utils.__listify(_new_index)}" else "#{Utils.__listify(_alias)}/_rollover" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#segments(arguments = {}) ⇒ Object
Provides low-level information about segments in a Lucene index.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elasticsearch/api/actions/indices/segments.rb', line 33 def segments(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = if _index "#{Utils.__listify(_index)}/_segments" else "_segments" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#shard_stores(arguments = {}) ⇒ Object
Provides store information for shard copies of indices.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elasticsearch/api/actions/indices/shard_stores.rb', line 33 def shard_stores(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = if _index "#{Utils.__listify(_index)}/_shard_stores" else "_shard_stores" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#shrink(arguments = {}) ⇒ Object
Allow to shrink an existing index into a new index with fewer primary shards.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/elasticsearch/api/actions/indices/shrink.rb', line 35 def shrink(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'target' missing" unless arguments[:target] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) _target = arguments.delete(:target) method = Elasticsearch::API::HTTP_PUT path = "#{Utils.__listify(_index)}/_shrink/#{Utils.__listify(_target)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#simulate_index_template(arguments = {}) ⇒ Object
Simulate matching the given index name against the index templates in the system
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elasticsearch/api/actions/indices/simulate_index_template.rb', line 33 def simulate_index_template(arguments = {}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] headers = arguments.delete(:headers) || {} arguments = arguments.clone _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_POST path = "_index_template/_simulate_index/#{Utils.__listify(_name)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#simulate_template(arguments = {}) ⇒ Object
Simulate resolving the given template name or body
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elasticsearch/api/actions/indices/simulate_template.rb', line 33 def simulate_template(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_POST path = if _name "_index_template/_simulate/#{Utils.__listify(_name)}" else "_index_template/_simulate" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#split(arguments = {}) ⇒ Object
Allows you to split an existing index into a new index with more primary shards.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/elasticsearch/api/actions/indices/split.rb', line 35 def split(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'target' missing" unless arguments[:target] headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) _target = arguments.delete(:target) method = Elasticsearch::API::HTTP_PUT path = "#{Utils.__listify(_index)}/_split/#{Utils.__listify(_target)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#stats(arguments = {}) ⇒ Object
Provides statistics on operations happening in an index.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/elasticsearch/api/actions/indices/stats.rb', line 40 def stats(arguments = {}) headers = arguments.delete(:headers) || {} method = HTTP_GET parts = Utils.__extract_parts arguments, ParamsRegistry.get(:stats_parts) path = Utils.__pathify Utils.__listify(arguments[:index]), '_stats', Utils.__listify(parts) params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(:stats_params) params[:fields] = Utils.__listify(params[:fields], :escape => false) if params[:fields] params[:groups] = Utils.__listify(params[:groups], :escape => false) if params[:groups] body = nil perform_request(method, path, params, body, headers).body end |
#unfreeze(arguments = {}) ⇒ Object
This feature is available in the Platinum distribution of Elasticsearch.
In order to keep indices available and queryable for a longer period but at the same time reduce their
hardware requirements they can be transitioned into a frozen state. Once an index is frozen, all of its
transient shard memory (aside from mappings and analyzers) is moved to persistent storage.
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/unfreeze.rb', line 32 def unfreeze(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] valid_params = [ :timeout, :master_timeout, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :wait_for_active_shards ] arguments = arguments.clone index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = Elasticsearch::API::Utils.__pathify Elasticsearch::API::Utils.__listify(index), '_unfreeze' params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params perform_request(method, path, params).body end |
#update_aliases(arguments = {}) ⇒ Object
Updates index aliases.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/elasticsearch/api/actions/indices/update_aliases.rb', line 31 def update_aliases(arguments = {}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] headers = arguments.delete(:headers) || {} arguments = arguments.clone method = Elasticsearch::API::HTTP_POST path = "_aliases" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |
#upgrade(arguments = {}) ⇒ Object
DEPRECATED Upgrades to the current version of Lucene.
*Deprecation notice*: The _upgrade API is no longer useful and will be removed. Instead, see _reindex API. Deprecated since version 8.0.0
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/elasticsearch/api/actions/indices/upgrade.rb', line 39 def upgrade(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = if _index "#{Utils.__listify(_index)}/_upgrade" else "_upgrade" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil perform_request(method, path, params, body, headers).body end |
#validate_query(arguments = {}) ⇒ Object
Allows a user to validate a potentially expensive query without executing it.
*Deprecation notice*: Specifying types in urls has been deprecated Deprecated since version 7.0.0
48 49 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 |
# File 'lib/elasticsearch/api/actions/indices/validate_query.rb', line 48 def validate_query(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone _index = arguments.delete(:index) _type = arguments.delete(:type) method = if arguments[:body] Elasticsearch::API::HTTP_POST else Elasticsearch::API::HTTP_GET end path = if _index && _type "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_validate/query" elsif _index "#{Utils.__listify(_index)}/_validate/query" else "_validate/query" end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body, headers).body end |