Module: Elasticsearch::XPack::API::Indices::Actions

Included in:
IndicesClient
Defined in:
lib/elasticsearch/xpack/api/namespace/indices.rb,
lib/elasticsearch/xpack/api/actions/indices/freeze.rb,
lib/elasticsearch/xpack/api/actions/indices/unfreeze.rb,
lib/elasticsearch/xpack/api/actions/indices/get_data_stream.rb,
lib/elasticsearch/xpack/api/actions/indices/params_registry.rb,
lib/elasticsearch/xpack/api/actions/indices/create_data_stream.rb,
lib/elasticsearch/xpack/api/actions/indices/data_streams_stats.rb,
lib/elasticsearch/xpack/api/actions/indices/delete_data_stream.rb,
lib/elasticsearch/xpack/api/actions/indices/modify_data_stream.rb,
lib/elasticsearch/xpack/api/actions/indices/promote_data_stream.rb,
lib/elasticsearch/xpack/api/actions/indices/migrate_to_data_stream.rb,
lib/elasticsearch/xpack/api/actions/indices/reload_search_analyzers.rb

Defined Under Namespace

Modules: ParamsRegistry

Instance Method Summary collapse

Instance Method Details

#create_data_stream(arguments = {}) ⇒ Object

Creates a data stream

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    The name of the data stream

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/elasticsearch/xpack/api/actions/indices/create_data_stream.rb', line 30

def create_data_stream(arguments = {})
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_PUT
  path   = "_data_stream/#{Elasticsearch::API::Utils.__listify(_name)}"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
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 (List)

    A comma-separated list of data stream names; use ‘_all` or empty string to perform the operation on all data streams

  • :headers (Hash)

    Custom HTTP headers

See Also:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/elasticsearch/xpack/api/actions/indices/data_streams_stats.rb', line 30

def data_streams_stats(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_GET
  path   = if _name
             "_data_stream/#{Elasticsearch::API::Utils.__listify(_name)}/_stats"
           else
             "_data_stream/_stats"
           end
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
end

#delete_data_stream(arguments = {}) ⇒ Object

Deletes a data stream.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :name (List)

    A comma-separated list of data streams to delete; use ‘*` to delete all data streams

  • :expand_wildcards (String)

    Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/elasticsearch/xpack/api/actions/indices/delete_data_stream.rb', line 31

def delete_data_stream(arguments = {})
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_DELETE
  path   = "_data_stream/#{Elasticsearch::API::Utils.__listify(_name)}"
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end

#freeze(arguments = {}) ⇒ Object

Freezes an index. A frozen index has almost no overhead on the cluster (except for maintaining its metadata in memory) and is read-only.

*Deprecation notice*: Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization. They will be removed in a future release. Deprecated since version 7.14.0

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The name of the index to freeze

  • :timeout (Time)

    Explicit operation timeout

  • :master_timeout (Time)

    Specify timeout for connection to master

  • :ignore_unavailable (Boolean)

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

  • :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)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :wait_for_active_shards (String)

    Sets the number of active shards to wait for before the operation returns.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/elasticsearch/xpack/api/actions/indices/freeze.rb', line 41

def freeze(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_POST
  path   = "#{Elasticsearch::API::Utils.__listify(_index)}/_freeze"
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end

#get_data_stream(arguments = {}) ⇒ Object

Returns data streams.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :name (List)

    A comma-separated list of data streams to get; use ‘*` to get all data streams

  • :expand_wildcards (String)

    Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all)

  • :headers (Hash)

    Custom HTTP headers

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/elasticsearch/xpack/api/actions/indices/get_data_stream.rb', line 31

def get_data_stream(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_GET
  path   = if _name
             "_data_stream/#{Elasticsearch::API::Utils.__listify(_name)}"
           else
             "_data_stream"
           end
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
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)

    The name of the alias to migrate

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/elasticsearch/xpack/api/actions/indices/migrate_to_data_stream.rb', line 30

def migrate_to_data_stream(arguments = {})
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_POST
  path   = "_data_stream/_migrate/#{Elasticsearch::API::Utils.__listify(_name)}"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
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)

    The data stream modifications (Required)

Raises:

  • (ArgumentError)

See Also:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/elasticsearch/xpack/api/actions/indices/modify_data_stream.rb', line 30

def modify_data_stream(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_POST
  path   = "_data_stream/_modify"
  params = {}

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end

#promote_data_stream(arguments = {}) ⇒ Object

Promotes a data stream from a replicated data stream managed by CCR to a regular data stream

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    The name of the data stream

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/elasticsearch/xpack/api/actions/indices/promote_data_stream.rb', line 30

def promote_data_stream(arguments = {})
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_POST
  path   = "_data_stream/_promote/#{Elasticsearch::API::Utils.__listify(_name)}"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
end

#reload_search_analyzers(arguments = {}) ⇒ Object

Reloads an index’s search analyzers and their resources.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names to reload analyzers for

  • :ignore_unavailable (Boolean)

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

  • :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)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :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
# File 'lib/elasticsearch/xpack/api/actions/indices/reload_search_analyzers.rb', line 33

def reload_search_analyzers(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_GET
  path   = "#{Elasticsearch::API::Utils.__listify(_index)}/_reload_search_analyzers"
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end

#unfreeze(arguments = {}) ⇒ Object

Unfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again.

*Deprecation notice*: Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization. They will be removed in a future release. Deprecated since version 7.14.0

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The name of the index to unfreeze

  • :timeout (Time)

    Explicit operation timeout

  • :master_timeout (Time)

    Specify timeout for connection to master

  • :ignore_unavailable (Boolean)

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

  • :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)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :wait_for_active_shards (String)

    Sets the number of active shards to wait for before the operation returns.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/elasticsearch/xpack/api/actions/indices/unfreeze.rb', line 41

def unfreeze(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_POST
  path   = "#{Elasticsearch::API::Utils.__listify(_index)}/_unfreeze"
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end