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

Included in:
IndicesClient
Defined in:
lib/elasticsearch/api/namespace/indices.rb,
lib/elasticsearch/api/actions/indices/get.rb,
lib/elasticsearch/api/actions/indices/open.rb,
lib/elasticsearch/api/actions/indices/clone.rb,
lib/elasticsearch/api/actions/indices/close.rb,
lib/elasticsearch/api/actions/indices/flush.rb,
lib/elasticsearch/api/actions/indices/split.rb,
lib/elasticsearch/api/actions/indices/stats.rb,
lib/elasticsearch/api/actions/indices/create.rb,
lib/elasticsearch/api/actions/indices/delete.rb,
lib/elasticsearch/api/actions/indices/exists.rb,
lib/elasticsearch/api/actions/indices/freeze.rb,
lib/elasticsearch/api/actions/indices/shrink.rb,
lib/elasticsearch/api/actions/indices/analyze.rb,
lib/elasticsearch/api/actions/indices/refresh.rb,
lib/elasticsearch/api/actions/indices/upgrade.rb,
lib/elasticsearch/api/actions/indices/recovery.rb,
lib/elasticsearch/api/actions/indices/rollover.rb,
lib/elasticsearch/api/actions/indices/segments.rb,
lib/elasticsearch/api/actions/indices/unfreeze.rb,
lib/elasticsearch/api/actions/indices/get_alias.rb,
lib/elasticsearch/api/actions/indices/put_alias.rb,
lib/elasticsearch/api/actions/indices/forcemerge.rb,
lib/elasticsearch/api/actions/indices/clear_cache.rb,
lib/elasticsearch/api/actions/indices/exists_type.rb,
lib/elasticsearch/api/actions/indices/get_mapping.rb,
lib/elasticsearch/api/actions/indices/get_upgrade.rb,
lib/elasticsearch/api/actions/indices/put_mapping.rb,
lib/elasticsearch/api/actions/indices/delete_alias.rb,
lib/elasticsearch/api/actions/indices/exists_alias.rb,
lib/elasticsearch/api/actions/indices/flush_synced.rb,
lib/elasticsearch/api/actions/indices/get_settings.rb,
lib/elasticsearch/api/actions/indices/get_template.rb,
lib/elasticsearch/api/actions/indices/put_settings.rb,
lib/elasticsearch/api/actions/indices/put_template.rb,
lib/elasticsearch/api/actions/indices/shard_stores.rb,
lib/elasticsearch/api/actions/indices/update_aliases.rb,
lib/elasticsearch/api/actions/indices/validate_query.rb,
lib/elasticsearch/api/actions/indices/delete_template.rb,
lib/elasticsearch/api/actions/indices/exists_template.rb,
lib/elasticsearch/api/actions/indices/params_registry.rb,
lib/elasticsearch/api/actions/indices/get_field_mapping.rb

Defined Under Namespace

Modules: ParamsRegistry

Instance Method Summary collapse

Instance Method Details

#analyze(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    Define analyzer/tokenizer parameters and the text on which the analysis should be performed

See Also:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/elasticsearch/api/actions/indices/analyze.rb', line 18

def analyze(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#clear_cache(arguments = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/elasticsearch/api/actions/indices/clear_cache.rb', line 26

def clear_cache(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#clone(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The configuration for the target index (‘settings` and `aliases`)

Raises:

  • (ArgumentError)

See Also:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/elasticsearch/api/actions/indices/clone.rb', line 21

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _target = arguments.delete(:target)

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

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

#close(arguments = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/elasticsearch/api/actions/indices/close.rb', line 24

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#create(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The configuration for the index (‘settings` and `mappings`)

Raises:

  • (ArgumentError)

See Also:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/elasticsearch/api/actions/indices/create.rb', line 21

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#delete(arguments = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/elasticsearch/api/actions/indices/delete.rb', line 22

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

  body = nil
  if Array(arguments[:ignore]).include?(404)
    Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
  else
    perform_request(method, path, params, body).body
  end
end

#delete_alias(arguments = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/elasticsearch/api/actions/indices/delete_alias.rb', line 19

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

  _index = arguments.delete(:index)

  _name = arguments.delete(:name)

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

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

#delete_template(arguments = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/elasticsearch/api/actions/indices/delete_template.rb', line 18

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

  arguments = arguments.clone

  _name = arguments.delete(:name)

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

  body = nil
  if Array(arguments[:ignore]).include?(404)
    Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
  else
    perform_request(method, path, params, body).body
  end
end

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



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/elasticsearch/api/actions/indices/exists.rb', line 24

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

  body = nil

  Utils.__rescue_from_not_found do
    perform_request(method, path, params, body).status == 200 ? true : false
  end
end

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



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/elasticsearch/api/actions/indices/exists_alias.rb', line 23

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

  arguments = arguments.clone

  _name = arguments.delete(:name)

  _index = arguments.delete(:index)

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

  body = nil

  Utils.__rescue_from_not_found do
    perform_request(method, path, params, body).status == 200 ? true : false
  end
end

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



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/elasticsearch/api/actions/indices/exists_template.rb', line 19

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

  arguments = arguments.clone

  _name = arguments.delete(:name)

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

  body = nil

  Utils.__rescue_from_not_found do
    perform_request(method, path, params, body).status == 200 ? true : false
  end
end

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



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/elasticsearch/api/actions/indices/exists_type.rb', line 23

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _type = arguments.delete(:type)

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

  body = nil

  Utils.__rescue_from_not_found do
    perform_request(method, path, params, body).status == 200 ? true : false
  end
end

#flush(arguments = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/elasticsearch/api/actions/indices/flush.rb', line 22

def flush(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#flush_synced(arguments = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/elasticsearch/api/actions/indices/flush_synced.rb', line 20

def flush_synced(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

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

  body = nil
  if Array(arguments[:ignore]).include?(404)
    Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
  else
    perform_request(method, path, params, body).body
  end
end

#forcemerge(arguments = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/elasticsearch/api/actions/indices/forcemerge.rb', line 24

def forcemerge(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#freeze(arguments = {}) ⇒ Object

Note:

This feature is available in the Platinum distribution of Elasticsearch.

In order to keep indices available and queryable for a longer period but at the same time reduce their

hardware requirements they can be transitioned into a frozen state. Once an index is frozen, all of its
transient shard memory (aside from mappings and analyzers) is moved to persistent storage.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma separated list of indices to freeze. (Required)

Raises:

  • (ArgumentError)

See Also:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/elasticsearch/api/actions/indices/freeze.rb', line 15

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

  valid_params = [
    :timeout,
    :master_timeout,
    :ignore_unavailable,
    :allow_no_indices,
    :expand_wildcards,
    :wait_for_active_shards
  ]

  arguments = arguments.clone
  index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_POST
  path = Elasticsearch::API::Utils.__pathify Elasticsearch::API::Utils.__listify(index), '_freeze'
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params

  perform_request(method, path, params).body
end

#get(arguments = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/elasticsearch/api/actions/indices/get.rb', line 26

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#get_alias(arguments = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/elasticsearch/api/actions/indices/get_alias.rb', line 23

def get_alias(arguments = {})
  arguments = arguments.clone

  _name = arguments.delete(:name)

  _index = arguments.delete(:index)

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

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

#get_field_mapping(arguments = {}) ⇒ Object

*Deprecation notice*: Specifying types in urls has been deprecated Deprecated since version 7.0.0



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/elasticsearch/api/actions/indices/get_field_mapping.rb', line 31

def get_field_mapping(arguments = {})
  _fields = arguments.delete(:field) || arguments.delete(:fields)
  raise ArgumentError, "Required argument 'field' missing" unless _fields

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _type = arguments.delete(:type)

  method = Elasticsearch::API::HTTP_GET
  path   = if _index && _type && _fields
             "#{Utils.__listify(_index)}/_mapping/#{Utils.__listify(_type)}/field/#{Utils.__listify(_fields)}"
           elsif _index && _fields
             "#{Utils.__listify(_index)}/_mapping/field/#{Utils.__listify(_fields)}"
           elsif _type && _fields
             "_mapping/#{Utils.__listify(_type)}/field/#{Utils.__listify(_fields)}"
           else
             "_mapping/field/#{Utils.__listify(_fields)}"
      end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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

#get_mapping(arguments = {}) ⇒ Object

*Deprecation notice*: Specifying types in urls has been deprecated Deprecated since version 7.0.0



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

def get_mapping(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

  _type = arguments.delete(:type)

  method = Elasticsearch::API::HTTP_GET
  path   = if _index && _type
             "#{Utils.__listify(_index)}/_mapping/#{Utils.__listify(_type)}"
           elsif _index
             "#{Utils.__listify(_index)}/_mapping"
           elsif _type
             "_mapping/#{Utils.__listify(_type)}"
           else
             "_mapping"
end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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

#get_settings(arguments = {}) ⇒ Object



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

def get_settings(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

  _name = arguments.delete(:name)

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

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

#get_template(arguments = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/elasticsearch/api/actions/indices/get_template.rb', line 20

def get_template(arguments = {})
  arguments = arguments.clone

  _name = arguments.delete(:name)

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

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

#get_upgrade(arguments = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/elasticsearch/api/actions/indices/get_upgrade.rb', line 20

def get_upgrade(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#open(arguments = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/elasticsearch/api/actions/indices/open.rb', line 24

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#put_alias(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The settings for the alias, such as ‘routing` or `filter`

Raises:

  • (ArgumentError)

See Also:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/elasticsearch/api/actions/indices/put_alias.rb', line 20

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

  _index = arguments.delete(:index)

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_PUT
  path   = if _index && _name
             "#{Utils.__listify(_index)}/_aliases/#{Utils.__listify(_name)}"
  end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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

#put_mapping(arguments = {}) ⇒ Object

*Deprecation notice*: Specifying types in urls has been deprecated Deprecated since version 7.0.0

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The mapping definition (Required)

Raises:

  • (ArgumentError)

See Also:



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

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _type = arguments.delete(:type)

  method = Elasticsearch::API::HTTP_PUT
  path   = if _index && _type
             "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_mappings"
           elsif _index
             "#{Utils.__listify(_index)}/_mapping"
           elsif _type
             "_mappings/#{Utils.__listify(_type)}"
  end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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

#put_settings(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The index settings to be updated (Required)

Raises:

  • (ArgumentError)

See Also:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/elasticsearch/api/actions/indices/put_settings.rb', line 26

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#put_template(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The template definition (Required)

Raises:

  • (ArgumentError)

See Also:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/elasticsearch/api/actions/indices/put_template.rb', line 21

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

  arguments = arguments.clone

  _name = arguments.delete(:name)

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

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

#recovery(arguments = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/elasticsearch/api/actions/indices/recovery.rb', line 18

def recovery(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#refresh(arguments = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/elasticsearch/api/actions/indices/refresh.rb', line 20

def refresh(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#rollover(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The conditions that needs to be met for executing rollover

Raises:

  • (ArgumentError)

See Also:



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/elasticsearch/api/actions/indices/rollover.rb', line 24

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

  arguments = arguments.clone

  _alias = arguments.delete(:alias)

  _new_index = arguments.delete(:new_index)

  method = Elasticsearch::API::HTTP_POST
  path   = if _alias && _new_index
             "#{Utils.__listify(_alias)}/_rollover/#{Utils.__listify(_new_index)}"
           else
             "#{Utils.__listify(_alias)}/_rollover"
  end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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

#segments(arguments = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/elasticsearch/api/actions/indices/segments.rb', line 22

def segments(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#shard_stores(arguments = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/elasticsearch/api/actions/indices/shard_stores.rb', line 23

def shard_stores(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#shrink(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The configuration for the target index (‘settings` and `aliases`)

Raises:

  • (ArgumentError)

See Also:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/elasticsearch/api/actions/indices/shrink.rb', line 22

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _target = arguments.delete(:target)

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

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

#split(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The configuration for the target index (‘settings` and `aliases`)

Raises:

  • (ArgumentError)

See Also:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/elasticsearch/api/actions/indices/split.rb', line 22

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _target = arguments.delete(:target)

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

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

#stats(arguments = {}) ⇒ Object



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

def stats(arguments = {})
  method = HTTP_GET
  parts  = Utils.__extract_parts arguments, ParamsRegistry.get(:stats_parts)
  path   = Utils.__pathify Utils.__listify(arguments[:index]), '_stats', Utils.__listify(parts)
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(:stats_params)
  params[:fields] = Utils.__listify(params[:fields], :escape => false) if params[:fields]
  params[:groups] = Utils.__listify(params[:groups], :escape => false) if params[:groups]

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

#unfreeze(arguments = {}) ⇒ Object

Note:

This feature is available in the Platinum distribution of Elasticsearch.

In order to keep indices available and queryable for a longer period but at the same time reduce their

hardware requirements they can be transitioned into a frozen state. Once an index is frozen, all of its
transient shard memory (aside from mappings and analyzers) is moved to persistent storage.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma separated list of indices to unfreeze. (Required)

Raises:

  • (ArgumentError)

See Also:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/elasticsearch/api/actions/indices/unfreeze.rb', line 15

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

  valid_params = [
    :timeout,
    :master_timeout,
    :ignore_unavailable,
    :allow_no_indices,
    :expand_wildcards,
    :wait_for_active_shards
  ]

  arguments = arguments.clone
  index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_POST
  path = Elasticsearch::API::Utils.__pathify Elasticsearch::API::Utils.__listify(index), '_unfreeze'
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params

  perform_request(method, path, params).body
end

#update_aliases(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The definition of ‘actions` to perform (Required)

Raises:

  • (ArgumentError)

See Also:



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/elasticsearch/api/actions/indices/update_aliases.rb', line 18

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

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_POST
  path   = "_aliases"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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

#upgrade(arguments = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/elasticsearch/api/actions/indices/upgrade.rb', line 23

def upgrade(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

#validate_query(arguments = {}) ⇒ Object

*Deprecation notice*: Specifying types in urls has been deprecated Deprecated since version 7.0.0

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The query definition specified with the Query DSL

See Also:



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

def validate_query(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

  _type = arguments.delete(:type)

  method = Elasticsearch::API::HTTP_GET
  path   = if _index && _type
             "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_validate/query"
           elsif _index
             "#{Utils.__listify(_index)}/_validate/query"
           else
             "_validate/query"
end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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