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/shrink.rb,
lib/elasticsearch/api/actions/indices/analyze.rb,
lib/elasticsearch/api/actions/indices/refresh.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/disk_usage.rb,
lib/elasticsearch/api/actions/indices/downsample.rb,
lib/elasticsearch/api/actions/indices/forcemerge.rb,
lib/elasticsearch/api/actions/indices/clear_cache.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/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/get_data_stream.rb,
lib/elasticsearch/api/actions/indices/resolve_cluster.rb,
lib/elasticsearch/api/actions/indices/field_usage_stats.rb,
lib/elasticsearch/api/actions/indices/get_field_mapping.rb,
lib/elasticsearch/api/actions/indices/simulate_template.rb,
lib/elasticsearch/api/actions/indices/create_data_stream.rb,
lib/elasticsearch/api/actions/indices/data_streams_stats.rb,
lib/elasticsearch/api/actions/indices/delete_data_stream.rb,
lib/elasticsearch/api/actions/indices/get_data_lifecycle.rb,
lib/elasticsearch/api/actions/indices/get_index_template.rb,
lib/elasticsearch/api/actions/indices/modify_data_stream.rb,
lib/elasticsearch/api/actions/indices/put_data_lifecycle.rb,
lib/elasticsearch/api/actions/indices/put_index_template.rb,
lib/elasticsearch/api/actions/indices/promote_data_stream.rb,
lib/elasticsearch/api/actions/indices/delete_data_lifecycle.rb,
lib/elasticsearch/api/actions/indices/delete_index_template.rb,
lib/elasticsearch/api/actions/indices/exists_index_template.rb,
lib/elasticsearch/api/actions/indices/explain_data_lifecycle.rb,
lib/elasticsearch/api/actions/indices/migrate_to_data_stream.rb,
lib/elasticsearch/api/actions/indices/reload_search_analyzers.rb,
lib/elasticsearch/api/actions/indices/simulate_index_template.rb
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.
-
#create_data_stream(arguments = {}) ⇒ Object
Creates a data stream.
-
#data_streams_stats(arguments = {}) ⇒ Object
Provides statistics on operations happening in a data stream.
-
#delete(arguments = {}) ⇒ Object
Deletes an index.
-
#delete_alias(arguments = {}) ⇒ Object
Deletes an alias.
-
#delete_data_lifecycle(arguments = {}) ⇒ Object
Deletes the data stream lifecycle of the selected data streams.
-
#delete_data_stream(arguments = {}) ⇒ Object
Deletes a data stream.
-
#delete_index_template(arguments = {}) ⇒ Object
Deletes an index template.
-
#delete_template(arguments = {}) ⇒ Object
Deletes an index template.
-
#disk_usage(arguments = {}) ⇒ Object
Analyzes the disk usage of each field of an index or data stream This functionality is Experimental and may be changed or removed completely in a future release.
-
#downsample(arguments = {}) ⇒ Object
Downsample an index This functionality is Experimental and may be changed or removed completely in a future release.
-
#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.
-
#explain_data_lifecycle(arguments = {}) ⇒ Object
Retrieves information about the index’s current data stream lifecycle, such as any potential encountered error, time since creation etc.
-
#field_usage_stats(arguments = {}) ⇒ Object
Returns the field usage stats for each field of an index This functionality is Experimental and may be changed or removed completely in a future release.
-
#flush(arguments = {}) ⇒ Object
Performs the flush operation on one or more indices.
-
#forcemerge(arguments = {}) ⇒ Object
Performs the force merge operation on one or more indices.
-
#get(arguments = {}) ⇒ Object
Returns information about one or more indices.
-
#get_alias(arguments = {}) ⇒ Object
Returns an alias.
-
#get_data_lifecycle(arguments = {}) ⇒ Object
Returns the data stream lifecycle of the selected data streams.
-
#get_data_stream(arguments = {}) ⇒ Object
Returns data streams.
-
#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.
-
#migrate_to_data_stream(arguments = {}) ⇒ Object
Migrates an alias to a data stream.
-
#modify_data_stream(arguments = {}) ⇒ Object
Modifies a data stream.
-
#open(arguments = {}) ⇒ Object
Opens an index.
-
#promote_data_stream(arguments = {}) ⇒ Object
Promotes a data stream from a replicated data stream managed by CCR to a regular data stream.
-
#put_alias(arguments = {}) ⇒ Object
Creates or updates an alias.
-
#put_data_lifecycle(arguments = {}) ⇒ Object
Updates the data stream lifecycle of the selected data streams.
-
#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.
-
#reload_search_analyzers(arguments = {}) ⇒ Object
Reloads an index’s search analyzers and their resources.
-
#resolve_cluster(arguments = {}) ⇒ Object
Resolves the specified index expressions to return information about each cluster, including the local cluster, if included.
-
#resolve_index(arguments = {}) ⇒ Object
Returns information about any matching indices, aliases, and data streams.
-
#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
Unfreezes an index.
-
#update_aliases(arguments = {}) ⇒ Object
Updates index aliases.
-
#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.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/elasticsearch/api/actions/indices/add_block.rb', line 38 def add_block(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.add_block' } defined_params = %i[index block].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'block' missing" unless arguments[:block] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) _block = arguments.delete(:block) method = Elasticsearch::API::HTTP_PUT path = "#{Utils.__listify(_index)}/_block/#{Utils.__listify(_block)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#analyze(arguments = {}) ⇒ Object
Performs the analysis process on a text and return the tokens breakdown of the text.
33 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 59 60 61 62 63 64 |
# File 'lib/elasticsearch/api/actions/indices/analyze.rb', line 33 def analyze(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.analyze' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _index = arguments.delete(:index) method = if body Elasticsearch::API::HTTP_POST else Elasticsearch::API::HTTP_GET end path = if _index "#{Utils.__listify(_index)}/_analyze" else '_analyze' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#clear_cache(arguments = {}) ⇒ Object
Clears all or specific caches for one or more indices.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/elasticsearch/api/actions/indices/clear_cache.rb', line 39 def clear_cache(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.clear_cache' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = if _index "#{Utils.__listify(_index)}/_cache/clear" else '_cache/clear' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#clone(arguments = {}) ⇒ Object
Clones an index
37 38 39 40 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/clone.rb', line 37 def clone(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.clone' } defined_params = %i[index target].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'target' missing" unless arguments[:target] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _index = arguments.delete(:index) _target = arguments.delete(:target) method = Elasticsearch::API::HTTP_PUT path = "#{Utils.__listify(_index)}/_clone/#{Utils.__listify(_target)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#close(arguments = {}) ⇒ Object
Closes an index.
38 39 40 41 42 43 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/close.rb', line 38 def close(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.close' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = "#{Utils.__listify(_index)}/_close" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#create(arguments = {}) ⇒ Object
Creates an index with optional settings and mappings.
36 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/create.rb', line 36 def create(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.create' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_PUT path = "#{Utils.__listify(_index)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#create_data_stream(arguments = {}) ⇒ Object
Creates a data stream
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/create_data_stream.rb', line 34 def create_data_stream(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.create_data_stream' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_PUT path = "_data_stream/#{Utils.__listify(_name)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#data_streams_stats(arguments = {}) ⇒ Object
Provides statistics on operations happening in a data stream.
32 33 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/data_streams_stats.rb', line 32 def data_streams_stats(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.data_streams_stats' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_GET path = if _name "_data_stream/#{Utils.__listify(_name)}/_stats" else '_data_stream/_stats' end params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#delete(arguments = {}) ⇒ Object
Deletes an index.
37 38 39 40 41 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 69 |
# File 'lib/elasticsearch/api/actions/indices/delete.rb', line 37 def delete(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.delete' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_DELETE path = "#{Utils.__listify(_index)}" params = Utils.process_params(arguments) if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found do Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end else Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end end |
#delete_alias(arguments = {}) ⇒ Object
Deletes an alias.
35 36 37 38 39 40 41 42 43 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/delete_alias.rb', line 35 def delete_alias(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.delete_alias' } defined_params = %i[index name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_DELETE path = ("#{Utils.__listify(_index)}/_aliases/#{Utils.__listify(_name)}" if _index && _name) params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#delete_data_lifecycle(arguments = {}) ⇒ Object
Deletes the data stream lifecycle of the selected data streams.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/elasticsearch/api/actions/indices/delete_data_lifecycle.rb', line 35 def delete_data_lifecycle(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.delete_data_lifecycle' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_DELETE path = "_data_stream/#{Utils.__listify(_name)}/_lifecycle" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#delete_data_stream(arguments = {}) ⇒ Object
Deletes a data stream.
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/delete_data_stream.rb', line 34 def delete_data_stream(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.delete_data_stream' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_DELETE path = "_data_stream/#{Utils.__listify(_name)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#delete_index_template(arguments = {}) ⇒ Object
Deletes an index template.
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/delete_index_template.rb', line 34 def delete_index_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.delete_index_template' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_DELETE path = "_index_template/#{Utils.__listify(_name)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#delete_template(arguments = {}) ⇒ Object
Deletes an index template.
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 59 60 61 62 63 64 65 66 |
# File 'lib/elasticsearch/api/actions/indices/delete_template.rb', line 34 def delete_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.delete_template' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_DELETE path = "_template/#{Utils.__listify(_name)}" params = Utils.process_params(arguments) if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found do Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end else Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end end |
#disk_usage(arguments = {}) ⇒ Object
Analyzes the disk usage of each field of an index or data stream 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.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/elasticsearch/api/actions/indices/disk_usage.rb', line 41 def disk_usage(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.disk_usage' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = "#{Utils.__listify(_index)}/_disk_usage" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#downsample(arguments = {}) ⇒ Object
Downsample an index 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.
38 39 40 41 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 |
# File 'lib/elasticsearch/api/actions/indices/downsample.rb', line 38 def downsample(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.downsample' } defined_params = %i[index target_index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'target_index' missing" unless arguments[:target_index] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _index = arguments.delete(:index) _target_index = arguments.delete(:target_index) method = Elasticsearch::API::HTTP_POST path = "#{Utils.__listify(_index)}/_downsample/#{Utils.__listify(_target_index)}" params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#exists(arguments = {}) ⇒ Object Also known as: exists?
Returns information about whether a particular index exists.
38 39 40 41 42 43 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/exists.rb', line 38 def exists(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.exists' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_HEAD path = "#{Utils.__listify(_index)}" params = Utils.process_params(arguments) Utils.__rescue_from_not_found do perform_request(method, path, params, body, headers, request_opts).status == 200 end end |
#exists_alias(arguments = {}) ⇒ Object Also known as: exists_alias?
Returns information about whether a particular alias exists.
37 38 39 40 41 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 |
# File 'lib/elasticsearch/api/actions/indices/exists_alias.rb', line 37 def exists_alias(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.exists_alias' } defined_params = %i[name index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _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.process_params(arguments) Utils.__rescue_from_not_found do perform_request(method, path, params, body, headers, request_opts).status == 200 end end |
#exists_index_template(arguments = {}) ⇒ Object Also known as: exists_index_template?
Returns information about whether a particular index template exists.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/elasticsearch/api/actions/indices/exists_index_template.rb', line 35 def exists_index_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.exists_index_template' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_HEAD path = "_index_template/#{Utils.__listify(_name)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#exists_template(arguments = {}) ⇒ Object Also known as: exists_template?
Returns information about whether a particular index template exists.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/elasticsearch/api/actions/indices/exists_template.rb', line 35 def exists_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.exists_template' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_HEAD path = "_template/#{Utils.__listify(_name)}" params = Utils.process_params(arguments) Utils.__rescue_from_not_found do perform_request(method, path, params, body, headers, request_opts).status == 200 end end |
#explain_data_lifecycle(arguments = {}) ⇒ Object
Retrieves information about the index’s current data stream lifecycle, such as any potential encountered error, time since creation etc.
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/explain_data_lifecycle.rb', line 34 def explain_data_lifecycle(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.explain_data_lifecycle' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = "#{Utils.__listify(_index)}/_lifecycle/explain" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#field_usage_stats(arguments = {}) ⇒ Object
Returns the field usage stats for each field of an index 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.
40 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/field_usage_stats.rb', line 40 def field_usage_stats(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.field_usage_stats' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = "#{Utils.__listify(_index)}/_field_usage_stats" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#flush(arguments = {}) ⇒ Object
Performs the flush operation on 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 61 62 63 |
# File 'lib/elasticsearch/api/actions/indices/flush.rb', line 37 def flush(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.flush' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = if _index "#{Utils.__listify(_index)}/_flush" else '_flush' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#forcemerge(arguments = {}) ⇒ Object
Performs the force merge operation on one or more indices.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/elasticsearch/api/actions/indices/forcemerge.rb', line 39 def forcemerge(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.forcemerge' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = if _index "#{Utils.__listify(_index)}/_forcemerge" else '_forcemerge' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get(arguments = {}) ⇒ Object
Returns information about one or more indices.
40 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.rb', line 40 def get(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.get' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = "#{Utils.__listify(_index)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_alias(arguments = {}) ⇒ Object
Returns an alias.
37 38 39 40 41 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 69 |
# File 'lib/elasticsearch/api/actions/indices/get_alias.rb', line 37 def get_alias(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.get_alias' } defined_params = %i[name index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _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.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_data_lifecycle(arguments = {}) ⇒ Object
Returns the data stream lifecycle of the selected data streams.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/elasticsearch/api/actions/indices/get_data_lifecycle.rb', line 35 def get_data_lifecycle(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.get_data_lifecycle' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_GET path = "_data_stream/#{Utils.__listify(_name)}/_lifecycle" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_data_stream(arguments = {}) ⇒ Object
Returns data streams.
36 37 38 39 40 41 42 43 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/get_data_stream.rb', line 36 def get_data_stream(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.get_data_stream' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_GET path = if _name "_data_stream/#{Utils.__listify(_name)}" else '_data_stream' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_field_mapping(arguments = {}) ⇒ Object
Returns mapping for one or more fields.
38 39 40 41 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 |
# File 'lib/elasticsearch/api/actions/indices/get_field_mapping.rb', line 38 def get_field_mapping(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.get_field_mapping' } defined_params = %i[fields index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone _fields = arguments.delete(:field) || arguments.delete(:fields) raise ArgumentError, "Required argument 'field' missing" unless _fields headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = if _index && _fields "#{Utils.__listify(_index)}/_mapping/field/#{Utils.__listify(_fields)}" else "_mapping/field/#{Utils.__listify(_fields)}" end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_index_template(arguments = {}) ⇒ Object
Returns an index template.
36 37 38 39 40 41 42 43 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/get_index_template.rb', line 36 def get_index_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.get_index_template' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_GET path = if _name "_index_template/#{Utils.__listify(_name)}" else '_index_template' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_mapping(arguments = {}) ⇒ Object
Returns mappings 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 61 62 63 |
# File 'lib/elasticsearch/api/actions/indices/get_mapping.rb', line 37 def get_mapping(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.get_mapping' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = if _index "#{Utils.__listify(_index)}/_mapping" else '_mapping' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_settings(arguments = {}) ⇒ Object
Returns settings for one or more indices.
40 41 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 69 70 71 72 |
# File 'lib/elasticsearch/api/actions/indices/get_settings.rb', line 40 def get_settings(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.get_settings' } defined_params = %i[index name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _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.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_template(arguments = {}) ⇒ Object
Returns an index template.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/elasticsearch/api/actions/indices/get_template.rb', line 35 def get_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.get_template' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_GET path = if _name "_template/#{Utils.__listify(_name)}" else '_template' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#migrate_to_data_stream(arguments = {}) ⇒ Object
Migrates an alias to a data stream
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/migrate_to_data_stream.rb', line 34 def migrate_to_data_stream(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.migrate_to_data_stream' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_POST path = "_data_stream/_migrate/#{Utils.__listify(_name)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#modify_data_stream(arguments = {}) ⇒ Object
Modifies a data stream
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/elasticsearch/api/actions/indices/modify_data_stream.rb', line 32 def modify_data_stream(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.modify_data_stream' } raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) method = Elasticsearch::API::HTTP_POST path = '_data_stream/_modify' params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#open(arguments = {}) ⇒ Object
Opens an index.
38 39 40 41 42 43 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/open.rb', line 38 def open(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.open' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = "#{Utils.__listify(_index)}/_open" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#promote_data_stream(arguments = {}) ⇒ Object
Promotes a data stream from a replicated data stream managed by CCR to a regular data stream
33 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/promote_data_stream.rb', line 33 def promote_data_stream(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.promote_data_stream' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_POST path = "_data_stream/_promote/#{Utils.__listify(_name)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_alias(arguments = {}) ⇒ Object
Creates or updates an alias.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/elasticsearch/api/actions/indices/put_alias.rb', line 36 def put_alias(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.put_alias' } defined_params = %i[index name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _index = arguments.delete(:index) _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_PUT path = ("#{Utils.__listify(_index)}/_aliases/#{Utils.__listify(_name)}" if _index && _name) params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_data_lifecycle(arguments = {}) ⇒ Object
Updates the data stream lifecycle of the selected data streams.
36 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/put_data_lifecycle.rb', line 36 def put_data_lifecycle(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.put_data_lifecycle' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_PUT path = "_data_stream/#{Utils.__listify(_name)}/_lifecycle" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_index_template(arguments = {}) ⇒ Object
Creates or updates an index template.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/elasticsearch/api/actions/indices/put_index_template.rb', line 36 def put_index_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.put_index_template' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_PUT path = "_index_template/#{Utils.__listify(_name)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_mapping(arguments = {}) ⇒ Object
Updates the index mappings.
39 40 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/put_mapping.rb', line 39 def put_mapping(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.put_mapping' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_PUT path = "#{Utils.__listify(_index)}/_mapping" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_settings(arguments = {}) ⇒ Object
Updates the index settings.
41 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 69 |
# File 'lib/elasticsearch/api/actions/indices/put_settings.rb', line 41 def put_settings(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.put_settings' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_PUT path = if _index "#{Utils.__listify(_index)}/_settings" else '_settings' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_template(arguments = {}) ⇒ Object
Creates or updates an index template.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/elasticsearch/api/actions/indices/put_template.rb', line 36 def put_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.put_template' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_PUT path = "_template/#{Utils.__listify(_name)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#recovery(arguments = {}) ⇒ Object
Returns information about ongoing index shard recoveries.
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 59 60 |
# File 'lib/elasticsearch/api/actions/indices/recovery.rb', line 34 def recovery(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.recovery' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = if _index "#{Utils.__listify(_index)}/_recovery" else '_recovery' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#refresh(arguments = {}) ⇒ Object
Performs the refresh operation in one or more indices.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/elasticsearch/api/actions/indices/refresh.rb', line 35 def refresh(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.refresh' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = if _index "#{Utils.__listify(_index)}/_refresh" else '_refresh' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#reload_search_analyzers(arguments = {}) ⇒ Object
Reloads an index’s search analyzers and their resources.
36 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/reload_search_analyzers.rb', line 36 def reload_search_analyzers(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.reload_search_analyzers' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = "#{Utils.__listify(_index)}/_reload_search_analyzers" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#resolve_cluster(arguments = {}) ⇒ Object
Resolves the specified index expressions to return information about each cluster, including the local cluster, if included.
36 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/resolve_cluster.rb', line 36 def resolve_cluster(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.resolve_cluster' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_GET path = "_resolve/cluster/#{Utils.__listify(_name)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#resolve_index(arguments = {}) ⇒ Object
Returns information about any matching indices, aliases, and data streams
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/elasticsearch/api/actions/indices/resolve_index.rb', line 35 def resolve_index(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.resolve_index' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_GET path = "_resolve/index/#{Utils.__listify(_name)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) 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.
41 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 69 70 71 |
# File 'lib/elasticsearch/api/actions/indices/rollover.rb', line 41 def rollover(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.rollover' } defined_params = %i[alias new_index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'alias' missing" unless arguments[:alias] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _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.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#segments(arguments = {}) ⇒ Object
Provides low-level information about segments in a Lucene index.
36 37 38 39 40 41 42 43 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/segments.rb', line 36 def segments(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.segments' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = if _index "#{Utils.__listify(_index)}/_segments" else '_segments' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#shard_stores(arguments = {}) ⇒ Object
Provides store information for shard copies of indices.
36 37 38 39 40 41 42 43 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/shard_stores.rb', line 36 def shard_stores(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.shard_stores' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = if _index "#{Utils.__listify(_index)}/_shard_stores" else '_shard_stores' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#shrink(arguments = {}) ⇒ Object
Allow to shrink an existing index into a new index with fewer primary shards.
37 38 39 40 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/shrink.rb', line 37 def shrink(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.shrink' } defined_params = %i[index target].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'target' missing" unless arguments[:target] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _index = arguments.delete(:index) _target = arguments.delete(:target) method = Elasticsearch::API::HTTP_PUT path = "#{Utils.__listify(_index)}/_shrink/#{Utils.__listify(_target)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#simulate_index_template(arguments = {}) ⇒ Object
Simulate matching the given index name against the index templates in the system
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/elasticsearch/api/actions/indices/simulate_index_template.rb', line 37 def simulate_index_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.simulate_index_template' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_POST path = "_index_template/_simulate_index/#{Utils.__listify(_name)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#simulate_template(arguments = {}) ⇒ Object
Simulate resolving the given template name or body
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/elasticsearch/api/actions/indices/simulate_template.rb', line 37 def simulate_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.simulate_template' } defined_params = [:name].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _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.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#split(arguments = {}) ⇒ Object
Allows you to split an existing index into a new index with more primary shards.
37 38 39 40 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/split.rb', line 37 def split(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.split' } defined_params = %i[index target].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'target' missing" unless arguments[:target] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _index = arguments.delete(:index) _target = arguments.delete(:target) method = Elasticsearch::API::HTTP_PUT path = "#{Utils.__listify(_index)}/_split/#{Utils.__listify(_target)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#stats(arguments = {}) ⇒ Object
Provides statistics on operations happening in an index.
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 69 70 71 72 73 74 |
# File 'lib/elasticsearch/api/actions/indices/stats.rb', line 42 def stats(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.stats' } defined_params = %i[metric index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _metric = arguments.delete(:metric) _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = if _index && _metric "#{Utils.__listify(_index)}/_stats/#{Utils.__listify(_metric)}" elsif _metric "_stats/#{Utils.__listify(_metric)}" elsif _index "#{Utils.__listify(_index)}/_stats" else '_stats' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#unfreeze(arguments = {}) ⇒ Object
Unfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again.
*Deprecation notice*: Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization. They will be removed in a future release. Deprecated since version 7.14.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 67 |
# File 'lib/elasticsearch/api/actions/indices/unfreeze.rb', line 43 def unfreeze(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.unfreeze' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_POST path = "#{Utils.__listify(_index)}/_unfreeze" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#update_aliases(arguments = {}) ⇒ Object
Updates index aliases.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/elasticsearch/api/actions/indices/update_aliases.rb', line 34 def update_aliases(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.update_aliases' } raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) method = Elasticsearch::API::HTTP_POST path = '_aliases' params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#validate_query(arguments = {}) ⇒ Object
Allows a user to validate a potentially expensive query without executing it.
45 46 47 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 75 76 |
# File 'lib/elasticsearch/api/actions/indices/validate_query.rb', line 45 def validate_query(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.validate_query' } defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _index = arguments.delete(:index) method = if body Elasticsearch::API::HTTP_POST else Elasticsearch::API::HTTP_GET end path = if _index "#{Utils.__listify(_index)}/_validate/query" else '_validate/query' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |