Module: ElasticsearchServerless::API::Indices::Actions
- Defined in:
- lib/elasticsearch-serverless/api/indices/get.rb,
lib/elasticsearch-serverless/api/indices/create.rb,
lib/elasticsearch-serverless/api/indices/delete.rb,
lib/elasticsearch-serverless/api/indices/exists.rb,
lib/elasticsearch-serverless/api/indices/analyze.rb,
lib/elasticsearch-serverless/api/indices/refresh.rb,
lib/elasticsearch-serverless/api/indices/rollover.rb,
lib/elasticsearch-serverless/api/indices/add_block.rb,
lib/elasticsearch-serverless/api/indices/get_alias.rb,
lib/elasticsearch-serverless/api/indices/put_alias.rb,
lib/elasticsearch-serverless/api/indices/get_mapping.rb,
lib/elasticsearch-serverless/api/indices/put_mapping.rb,
lib/elasticsearch-serverless/api/indices/delete_alias.rb,
lib/elasticsearch-serverless/api/indices/exists_alias.rb,
lib/elasticsearch-serverless/api/indices/get_settings.rb,
lib/elasticsearch-serverless/api/indices/put_settings.rb,
lib/elasticsearch-serverless/api/indices/resolve_index.rb,
lib/elasticsearch-serverless/api/indices/update_aliases.rb,
lib/elasticsearch-serverless/api/indices/validate_query.rb,
lib/elasticsearch-serverless/api/indices/get_data_stream.rb,
lib/elasticsearch-serverless/api/indices/simulate_template.rb,
lib/elasticsearch-serverless/api/indices/create_data_stream.rb,
lib/elasticsearch-serverless/api/indices/delete_data_stream.rb,
lib/elasticsearch-serverless/api/indices/get_data_lifecycle.rb,
lib/elasticsearch-serverless/api/indices/get_index_template.rb,
lib/elasticsearch-serverless/api/indices/modify_data_stream.rb,
lib/elasticsearch-serverless/api/indices/put_data_lifecycle.rb,
lib/elasticsearch-serverless/api/indices/put_index_template.rb,
lib/elasticsearch-serverless/api/indices/delete_index_template.rb,
lib/elasticsearch-serverless/api/indices/exists_index_template.rb,
lib/elasticsearch-serverless/api/indices/explain_data_lifecycle.rb,
lib/elasticsearch-serverless/api/indices/migrate_to_data_stream.rb,
lib/elasticsearch-serverless/api/indices/simulate_index_template.rb
Instance Method Summary collapse
-
#add_block(arguments = {}) ⇒ Object
Add an index block.
-
#analyze(arguments = {}) ⇒ Object
Get tokens from text analysis.
-
#create(arguments = {}) ⇒ Object
Create an index.
-
#create_data_stream(arguments = {}) ⇒ Object
Create a data stream.
-
#delete(arguments = {}) ⇒ Object
Delete indices.
-
#delete_alias(arguments = {}) ⇒ Object
Delete an alias.
-
#delete_data_stream(arguments = {}) ⇒ Object
Delete data streams.
-
#delete_index_template(arguments = {}) ⇒ Object
Delete an index template.
-
#exists(arguments = {}) ⇒ Object
(also: #exists?)
Check indices.
-
#exists_alias(arguments = {}) ⇒ Object
(also: #exists_alias?)
Check aliases.
-
#exists_index_template(arguments = {}) ⇒ Object
(also: #exists_index_template?)
Returns information about whether a particular index template exists.
-
#explain_data_lifecycle(arguments = {}) ⇒ Object
Get the status for a data stream lifecycle.
-
#get(arguments = {}) ⇒ Object
Get index information.
-
#get_alias(arguments = {}) ⇒ Object
Get aliases.
-
#get_data_lifecycle(arguments = {}) ⇒ Object
Get data stream lifecycles.
-
#get_data_stream(arguments = {}) ⇒ Object
Get data streams.
-
#get_index_template(arguments = {}) ⇒ Object
Get index templates.
-
#get_mapping(arguments = {}) ⇒ Object
Get mapping definitions.
-
#get_settings(arguments = {}) ⇒ Object
Get index settings.
-
#migrate_to_data_stream(arguments = {}) ⇒ Object
Convert an index alias to a data stream.
-
#modify_data_stream(arguments = {}) ⇒ Object
Update data streams.
-
#put_alias(arguments = {}) ⇒ Object
Create or update an alias.
-
#put_data_lifecycle(arguments = {}) ⇒ Object
Update data stream lifecycles.
-
#put_index_template(arguments = {}) ⇒ Object
Create or update an index template.
-
#put_mapping(arguments = {}) ⇒ Object
Update field mappings.
-
#put_settings(arguments = {}) ⇒ Object
Update index settings.
-
#refresh(arguments = {}) ⇒ Object
Refresh an index.
-
#resolve_index(arguments = {}) ⇒ Object
Resolves the specified name(s) and/or index patterns for indices, aliases, and data streams.
-
#rollover(arguments = {}) ⇒ Object
Roll over to a new index.
-
#simulate_index_template(arguments = {}) ⇒ Object
Simulate an index.
-
#simulate_template(arguments = {}) ⇒ Object
Simulate an index template.
-
#update_aliases(arguments = {}) ⇒ Object
Create or update an alias.
-
#validate_query(arguments = {}) ⇒ Object
Validate a query.
Instance Method Details
#add_block(arguments = {}) ⇒ Object
Add an index block. Limits the operations allowed on an index by blocking specific operation types.
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-serverless/api/indices/add_block.rb', line 39 def add_block(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.add_block" } defined_params = [:index, :block].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_PUT path = "#{Utils.listify(_index)}/_block/#{Utils.listify(_block)}" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#analyze(arguments = {}) ⇒ Object
Get tokens from text analysis. The analyze API performs analysis on a text string and returns the resulting tokens.
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 67 68 |
# File 'lib/elasticsearch-serverless/api/indices/analyze.rb', line 36 def analyze(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.analyze" } defined_params = [:index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 ElasticsearchServerless::API::HTTP_POST else ElasticsearchServerless::API::HTTP_GET end path = if _index "#{Utils.listify(_index)}/_analyze" else "_analyze" end params = {} ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#create(arguments = {}) ⇒ Object
Create an index. Creates a new index.
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-serverless/api/indices/create.rb', line 40 def create(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.create" } defined_params = [:index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_PUT path = "#{Utils.listify(_index)}" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#create_data_stream(arguments = {}) ⇒ Object
Create a data stream. Creates a data stream. You must have a matching index template with data stream enabled.
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-serverless/api/indices/create_data_stream.rb', line 41 def create_data_stream(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.create_data_stream" } defined_params = [:name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_PUT path = "_data_stream/#{Utils.listify(_name)}" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#delete(arguments = {}) ⇒ Object
Delete indices. Deletes one or more indices.
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 77 78 79 80 |
# File 'lib/elasticsearch-serverless/api/indices/delete.rb', line 47 def delete(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.delete" } defined_params = [:index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_DELETE path = "#{Utils.listify(_index)}" params = Utils.process_params(arguments) if Array(arguments[:ignore]).include?(404) Utils.rescue_from_not_found { ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) } else ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end end |
#delete_alias(arguments = {}) ⇒ Object
Delete an alias. Removes a data stream or index from an alias.
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 |
# File 'lib/elasticsearch-serverless/api/indices/delete_alias.rb', line 40 def delete_alias(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.delete_alias" } defined_params = [:index, :name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_DELETE path = if _index && _name "#{Utils.listify(_index)}/_aliases/#{Utils.listify(_name)}" end params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#delete_data_stream(arguments = {}) ⇒ Object
Delete data streams. Deletes one or more data streams and their backing 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 |
# File 'lib/elasticsearch-serverless/api/indices/delete_data_stream.rb', line 35 def delete_data_stream(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.delete_data_stream" } defined_params = [:name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_DELETE path = "_data_stream/#{Utils.listify(_name)}" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#delete_index_template(arguments = {}) ⇒ Object
Delete an index template. The provided <index-template> may contain multiple template names separated by a comma. If multiple template names are specified then there is no wildcard support and the provided names should match completely with existing templates.
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-serverless/api/indices/delete_index_template.rb', line 37 def delete_index_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.delete_index_template" } defined_params = [:name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_DELETE path = "_index_template/#{Utils.listify(_name)}" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#exists(arguments = {}) ⇒ Object Also known as: exists?
Check indices. Checks if one or more indices, index aliases, or data streams exist.
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-serverless/api/indices/exists.rb', line 43 def exists(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.exists" } defined_params = [:index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::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 ? true : false end end |
#exists_alias(arguments = {}) ⇒ Object Also known as: exists_alias?
Check aliases. Checks if one or more data stream or index aliases exist.
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 |
# File 'lib/elasticsearch-serverless/api/indices/exists_alias.rb', line 42 def exists_alias(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.exists_alias" } defined_params = [:name, :index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::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 ? true : false end end |
#exists_index_template(arguments = {}) ⇒ Object Also known as: exists_index_template?
Returns information about whether a particular index template exists.
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-serverless/api/indices/exists_index_template.rb', line 33 def exists_index_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.exists_index_template" } defined_params = [:name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_HEAD path = "_index_template/#{Utils.listify(_name)}" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#explain_data_lifecycle(arguments = {}) ⇒ Object
Get the status for a data stream lifecycle. Retrieves information about an index or data stream’s current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution.
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-serverless/api/indices/explain_data_lifecycle.rb', line 35 def explain_data_lifecycle(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.explain_data_lifecycle" } defined_params = [:index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_GET path = "#{Utils.listify(_index)}/_lifecycle/explain" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get(arguments = {}) ⇒ Object
Get index information. Returns information about one or more indices. For data streams, the API returns information about the stream’s backing indices.
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-serverless/api/indices/get.rb', line 47 def get(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.get" } defined_params = [:index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_GET path = "#{Utils.listify(_index)}" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_alias(arguments = {}) ⇒ Object
Get aliases. Retrieves information for one or more data stream or index aliases.
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 77 78 |
# File 'lib/elasticsearch-serverless/api/indices/get_alias.rb', line 45 def get_alias(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.get_alias" } defined_params = [:name, :index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::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) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_data_lifecycle(arguments = {}) ⇒ Object
Get data stream lifecycles. Retrieves the data stream lifecycle configuration of one or more data streams.
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-serverless/api/indices/get_data_lifecycle.rb', line 40 def get_data_lifecycle(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.get_data_lifecycle" } defined_params = [:name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_GET path = "_data_stream/#{Utils.listify(_name)}/_lifecycle" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_data_stream(arguments = {}) ⇒ Object
Get data streams. Retrieves information about one or more data streams.
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-serverless/api/indices/get_data_stream.rb', line 39 def get_data_stream(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.get_data_stream" } defined_params = [:name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_GET path = if _name "_data_stream/#{Utils.listify(_name)}" else "_data_stream" end params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_index_template(arguments = {}) ⇒ Object
Get index templates. Returns information about one or more index templates.
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-serverless/api/indices/get_index_template.rb', line 37 def get_index_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.get_index_template" } defined_params = [:name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_GET path = if _name "_index_template/#{Utils.listify(_name)}" else "_index_template" end params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_mapping(arguments = {}) ⇒ Object
Get mapping definitions. Retrieves mapping definitions for one or more indices. For data streams, the API retrieves mappings for the stream’s backing indices.
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 |
# File 'lib/elasticsearch-serverless/api/indices/get_mapping.rb', line 46 def get_mapping(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.get_mapping" } defined_params = [:index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_GET path = if _index "#{Utils.listify(_index)}/_mapping" else "_mapping" end params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_settings(arguments = {}) ⇒ Object
Get index settings. Returns setting information for one or more indices. For data streams, returns setting information for the stream’s backing indices.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/elasticsearch-serverless/api/indices/get_settings.rb', line 53 def get_settings(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.get_settings" } defined_params = [:index, :name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::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) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#migrate_to_data_stream(arguments = {}) ⇒ Object
Convert an index alias to a data stream. Converts an index alias to a data stream. You must have a matching index template that is data stream enabled. The alias must meet the following criteria: The alias must have a write index; All indices for the alias must have a @timestamp field mapping of a date
or date_nanos
field type; The alias must not have any filters; The alias must not use custom routing. If successful, the request removes the alias and creates a data stream with the same name. The indices for the alias become hidden backing indices for the stream. The write index for the alias becomes the write index for the stream.
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-serverless/api/indices/migrate_to_data_stream.rb', line 44 def migrate_to_data_stream(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.migrate_to_data_stream" } defined_params = [:name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_POST path = "_data_stream/_migrate/#{Utils.listify(_name)}" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#modify_data_stream(arguments = {}) ⇒ Object
Update data streams. Performs one or more data stream modification actions in a single atomic operation.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elasticsearch-serverless/api/indices/modify_data_stream.rb', line 33 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 = ElasticsearchServerless::API::HTTP_POST path = "_data_stream/_modify" params = {} ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_alias(arguments = {}) ⇒ Object
Create or update an alias. Adds a data stream or index to an alias.
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 |
# File 'lib/elasticsearch-serverless/api/indices/put_alias.rb', line 43 def put_alias(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.put_alias" } defined_params = [:index, :name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_PUT path = if _index && _name "#{Utils.listify(_index)}/_aliases/#{Utils.listify(_name)}" end params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_data_lifecycle(arguments = {}) ⇒ Object
Update data stream lifecycles. Update the data stream lifecycle of the specified data streams.
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 |
# File 'lib/elasticsearch-serverless/api/indices/put_data_lifecycle.rb', line 44 def put_data_lifecycle(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.put_data_lifecycle" } defined_params = [:name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_PUT path = "_data_stream/#{Utils.listify(_name)}/_lifecycle" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_index_template(arguments = {}) ⇒ Object
Create or update an index template. Index templates define settings, mappings, and aliases that can be applied automatically to new indices.
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-serverless/api/indices/put_index_template.rb', line 38 def put_index_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.put_index_template" } defined_params = [:name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_PUT path = "_index_template/#{Utils.listify(_name)}" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_mapping(arguments = {}) ⇒ Object
Update field mappings. Adds new fields to an existing data stream or index. You can also use this API to change the search settings of existing fields. For data streams, these changes are applied to all backing indices by default.
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-serverless/api/indices/put_mapping.rb', line 48 def put_mapping(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.put_mapping" } defined_params = [:index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_PUT path = "#{Utils.listify(_index)}/_mapping" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_settings(arguments = {}) ⇒ Object
Update index settings. Changes dynamic index settings in real time. For data streams, index setting changes are applied to all backing indices by default.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/elasticsearch-serverless/api/indices/put_settings.rb', line 54 def put_settings(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.put_settings" } defined_params = [:index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_PUT path = if _index "#{Utils.listify(_index)}/_settings" else "_settings" end params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#refresh(arguments = {}) ⇒ Object
Refresh an index. A refresh makes recent operations performed on one or more indices available for search. For data streams, the API runs the refresh operation on the stream’s backing indices.
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 |
# File 'lib/elasticsearch-serverless/api/indices/refresh.rb', line 43 def refresh(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.refresh" } defined_params = [:index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_POST path = if _index "#{Utils.listify(_index)}/_refresh" else "_refresh" end params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#resolve_index(arguments = {}) ⇒ Object
Resolves the specified name(s) and/or index patterns for indices, aliases, and data streams. Multiple patterns and remote clusters are supported.
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-serverless/api/indices/resolve_index.rb', line 42 def resolve_index(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.resolve_index" } defined_params = [:name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_GET path = "_resolve/index/#{Utils.listify(_name)}" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#rollover(arguments = {}) ⇒ Object
Roll over to a new index. Creates a new index for a data stream or index alias.
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 75 |
# File 'lib/elasticsearch-serverless/api/indices/rollover.rb', line 44 def rollover(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.rollover" } defined_params = [:alias, :new_index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::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) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#simulate_index_template(arguments = {}) ⇒ Object
Simulate an index. Returns the index configuration that would be applied to the specified index from an existing 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 |
# File 'lib/elasticsearch-serverless/api/indices/simulate_index_template.rb', line 35 def simulate_index_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.simulate_index_template" } defined_params = [:name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_POST path = "_index_template/_simulate_index/#{Utils.listify(_name)}" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#simulate_template(arguments = {}) ⇒ Object
Simulate an index template. Returns the index configuration that would be applied by a particular index template.
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-serverless/api/indices/simulate_template.rb', line 38 def simulate_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.simulate_template" } defined_params = [:name].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 = ElasticsearchServerless::API::HTTP_POST path = if _name "_index_template/_simulate/#{Utils.listify(_name)}" else "_index_template/_simulate" end params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#update_aliases(arguments = {}) ⇒ Object
Create or update an alias. Adds a data stream or index to an alias.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/elasticsearch-serverless/api/indices/update_aliases.rb', line 37 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 = ElasticsearchServerless::API::HTTP_POST path = "_aliases" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#validate_query(arguments = {}) ⇒ Object
Validate a query. Validates a query without running it.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/elasticsearch-serverless/api/indices/validate_query.rb', line 54 def validate_query(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || "indices.validate_query" } defined_params = [:index].inject({}) do |set_variables, variable| set_variables[variable] = arguments[variable] if arguments.key?(variable) set_variables 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 ElasticsearchServerless::API::HTTP_POST else ElasticsearchServerless::API::HTTP_GET end path = if _index "#{Utils.listify(_index)}/_validate/query" else "_validate/query" end params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |