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/data_streams_stats.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_data_lifecycle.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

Instance Method Details

#add_block(arguments = {}) ⇒ Object

Adds a block to an index.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    A comma separated list of indices to add a block to (Required)

  • :block (String)

    The block to add (one of read, write, read_only or metadata) (Required)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)

  • :expand_wildcards (String, Array<String>)

    Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :master_timeout (Time)

    Specify timeout for connection to master

  • :timeout (Time)

    Explicit operation timeout

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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/add_block.rb', line 38

def add_block(arguments = {})
  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)
  )
end

#analyze(arguments = {}) ⇒ Object

Performs the analysis process on a text and return the tokens breakdown of the text.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    Index used to derive the analyzer. If specified, the analyzer or field parameter overrides this value. If no index is specified or the index does not have a default analyzer, the analyze API uses the standard analyzer.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

See Also:



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-serverless/api/indices/analyze.rb', line 33

def analyze(arguments = {})
  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)
  )
end

#create(arguments = {}) ⇒ Object

Creates an index with optional settings and mappings.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    Name of the index you wish to create. (Required)

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :timeout (Time)

    Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :wait_for_active_shards (Integer, String)

    The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (+number_of_replicas+1+). Server default: 1.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/elasticsearch-serverless/api/indices/create.rb', line 36

def create(arguments = {})
  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)
  )
end

#create_data_stream(arguments = {}) ⇒ Object

Creates a data stream

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    Name of the data stream, which must meet the following criteria: Lowercase only; Cannot include ++, /, *, ?, , <, >, |, ,, #, :, or a space character; Cannot start with -, _, +++, or .ds-; Cannot be . or ..; Cannot be longer than 255 bytes. Multi-byte characters count towards this limit faster. (Required)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/elasticsearch-serverless/api/indices/create_data_stream.rb', line 32

def create_data_stream(arguments = {})
  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 = {}

  ElasticsearchServerless::API::Response.new(
    perform_request(method, path, params, body, headers)
  )
end

#data_streams_stats(arguments = {}) ⇒ Object

Provides statistics on operations happening in a data stream.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    Comma-separated list of data streams used to limit the request. Wildcard expressions (+*+) are supported. To target all data streams in a cluster, omit this parameter or use *.

  • :expand_wildcards (String, Array<String>)

    Type of data stream that wildcard patterns can match. Supports comma-separated values, such as open,hidden. Server default: open.

  • :headers (Hash)

    Custom HTTP headers

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/elasticsearch-serverless/api/indices/data_streams_stats.rb', line 33

def data_streams_stats(arguments = {})
  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)}/_stats"
           else
             "_data_stream/_stats"
           end
  params = Utils.process_params(arguments)

  ElasticsearchServerless::API::Response.new(
    perform_request(method, path, params, body, headers)
  )
end

#delete(arguments = {}) ⇒ Object

Deletes an index.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    Comma-separated list of indices to delete. You cannot specify index aliases. By default, this parameter does not support wildcards (+*+) or _all. To use wildcards or _all, set the action.destructive_requires_name cluster setting to false. (Required)

  • :allow_no_indices (Boolean)

    If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. Server default: true.

  • :expand_wildcards (String, Array<String>)

    Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. Server default: open.

  • :ignore_unavailable (Boolean)

    If false, the request returns an error if it targets a missing or closed index.

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :timeout (Time)

    Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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.rb', line 37

def delete(arguments = {})
  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)
      )
    }
  else
    ElasticsearchServerless::API::Response.new(
      perform_request(method, path, params, body, headers)
    )
  end
end

#delete_alias(arguments = {}) ⇒ Object

Deletes an alias.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    Comma-separated list of data streams or indices used to limit the request. Supports wildcards (+*+). (Required)

  • :name (String, Array<String>)

    Comma-separated list of aliases to remove. Supports wildcards (+*+). To remove all aliases, use * or _all. (Required)

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :timeout (Time)

    Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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-serverless/api/indices/delete_alias.rb', line 35

def delete_alias(arguments = {})
  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)
  )
end

#delete_data_lifecycle(arguments = {}) ⇒ Object

Deletes the data stream lifecycle of the selected data streams.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String, Array<String>)

    A comma-separated list of data streams of which the data stream lifecycle will be deleted; use * to get all data streams (Required)

  • :expand_wildcards (String, Array<String>)

    Whether wildcard expressions should get expanded to open or closed indices (default: open)

  • :master_timeout (Time)

    Specify timeout for connection to master

  • :timeout (Time)

    Explicit timestamp for the document

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/elasticsearch-serverless/api/indices/delete_data_lifecycle.rb', line 35

def delete_data_lifecycle(arguments = {})
  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)}/_lifecycle"
  params = Utils.process_params(arguments)

  ElasticsearchServerless::API::Response.new(
    perform_request(method, path, params, body, headers)
  )
end

#delete_data_stream(arguments = {}) ⇒ Object

Deletes a data stream.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String, Array<String>)

    Comma-separated list of data streams to delete. Wildcard (+*+) expressions are supported. (Required)

  • :expand_wildcards (String, Array<String>)

    Type of data stream that wildcard patterns can match. Supports comma-separated values,such as open,hidden. Server default: open.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/elasticsearch-serverless/api/indices/delete_data_stream.rb', line 33

def delete_data_stream(arguments = {})
  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)
  )
end

#delete_index_template(arguments = {}) ⇒ Object

Deletes an index template.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String, Array<String>)

    Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. (Required)

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :timeout (Time)

    Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/elasticsearch-serverless/api/indices/delete_index_template.rb', line 34

def delete_index_template(arguments = {})
  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)
  )
end

#exists(arguments = {}) ⇒ Object Also known as: exists?

Returns information about whether a particular index exists.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    Comma-separated list of data streams, indices, and aliases. Supports wildcards (+*+). (Required)

  • :allow_no_indices (Boolean)

    If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. Server default: true.

  • :expand_wildcards (String, Array<String>)

    Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. Server default: open.

  • :flat_settings (Boolean)

    If true, returns settings in flat format.

  • :ignore_unavailable (Boolean)

    If false, the request returns an error if it targets a missing or closed index.

  • :include_defaults (Boolean)

    If true, return all default settings in the response.

  • :local (Boolean)

    If true, the request retrieves information from the local node only.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/elasticsearch-serverless/api/indices/exists.rb', line 38

def exists(arguments = {})
  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).status == 200 ? true : false
  end
end

#exists_alias(arguments = {}) ⇒ Object Also known as: exists_alias?

Returns information about whether a particular alias exists.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String, Array<String>)

    Comma-separated list of aliases to check. Supports wildcards (+*+). (Required)

  • :index (String, Array)

    Comma-separated list of data streams or indices used to limit the request. Supports wildcards (+*+). To target all data streams and indices, omit this parameter or use * or _all.

  • :allow_no_indices (Boolean)

    If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. Server default: true.

  • :expand_wildcards (String, Array<String>)

    Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. Server default: open.

  • :ignore_unavailable (Boolean)

    If false, requests that include a missing data stream or index in the target indices or data streams return an error.

  • :local (Boolean)

    If true, the request retrieves information from the local node only.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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/exists_alias.rb', line 37

def exists_alias(arguments = {})
  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).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.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. (Required)

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/elasticsearch-serverless/api/indices/exists_index_template.rb', line 33

def exists_index_template(arguments = {})
  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)
  )
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.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    The name of the index to explain (Required)

  • :include_defaults (Boolean)

    indicates if the API should return the default values the system uses for the index’s lifecycle

  • :master_timeout (Time)

    Specify timeout for connection to master

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/elasticsearch-serverless/api/indices/explain_data_lifecycle.rb', line 34

def explain_data_lifecycle(arguments = {})
  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)
  )
end

#get(arguments = {}) ⇒ Object

Returns information about one or more indices.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported. (Required)

  • :allow_no_indices (Boolean)

    If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. Server default: true.

  • :expand_wildcards (String, Array<String>)

    Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Server default: open.

  • :flat_settings (Boolean)

    If true, returns settings in flat format.

  • :ignore_unavailable (Boolean)

    If false, requests that target a missing index return an error.

  • :include_defaults (Boolean)

    If true, return all default settings in the response.

  • :local (Boolean)

    If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node.

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :features (String, Array<String>)

    Return only information on specified index features Server default: [‘aliases’, ‘mappings’, ‘settings’].

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/elasticsearch-serverless/api/indices/get.rb', line 40

def get(arguments = {})
  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)
  )
end

#get_alias(arguments = {}) ⇒ Object

Returns an alias.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String, Array<String>)

    Comma-separated list of aliases to retrieve. Supports wildcards (+*+). To retrieve all aliases, omit this parameter or use * or _all.

  • :index (String, Array)

    Comma-separated list of data streams or indices used to limit the request. Supports wildcards (+*+). To target all data streams and indices, omit this parameter or use * or _all.

  • :allow_no_indices (Boolean)

    If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. Server default: true.

  • :expand_wildcards (String, Array<String>)

    Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. Server default: open.

  • :ignore_unavailable (Boolean)

    If false, the request returns an error if it targets a missing or closed index.

  • :local (Boolean)

    If true, the request retrieves information from the local node only.

  • :headers (Hash)

    Custom HTTP headers

See Also:



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/get_alias.rb', line 37

def get_alias(arguments = {})
  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)
  )
end

#get_data_lifecycle(arguments = {}) ⇒ Object

Returns the data stream lifecycle of the selected data streams.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String, Array<String>)

    Comma-separated list of data streams to limit the request. Supports wildcards (+*+). To target all data streams, omit this parameter or use * or _all. (Required)

  • :expand_wildcards (String, Array<String>)

    Type of data stream that wildcard patterns can match. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. Server default: open.

  • :include_defaults (Boolean)

    If true, return all default settings in the response.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/elasticsearch-serverless/api/indices/get_data_lifecycle.rb', line 34

def get_data_lifecycle(arguments = {})
  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)
  )
end

#get_data_stream(arguments = {}) ⇒ Object

Returns data streams.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String, Array<String>)

    Comma-separated list of data stream names used to limit the request. Wildcard (+*+) expressions are supported. If omitted, all data streams are returned.

  • :expand_wildcards (String, Array<String>)

    Type of data stream that wildcard patterns can match. Supports comma-separated values, such as open,hidden. Server default: open.

  • :include_defaults (Boolean)

    If true, returns all relevant default configurations for the index template.

  • :headers (Hash)

    Custom HTTP headers

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/elasticsearch-serverless/api/indices/get_data_stream.rb', line 34

def get_data_stream(arguments = {})
  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)
  )
end

#get_index_template(arguments = {}) ⇒ Object

Returns an index template.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported.

  • :local (Boolean)

    If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node.

  • :flat_settings (Boolean)

    If true, returns settings in flat format.

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :include_defaults (Boolean)

    If true, returns all relevant default configurations for the index template.

  • :headers (Hash)

    Custom HTTP headers

See Also:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/elasticsearch-serverless/api/indices/get_index_template.rb', line 36

def get_index_template(arguments = {})
  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)
  )
end

#get_mapping(arguments = {}) ⇒ Object

Returns mappings for one or more indices.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (+*+). To target all data streams and indices, omit this parameter or use * or _all.

  • :allow_no_indices (Boolean)

    If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. Server default: true.

  • :expand_wildcards (String, Array<String>)

    Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. Server default: open.

  • :ignore_unavailable (Boolean)

    If false, the request returns an error if it targets a missing or closed index.

  • :local (Boolean)

    If true, the request retrieves information from the local node only.

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

See Also:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/elasticsearch-serverless/api/indices/get_mapping.rb', line 37

def get_mapping(arguments = {})
  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)
  )
end

#get_settings(arguments = {}) ⇒ Object

Returns settings for one or more indices.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (+*+). To target all data streams and indices, omit this parameter or use * or _all.

  • :name (String, Array<String>)

    Comma-separated list or wildcard expression of settings to retrieve.

  • :allow_no_indices (Boolean)

    If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. Server default: true.

  • :expand_wildcards (String, Array<String>)

    Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Server default: open.

  • :flat_settings (Boolean)

    If true, returns settings in flat format.

  • :ignore_unavailable (Boolean)

    If false, the request returns an error if it targets a missing or closed index.

  • :include_defaults (Boolean)

    If true, return all default settings in the response.

  • :local (Boolean)

    If true, the request retrieves information from the local node only. If false, information is retrieved from the master node.

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

See Also:



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_settings.rb', line 40

def get_settings(arguments = {})
  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)
  )
end

#migrate_to_data_stream(arguments = {}) ⇒ Object

Migrates an alias to a data stream

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    Name of the index alias to convert to a data stream. (Required)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/elasticsearch-serverless/api/indices/migrate_to_data_stream.rb', line 32

def migrate_to_data_stream(arguments = {})
  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 = {}

  ElasticsearchServerless::API::Response.new(
    perform_request(method, path, params, body, headers)
  )
end

#modify_data_stream(arguments = {}) ⇒ Object

Modifies a data stream

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/elasticsearch-serverless/api/indices/modify_data_stream.rb', line 32

def modify_data_stream(arguments = {})
  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)
  )
end

#put_alias(arguments = {}) ⇒ Object

Creates or updates an alias.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    Comma-separated list of data streams or indices to add. Supports wildcards (+*+). Wildcard patterns that match both data streams and indices return an error. (Required)

  • :name (String)

    Alias to update. If the alias doesn’t exist, the request creates it. Index alias names support date math. (Required)

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :timeout (Time)

    Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



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/put_alias.rb', line 36

def put_alias(arguments = {})
  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)
  )
end

#put_data_lifecycle(arguments = {}) ⇒ Object

Updates the data stream lifecycle of the selected data streams.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String, Array<String>)

    Comma-separated list of data streams used to limit the request. Supports wildcards (+*+). To target all data streams use * or _all. (Required)

  • :expand_wildcards (String, Array<String>)

    Type of data stream that wildcard patterns can match. Supports comma-separated values, such as open,hidden. Valid values are: all, hidden, open, closed, none. Server default: open.

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :timeout (Time)

    Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/elasticsearch-serverless/api/indices/put_data_lifecycle.rb', line 36

def put_data_lifecycle(arguments = {})
  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)
  )
end

#put_index_template(arguments = {}) ⇒ Object

Creates or updates an index template.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    Index or template name (Required)

  • :create (Boolean)

    If true, this request cannot replace or update existing index templates.

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :cause (String)

    User defined reason for creating/updating the index template

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/elasticsearch-serverless/api/indices/put_index_template.rb', line 36

def put_index_template(arguments = {})
  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)
  )
end

#put_mapping(arguments = {}) ⇒ Object

Updates the index mappings.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    A comma-separated list of index names the mapping should be added to (supports wildcards); use _all or omit to add the mapping on all indices. (Required)

  • :allow_no_indices (Boolean)

    If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. Server default: true.

  • :expand_wildcards (String, Array<String>)

    Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. Server default: open.

  • :ignore_unavailable (Boolean)

    If false, the request returns an error if it targets a missing or closed index.

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :timeout (Time)

    Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :write_index_only (Boolean)

    If true, the mappings are applied only to the current write index for the target.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/elasticsearch-serverless/api/indices/put_mapping.rb', line 39

def put_mapping(arguments = {})
  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)
  )
end

#put_settings(arguments = {}) ⇒ Object

Updates the index settings.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (+*+). To target all data streams and indices, omit this parameter or use * or _all.

  • :allow_no_indices (Boolean)

    If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar.

  • :expand_wildcards (String, Array<String>)

    Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Server default: open.

  • :flat_settings (Boolean)

    If true, returns settings in flat format.

  • :ignore_unavailable (Boolean)

    If true, returns settings in flat format.

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :preserve_existing (Boolean)

    If true, existing index settings remain unchanged.

  • :timeout (Time)

    Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    settings

Raises:

  • (ArgumentError)

See Also:



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-serverless/api/indices/put_settings.rb', line 40

def put_settings(arguments = {})
  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)
  )
end

#refresh(arguments = {}) ⇒ Object

Performs the refresh operation in one or more indices.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (+*+). To target all data streams and indices, omit this parameter or use * or _all.

  • :allow_no_indices (Boolean)

    If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. Server default: true.

  • :expand_wildcards (String, Array<String>)

    Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. Server default: open.

  • :ignore_unavailable (Boolean)

    If false, the request returns an error if it targets a missing or closed index.

  • :headers (Hash)

    Custom HTTP headers

See Also:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/elasticsearch-serverless/api/indices/refresh.rb', line 35

def refresh(arguments = {})
  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)
  )
end

#resolve_index(arguments = {}) ⇒ Object

Returns information about any matching indices, aliases, and data streams

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String, Array<String>)

    Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. Resources on remote clusters can be specified using the <cluster>:<name> syntax. (Required)

  • :expand_wildcards (String, Array<String>)

    Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. Server default: open.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/elasticsearch-serverless/api/indices/resolve_index.rb', line 33

def resolve_index(arguments = {})
  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)
  )
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.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :alias (String)

    Name of the data stream or index alias to roll over. (Required)

  • :new_index (String)

    Name of the index to create. Supports date math. Data streams do not support this parameter.

  • :dry_run (Boolean)

    If true, checks whether the current index satisfies the specified conditions but does not perform a rollover.

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :timeout (Time)

    Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :wait_for_active_shards (Integer, String)

    The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (+number_of_replicas+1+). Server default: 1.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



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/rollover.rb', line 39

def rollover(arguments = {})
  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)
  )
end

#simulate_index_template(arguments = {}) ⇒ Object

Simulate matching the given index name against the index templates in the system

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    Name of the index to simulate (Required)

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :include_defaults (Boolean)

    If true, returns all relevant default configurations for the index template.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/elasticsearch-serverless/api/indices/simulate_index_template.rb', line 34

def simulate_index_template(arguments = {})
  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)
  )
end

#simulate_template(arguments = {}) ⇒ Object

Simulate resolving the given template name or body

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    Name of the index template to simulate. To test a template configuration before you add it to the cluster, omit this parameter and specify the template configuration in the request body.

  • :create (Boolean)

    If true, the template passed in the body is only used if no existing templates match the same index patterns. If false, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation.

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :include_defaults (Boolean)

    If true, returns all relevant default configurations for the index template.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    template

See Also:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/elasticsearch-serverless/api/indices/simulate_template.rb', line 36

def simulate_template(arguments = {})
  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)
  )
end

#update_aliases(arguments = {}) ⇒ Object

Updates index aliases.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :timeout (Time)

    Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/elasticsearch-serverless/api/indices/update_aliases.rb', line 34

def update_aliases(arguments = {})
  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)
  )
end

#validate_query(arguments = {}) ⇒ Object

Allows a user to validate a potentially expensive query without executing it.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (+*+). To search all data streams or indices, omit this parameter or use * or _all.

  • :allow_no_indices (Boolean)

    If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. Server default: true.

  • :all_shards (Boolean)

    If true, the validation is executed on all shards instead of one random shard per index.

  • :analyzer (String)

    Analyzer to use for the query string. This parameter can only be used when the q query string parameter is specified.

  • :analyze_wildcard (Boolean)

    If true, wildcard and prefix queries are analyzed.

  • :default_operator (String)

    The default operator for query string query: AND or OR. Server default: OR.

  • :df (String)

    Field to use as default where no field prefix is given in the query string. This parameter can only be used when the q query string parameter is specified.

  • :expand_wildcards (String, Array<String>)

    Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. Server default: open.

  • :explain (Boolean)

    If true, the response returns detailed information if an error has occurred.

  • :ignore_unavailable (Boolean)

    If false, the request returns an error if it targets a missing or closed index.

  • :lenient (Boolean)

    If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.

  • :rewrite (Boolean)

    If true, returns a more detailed explanation showing the actual Lucene query that will be executed.

  • :q (String)

    Query in the Lucene query string syntax.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

See Also:



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/validate_query.rb', line 45

def validate_query(arguments = {})
  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)
  )
end