Return the result of the analysis process (tokens)
Allows to “test-drive” the Elasticsearch analysis process by performing the analysis on the same text with different analyzers. An ad-hoc analysis chain can be built from specific tokenizer and filters.
@example Analyze text “Quick Brown Jumping Fox” with the snowball analyzer
client.indices.analyze text: 'The Quick Brown Jumping Fox', analyzer: 'snowball'
@example Analyze text “Quick Brown Jumping Fox” with a custom tokenizer and filter chain
client.indices.analyze text: 'The Quick Brown Jumping Fox', tokenizer: 'whitespace', filters: ['lowercase','stop']
@option arguments [String] :index The name of the index to scope the operation @option arguments [Hash] :body The text on which the analysis should be performed @option arguments [String] :analyzer The name of the analyzer to use @option arguments [String] :field Use the analyzer configured for this field
(instead of passing the analyzer name)
@option arguments [List] :filters A comma-separated list of filters to use for the analysis @option arguments [String] :index The name of the index to scope the operation @option arguments [Boolean] :prefer_local With `true`, specify that a local shard should be used if available,
with `false`, use a random shard (default: true)
@option arguments [String] :text The text on which the analysis should be performed
(when request body is not used)
@option arguments [String] :tokenizer The name of the tokenizer to use for the analysis @option arguments [String] :format Format of the output (options: detailed, text)
@see www.elasticsearch.org/guide/reference/api/admin-indices-analyze/
# File lib/elasticsearch/api/actions/indices/analyze.rb, line 38 def analyze(arguments={}) valid_params = [ :analyzer, :field, :filters, :index, :prefer_local, :text, :tokenizer, :format ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_analyze' params = Utils.__validate_and_extract_params arguments, valid_params params[:filters] = Utils.__listify(params[:filters]) if params[:filters] body = arguments[:body] perform_request(method, path, params, body).body end
Clear caches and other auxiliary data structures.
Can be performed against a specific index, or against all indices.
By default, all caches and data structures will be cleared. Pass a specific cache or structure name to clear just a single one.
@example Clear all caches and data structures
client.indices.clear_cache
@example Clear the field data structure only
client.indices.clear_cache field_data: true
@example Clear only specific field in the field data structure
client.indices.clear_cache field_data: true, fields: 'created_at', filter_cache: false, id_cache: false
@option arguments [List] :index A comma-separated list of index name to limit the operation @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [Boolean] :field_data Clear field data @option arguments [Boolean] :fielddata Clear field data @option arguments [List] :fields A comma-separated list of fields to clear when using the
`field_data` parameter(default: all)
@option arguments [Boolean] :filter Clear filter caches @option arguments [Boolean] :filter_cache Clear filter caches @option arguments [Boolean] :filter_keys A comma-separated list of keys to clear when using the
`filter_cache` parameter (default: all)
@option arguments [Boolean] :id Clear ID caches for parent/child @option arguments [Boolean] :id_cache Clear ID caches for parent/child @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [List] :index A comma-separated list of index name to limit the operation @option arguments [Boolean] :recycler Clear the recycler cache
@see www.elasticsearch.org/guide/reference/api/admin-indices-clearcache/
# File lib/elasticsearch/api/actions/indices/clear_cache.rb, line 50 def clear_cache(arguments={}) valid_params = [ :field_data, :fielddata, :fields, :filter, :filter_cache, :filter_keys, :id, :id_cache, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :recycler ] method = 'POST' path = Utils.__pathify Utils.__listify(arguments[:index]), '_cache/clear' params = Utils.__validate_and_extract_params arguments, valid_params body = nil params[:fields] = Utils.__listify(params[:fields]) if params[:fields] perform_request(method, path, params, body).body end
Close an index (keep the data on disk, but deny operations with the index).
A closed index can be opened again with the {Indices::Actions#close} API.
@example Close index named myindex
client.indices.close index: 'myindex'
@option arguments [String] :index The name of the index (Required) @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Time] :timeout Explicit operation timeout
@see www.elasticsearch.org/guide/reference/api/admin-indices-open-close/
# File lib/elasticsearch/api/actions/indices/close.rb, line 28 def close(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :timeout ] method = 'POST' path = Utils.__pathify Utils.__listify(arguments[:index]), '_close' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Create an index.
Pass the index `settings` and `mappings` in the `:body` attribute.
@example Create an index with specific settings, custom analyzers and mappings
client.indices.create index: 'test', body: { settings: { index: { number_of_shards: 1, number_of_replicas: 0, 'routing.allocation.include.name' => 'node-1' }, analysis: { filter: { ngram: { type: 'nGram', min_gram: 3, max_gram: 25 } }, analyzer: { ngram: { tokenizer: 'whitespace', filter: ['lowercase', 'stop', 'ngram'], type: 'custom' }, ngram_search: { tokenizer: 'whitespace', filter: ['lowercase', 'stop'], type: 'custom' } } } }, mappings: { document: { properties: { title: { type: 'multi_field', fields: { title: { type: 'string', analyzer: 'snowball' }, exact: { type: 'string', analyzer: 'keyword' }, ngram: { type: 'string', index_analyzer: 'ngram', search_analyzer: 'ngram_search' } } } } } } }
@option arguments [String] :index The name of the index (Required) @option arguments [Hash] :body Optional configuration for the index (`settings` and `mappings`) @option arguments [Time] :timeout Explicit operation timeout
@see www.elasticsearch.org/guide/reference/api/admin-indices-create-index/
# File lib/elasticsearch/api/actions/indices/create.rb, line 67 def create(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] valid_params = [ :timeout ] method = 'PUT' path = Utils.__pathify Utils.__escape(arguments[:index]) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end
Delete an index, list of indices, or all indices in the cluster.
@example Delete an index
client.indices.delete index: 'foo'
@example Delete a list of indices
client.indices.delete index: ['foo', 'bar'] client.indices.delete index: 'foo,bar'
@example Delete a list of indices matching wildcard expression
client.indices.delete index: 'foo*'
@example Delete all indices
client.indices.delete index: '_all'
@option arguments [List] :index A comma-separated list of indices to delete;
use `_all` to delete all indices
@option arguments [Time] :timeout Explicit operation timeout
@see www.elasticsearch.org/guide/reference/api/admin-indices-delete-index/
# File lib/elasticsearch/api/actions/indices/delete.rb, line 32 def delete(arguments={}) valid_params = [ :timeout ] method = 'DELETE' path = Utils.__pathify Utils.__listify(arguments[:index]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Delete a single index alias.
@example Delete an alias
client.indices.delete_alias index: 'foo', name: 'bar'
See the {Indices::Actions#update_aliases} for performing operations with index aliases in bulk.
@option arguments [String] :index The name of the index with an alias (Required) @option arguments [String] :name The name of the alias to be deleted (Required) @option arguments [Time] :timeout Explicit timestamp for the document
@see www.elasticsearch.org/guide/reference/api/admin-indices-aliases/
# File lib/elasticsearch/api/actions/indices/delete_alias.rb, line 20 def delete_alias(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] valid_params = [ :timeout ] method = 'DELETE' path = Utils.__pathify Utils.__escape(arguments[:index]), '_alias', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Delete all documents and mapping for a specific document type.
@option arguments [List] :index A comma-separated list of index names; use `_all` for all indices (Required) @option arguments [String] :type The name of the document type to delete (Required)
@see www.elasticsearch.org/guide/reference/api/admin-indices-delete-mapping/
# File lib/elasticsearch/api/actions/indices/delete_mapping.rb, line 13 def delete_mapping(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'type' missing" unless arguments[:type] method = 'DELETE' path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__escape(arguments[:type]) params = {} body = nil perform_request(method, path, params, body).body end
Delete an index template.
@example Delete a template named mytemplate
client.indices.delete_template name: 'mytemplate'
@example Delete all templates
client.indices.delete_template name: '*'
@option arguments [String] :name The name of the template (Required) @option arguments [Time] :timeout Explicit operation timeout
@see www.elasticsearch.org/guide/reference/api/admin-indices-templates/
# File lib/elasticsearch/api/actions/indices/delete_template.rb, line 21 def delete_template(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] valid_params = [ :timeout ] method = 'DELETE' path = Utils.__pathify '_template', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body rescue Exception => e # NOTE: Use exception name, not full class in Elasticsearch::Client to allow client plugability if Array(arguments[:ignore]).include?(404) && e.class.to_s =~ /NotFound/; false else raise(e) end end
Delete one or more warmers for a list of indices.
@example Delete a warmer named mywarmer for index named myindex
client.indices.delete_warmer index: 'myindex', name: 'mywarmer'
@option arguments [List] :index A comma-separated list of index names to register warmer for; use `_all`
or empty string to perform the operation on all indices (*Required*)
@option arguments [String] :name The name of the warmer (supports wildcards); leave empty to delete all warmers @option arguments [List] :type A comma-separated list of document types to register warmer for; use `_all`
or empty string to perform the operation on all types
@see www.elasticsearch.org/guide/reference/api/admin-indices-warmers/
# File lib/elasticsearch/api/actions/indices/delete_warmer.rb, line 20 def delete_warmer(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] method = 'DELETE' path = Utils.__pathify Utils.__listify(arguments[:index]), '_warmer', Utils.__listify(arguments[:name]) params = {} body = nil perform_request(method, path, params, body).body end
Return true if the index (or all indices in a list) exists, false otherwise.
@example Check whether index named myindex exists
client.indices.exists index: 'myindex'
@option arguments [List] :index A comma-separated list of indices to check (Required) @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Boolean] :local Return local information, do not retrieve the state from master node
(default: false)
@return [true,false]
@see www.elasticsearch.org/guide/reference/api/admin-indices-indices-exists/
# File lib/elasticsearch/api/actions/indices/exists.rb, line 29 def exists(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :local ] method = 'HEAD' path = Utils.__listify(arguments[:index]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).status == 200 ? true : false rescue Exception => e if e.class.to_s =~ /NotFound/ || e.message =~ /Not\s*Found|404/ false else raise e end end
Return true if the specified alias exists, false otherwise.
@example Check whether index alias named myalias exists
client.indices.exists_alias name: 'myalias'
@option arguments [List] :index A comma-separated list of index names to filter aliases @option arguments [List] :name A comma-separated list of alias names to return @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Boolean] :local Return local information, do not retrieve the state from master node
(default: false)
@see www.elasticsearch.org/guide/reference/api/admin-indices-aliases/
# File lib/elasticsearch/api/actions/indices/exists_alias.rb, line 28 def exists_alias(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :local ] method = 'HEAD' path = Utils.__pathify Utils.__listify(arguments[:index]), '_alias', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).status == 200 ? true : false rescue Exception => e if e.class.to_s =~ /NotFound/ || e.message =~ /Not\s*Found|404/ false else raise e end end
TODO: Description
@option arguments [String] :name The name of the template (Required) @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
@see www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-templates.html
# File lib/elasticsearch/api/actions/indices/exists_template.rb, line 13 def exists_template(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] valid_params = [ :local ] method = 'HEAD' path = Utils.__pathify '_template', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).status == 200 ? true : false rescue Exception => e if e.class.to_s =~ /NotFound/ || e.message =~ /Not\s*Found|404/ false else raise e end end
Return true if the specified type exists, false otherwise.
@option arguments [List] :index A comma-separated list of index names; use `_all`
to check the types across all indices (*Required*)
@option arguments [List] :type A comma-separated list of document types to check (Required) @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Boolean] :local Return local information, do not retrieve the state from master node
(default: false)
@see www.elasticsearch.org/guide/reference/api/admin-indices-types-exists/
# File lib/elasticsearch/api/actions/indices/exists_type.rb, line 25 def exists_type(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'type' missing" unless arguments[:type] valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :local ] method = 'HEAD' path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__escape(arguments[:type]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).status == 200 ? true : false rescue Exception => e if e.class.to_s =~ /NotFound/ || e.message =~ /Not\s*Found|404/ false else raise e end end
“Flush” the index or indices.
The “flush” operation clears the transaction log and memory and writes data to disk. It corresponds to a Lucene “commit” operation.
@note The flush operation is handled automatically by Elasticsearch, you don’t need to perform it manually.
@option arguments [List] :index A comma-separated list of index names; use `_all` or empty string for all indices @option arguments [Boolean] :force Whether a flush should be forced even if it is not necessarily needed ie.
if no changes will be committed to the index. (Internal)
@option arguments [Boolean] :full If set to true a new index writer is created and settings that have been
changed related to the index writer will be refreshed. (Internal)
@option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Boolean] :refresh Refresh the index after performing the operation
@see www.elasticsearch.org/guide/reference/api/admin-indices-flush/
# File lib/elasticsearch/api/actions/indices/flush.rb, line 31 def flush(arguments={}) valid_params = [ :force, :full, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :refresh ] method = 'POST' path = Utils.__pathify Utils.__listify(arguments[:index]), '_flush' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Get information about a specific alias.
@example Return all indices an alias points to
client.indices.get_alias name: '2013'
@example Return all indices matching a wildcard pattern an alias points to
client.indices.get_alias index: 'log*', name: '2013'
@option arguments [List] :index A comma-separated list of index names to filter aliases @option arguments [List] :name A comma-separated list of alias names to return @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Boolean] :local Return local information, do not retrieve the state from master node
(default: false)
@see www.elasticsearch.org/guide/reference/api/admin-indices-aliases/
# File lib/elasticsearch/api/actions/indices/get_alias.rb, line 32 def get_alias(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :local ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_alias', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Get a list of all aliases, or aliases for a specific index.
@example Get a list of all aliases
client.indices.get_aliases
@option arguments [List] :index A comma-separated list of index names to filter aliases @option arguments [List] :name A comma-separated list of alias names to filter @option arguments [Time] :timeout Explicit timestamp for the document @option arguments [Boolean] :local Return local information,
do not retrieve the state from master node (default: false)
@see www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-aliases.html
# File lib/elasticsearch/api/actions/indices/get_aliases.rb, line 20 def get_aliases(arguments={}) valid_params = [ :timeout, :local ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_aliases', Utils.__listify(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Return the mapping definition for specific field (or fields)
@example Get mapping for a specific field across all indices
client.indices.get_field_mapping field: 'foo'
@example Get mapping for a specific field in an index
client.indices.get_field_mapping index: 'foo', field: 'bar'
@example Get mappings for multiple fields in an index
client.indices.get_field_mapping index: 'foo', field: ['bar', 'bam']
@option arguments [List] :index A comma-separated list of index names @option arguments [List] :type A comma-separated list of document types @option arguments [List] :field A comma-separated list of fields (Required) @option arguments [Boolean] :include_defaults Whether default mapping values should be returned as well @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@see www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html
# File lib/elasticsearch/api/actions/indices/get_field_mapping.rb, line 36 def get_field_mapping(arguments={}) raise ArgumentError, "Required argument 'field' missing" unless arguments[:field] valid_params = [ :include_defaults, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'GET' path = Utils.__pathify( Utils.__listify(arguments[:index]), '_mapping', Utils.__listify(arguments[:type]), 'field', Utils.__listify(arguments[:field]) ) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Return the mapping definitions for all indices, or specific indices/types.
@example Get all mappings in the cluster
client.indices.get_mapping
@example Get mapping for a specific index
client.indices.get_mapping index: 'foo'
@example Get mapping for a specific type in a specific index
client.indices.get_mapping index: 'foo', type: 'baz'
@option arguments [List] :index A comma-separated list of index names; use `_all` or empty string for all indices @option arguments [List] :type A comma-separated list of document types @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Boolean] :local Return local information, do not retrieve the state from master node
(default: false)
@see www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get-mapping.html
# File lib/elasticsearch/api/actions/indices/get_mapping.rb, line 36 def get_mapping(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :local ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_mapping', Utils.__listify(arguments[:type]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Return the settings for all indices, or a list of indices.
@example Get settings for all indices
client.indices.get_settings
@example Get settings for the ‘foo’ index
client.indices.get_settings index: 'foo'
@example Get settings for indices beginning with foo
client.indices.get_settings prefix: 'foo'
@example Get settings for an index named myindex
client.indices.get_settings index: 'myindex'
@option arguments [List] :index A comma-separated list of index names; use `_all` or empty string
to perform the operation on all indices
@option arguments [List] :name The name of the settings that should be included in the response @option arguments [String] :prefix The prefix all settings must have in order to be included @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Boolean] :flat_settings Return settings in flat format (default: false) @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
(default: false)
@see www.elasticsearch.org/guide/reference/api/admin-indices-get-settings/
# File lib/elasticsearch/api/actions/indices/get_settings.rb, line 43 def get_settings(arguments={}) valid_params = [ :prefix, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :flat_settings, :local ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), arguments.delete(:prefix), '_settings', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Get a single index template.
@example Get all templates
client.indices.get_template
@example Get a template named mytemplate
client.indices.get_template name: 'mytemplate'
@note Use the {Cluster::Actions#state} API to get a list of all templates.
@option arguments [String] :name The name of the template (supports wildcards) @option arguments [Boolean] :flat_settings Return settings in flat format (default: false) @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
(default: false)
@see www.elasticsearch.org/guide/reference/api/admin-indices-templates/
# File lib/elasticsearch/api/actions/indices/get_template.rb, line 25 def get_template(arguments={}) valid_params = [ :flat_settings, :local ] method = 'GET' path = Utils.__pathify '_template', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end
Get one or more warmers for an index.
@example Get all warmers
client.indices.get_warmer index: '_all'
@example Get all warmers matching a wildcard expression
client.indices.get_warmer index: '_all', name: 'ba*'
@example Get all warmers for a single index
client.indices.get_warmer index: 'foo'
@example Get a specific warmer
client.indices.get_warmer index: 'foo', name: 'bar'
@option arguments [List] :index A comma-separated list of index names to restrict the operation;
use `_all` to perform the operation on all indices (*Required*)
@option arguments [String] :name The name of the warmer (supports wildcards); leave empty to get all warmers @option arguments [List] :type A comma-separated list of document types to restrict the operation;
leave empty to perform the operation on all types
@option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@see www.elasticsearch.org/guide/reference/api/admin-indices-warmers/
# File lib/elasticsearch/api/actions/indices/get_warmer.rb, line 41 def get_warmer(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'GET' path = Utils.__pathify( Utils.__listify(arguments[:index]), '_warmer', Utils.__escape(arguments[:name]) ) params = {} body = nil perform_request(method, path, params, body).body end
Open a previously closed index (see the {Indices::Actions#close} API).
@example Open index named myindex
client.indices.open index: 'myindex'
@option arguments [String] :index The name of the index (Required) @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Time] :timeout Explicit operation timeout
@see www.elasticsearch.org/guide/reference/api/admin-indices-open-close/
# File lib/elasticsearch/api/actions/indices/open.rb, line 26 def open(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :timeout ] method = 'POST' path = Utils.__pathify Utils.__escape(arguments[:index]), '_open' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Perform an index optimization.
The “optimize” operation merges the index segments, increasing search performance. It corresponds to a Lucene “merge” operation.
@example Fully optimize an index (merge to one segment)
client.indices.optimize index: 'foo', max_num_segments: 1, wait_for_merge: false
@note The optimize operation is handled automatically by Elasticsearch, you don’t need to perform it manually.
The operation is expensive in terms of resources (I/O, CPU, memory) and can take a long time to finish, potentially reducing operability of your cluster; schedule the manual optimization accordingly.
@option arguments [List] :index A comma-separated list of index names; use `_all`
or empty string to perform the operation on all indices
@option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [Boolean] :flush Specify whether the index should be flushed after performing the operation
(default: true)
@option arguments [Boolean] :force Force a merge operation to run, even when the index has a single segment
(default: true)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Number] :max_num_segments The number of segments the index should be merged into
(default: dynamic)
@option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [Boolean] :only_expunge_deletes Specify whether the operation should only expunge
deleted documents
@option arguments [Boolean] :refresh Specify whether the index should be refreshed after performing the operation
(default: true)
@option arguments [Boolean] :wait_for_merge Specify whether the request should block until the merge process
is finished (default: true)
@see www.elasticsearch.org/guide/reference/api/admin-indices-optimize/
# File lib/elasticsearch/api/actions/indices/optimize.rb, line 46 def optimize(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :flush, :force, :master_timeout, :max_num_segments, :only_expunge_deletes, :operation_threading, :refresh, :wait_for_merge ] method = 'POST' path = Utils.__pathify Utils.__listify(arguments[:index]), '_optimize' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Create or update a single index alias.
@example Create an alias for current month
client.indices.put_alias index: 'logs-2013-06', name: 'current-month'
@example Create an alias for multiple indices
client.indices.put_alias index: 'logs-2013-06', name: 'year-2013' client.indices.put_alias index: 'logs-2013-05', name: 'year-2013'
See the {Indices::Actions#update_aliases} for performing operations with index aliases in bulk.
@option arguments [String] :index The name of the index with an alias @option arguments [String] :name The name of the alias to be created or updated @option arguments [Hash] :body The settings for the alias, such as `routing` or `filter` @option arguments [Time] :timeout Explicit timestamp for the document
@see www.elasticsearch.org/guide/reference/api/admin-indices-aliases/
# File lib/elasticsearch/api/actions/indices/put_alias.rb, line 26 def put_alias(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] valid_params = [ :timeout ] method = 'PUT' path = Utils.__pathify Utils.__escape(arguments[:index]), '_alias', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end
Create or update mapping.
Pass the mapping definition(s) in the `:body` argument.
@example Create or update a mapping for a specific document type
client.indices.put_mapping index: 'myindex', type: 'mytype', body: { mytype: { properties: { title: { type: 'string', analyzer: 'snowball' } } } }
@example Update the mapping for a specific type in all indices
client.indices.put_mapping type: 'mytype', body: { mytype: { dynamic: 'strict' } }
@option arguments [Hash] :body The mapping definition (Required) @option arguments [List] :index A comma-separated list of index names; use `_all` or omit to
update the mapping for all indices
@option arguments [String] :type The name of the document type (Required) @option arguments [Boolean] :ignore_conflicts Specify whether to ignore conflicts while updating the mapping
(default: false)
@option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [Time] :timeout Explicit operation timeout
@see www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping/
# File lib/elasticsearch/api/actions/indices/put_mapping.rb, line 48 def put_mapping(arguments={}) raise ArgumentError, "Required argument 'type' missing" unless arguments[:type] raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :ignore_conflicts, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :master_timeout, :timeout ] method = 'PUT' path = Utils.__pathify Utils.__listify(arguments[:index]), '_mapping', Utils.__escape(arguments[:type]) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end
Update the settings for one or multiple indices.
@example Change the number of replicas for all indices
client.indices.put_settings body: { index: { number_of_replicas: 0 } }
@example Change the number of replicas for a specific index
client.indices.put_settings index: 'myindex', body: { index: { number_of_replicas: 0 } }
@example Disable “flush” for all indices
client.indices.put_settings body: { 'index.translog.disable_flush' => true }
@example Allocate specific index on specific nodes
client.indices.put_settings index: 'my-big-index', body: { 'index.routing.allocation.require.tag' => 'bigbox' }
@option arguments [Hash] :body The index settings to be updated (Required) @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string
to perform the operation on all indices
@option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [Boolean] :flat_settings Return settings in flat format (default: false)
@see www.elasticsearch.org/guide/reference/api/admin-indices-update-settings/
# File lib/elasticsearch/api/actions/indices/put_settings.rb, line 44 def put_settings(arguments={}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :master_timeout, :flat_settings ] method = 'PUT' path = Utils.__pathify Utils.__listify(arguments[:index]), '_settings' params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end
Create or update an index template.
@example Create a template for all indices starting with `logs-`
client.indices.put_template name: 'foo', body: { template: 'logs-*', settings: { 'index.number_of_shards' => 1 } }
@option arguments [String] :name The name of the template (Required) @option arguments [Hash] :body The template definition (Required) @option arguments [Boolean] :create Whether the index template should only be added for a new one, # or can also replace an existing one (default: false) @option arguments [Number] :order The order for this template when merging multiple matching ones
(higher numbers are merged later, overriding the lower numbers)
@option arguments [Time] :timeout Explicit operation timeout @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [Boolean] :flat_settings Return settings in flat format (default: false)
@see www.elasticsearch.org/guide/reference/api/admin-indices-templates/
# File lib/elasticsearch/api/actions/indices/put_template.rb, line 24 def put_template(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :create, :order, :timeout ] method = 'PUT' path = Utils.__pathify '_template', Utils.__escape(arguments[:name]) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end
Create or update an index warmer.
An index warmer will run before an index is refreshed, ie. available for search. It allows you to register “heavy” queries with popular filters, facets or sorts, increasing performance when the index is searched for the first time.
@example Register a warmer which will populate the caches for `published` filter and sorting on `created_at`
client.indices.put_warmer index: 'myindex', name: 'main', body: { query: { filtered: { filter: { term: { published: true } } } }, sort: [ "created_at" ] }
@option arguments [List] :index A comma-separated list of index names to register the warmer for; use `_all`
or empty string to perform the operation on all indices (*Required*)
@option arguments [String] :name The name of the warmer (Required) @option arguments [List] :type A comma-separated list of document types to register the warmer for;
leave empty to perform the operation on all types
@option arguments [Hash] :body The search request definition for the warmer
(query, filters, facets, sorting, etc) (*Required*)
@option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@see www.elasticsearch.org/guide/reference/api/admin-indices-warmers/
# File lib/elasticsearch/api/actions/indices/put_warmer.rb, line 40 def put_warmer(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'PUT' path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_warmer', Utils.__listify(arguments[:name]) ) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end
Return information about shard recovery for one or more indices
@example Get recovery information for a single index
client.indices.recovery index: 'foo'
@example Get detailed recovery information for multiple indices
client.indices.recovery index: ['foo', 'bar'], detailed: true
@example Get recovery information for all indices
client.indices.recovery
@option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices @option arguments [Boolean] :detailed Whether to display detailed information about shard recovery @option arguments [Boolean] :active_only Display only those recoveries that are currently on-going @option arguments [Boolean] :human Whether to return time and byte values in human readable format
@see www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-recovery.html
# File lib/elasticsearch/api/actions/indices/recovery.rb, line 27 def recovery(arguments={}) valid_params = [ :detailed, :active_only, :human ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_recovery' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Refresh the index and to make the changes (creates, updates, deletes) searchable.
By default, Elasticsearch has a delay of 1 second until changes to an index are available for search; the delay is configurable, see {Indices::Actions#put_settings}.
You can trigger this operation explicitely, for example when performing a sequence of commands in integration tests, or when you need to perform a manual “synchronization” of the index with an external system at given moment.
@example Refresh an index named myindex
client.indices.refresh index: 'myindex'
@note The refresh operation can adversely affect indexing throughput when used too frequently.
@option arguments [List] :index A comma-separated list of index names; use `_all` or empty string
to perform the operation on all indices
@option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@see www.elasticsearch.org/guide/reference/api/admin-indices-refresh/
# File lib/elasticsearch/api/actions/indices/refresh.rb, line 35 def refresh(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'POST' path = Utils.__pathify Utils.__listify(arguments[:index]), '_refresh' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Return information about segments for one or more indices.
The response contains information about segment size, number of documents, deleted documents, etc. See also {Indices::Actions#optimize}.
@option arguments [List] :index A comma-separated list of index names; use `_all` or empty string
to perform the operation on all indices
@option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@see elasticsearch.org/guide/reference/api/admin-indices-segments/
# File lib/elasticsearch/api/actions/indices/segments.rb, line 25 def segments(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_segments' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
When using the shared storage gateway, manually trigger the snapshot operation.
@deprecated The shared gateway has been deprecated [github.com/elasticsearch/elasticsearch/issues/2458]
@option arguments [List] :index A comma-separated list of index names; use `_all` or empty string
to perform the operation on all indices
@option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@see www.elasticsearch.org/guide/reference/api/admin-indices-gateway-snapshot/
# File lib/elasticsearch/api/actions/indices/snapshot_index.rb, line 24 def snapshot_index(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'POST' path = Utils.__pathify Utils.__listify(arguments[:index]), '_gateway/snapshot' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Return statistical information about one or more indices.
The response contains comprehensive statistical information about metrics related to index: how much time did indexing, search and other operations take, how much disk space it takes, how much memory filter caches or field data require, etc.
@example Get all available statistics for all indices
client.indices.stats
@example Get statistics for a single index
client.indices.stats index: 'foo'
@example Get statistics about documents and disk size for multiple indices
client.indices.stats index: ['foo', 'bar'], docs: true, store: true
@example Get statistics about filter cache and field data for all fields
client.indices.stats fielddata: true, filter_cache: true
@example Get statistics about filter cache and field data for specific fields
client.indices.stats fielddata: true, filter_cache: true, fields: 'created_at,tags'
@example Get statistics about filter cache and field data per field for all fields
client.indices.stats fielddata: true, filter_cache: true, fields: '*'
@example Get statistics about searches, with segmentation for different search groups
client.indices.stats search: true, groups: ['groupA', 'groupB']
@option arguments [Boolean] :docs Return information about indexed and deleted documents @option arguments [Boolean] :fielddata Return information about field data @option arguments [Boolean] :fields A comma-separated list of fields for `fielddata` metric (supports wildcards) @option arguments [Boolean] :filter_cache Return information about filter cache @option arguments [Boolean] :flush Return information about flush operations @option arguments [Boolean] :get Return information about get operations @option arguments [Boolean] :groups A comma-separated list of search groups for `search` statistics @option arguments [Boolean] :id_cache Return information about ID cache @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string
to perform the operation on all indices
@option arguments [Boolean] :indexing Return information about indexing operations @option arguments [String] :level Return stats aggregated at cluster, index or shard level
(Options: cluster, indices, shards)
@option arguments [List] :types A comma-separated list of document types to include in the `indexing` info @option arguments [Boolean] :merge Return information about merge operations @option arguments [List] :metric Limit the information returned the specific metrics
(_all, completion, docs, fielddata, filter_cache, flush, get, id_cache, indexing, merge, percolate, refresh, search, segments, store, warmer, suggest)
@option arguments [Boolean] :refresh Return information about refresh operations @option arguments [Boolean] :search Return information about search operations; use the `groups` parameter to
include information for specific search groups
@option arguments [List] :groups A comma-separated list of search groups to include in the `search` statistics @option arguments [Boolean] :suggest Return information about suggest statistics @option arguments [Boolean] :store Return information about the size of the index @option arguments [Boolean] :warmer Return information about warmers @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@see www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-stats.html
# File lib/elasticsearch/api/actions/indices/stats.rb, line 76 def stats(arguments={}) valid_parts = [ :docs, :fielddata, :filter_cache, :flush, :get, :indexing, :merge, :metric, :refresh, :search, :suggest, :store, :warmer ] valid_params = [ :fields, :completion_fields, :fielddata_fields, :groups, :level, :types, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards ] method = 'GET' parts = Utils.__extract_parts arguments, valid_parts path = Utils.__pathify Utils.__listify(arguments[:index]), '_stats', Utils.__listify(parts) params = Utils.__validate_and_extract_params arguments, valid_params params[:fields] = Utils.__listify(params[:fields]) if params[:fields] params[:groups] = Utils.__listify(params[:groups]) if params[:groups] body = nil perform_request(method, path, params, body).body end
Return information about one or more indices
@example Get information about all indices
client.indices.status
@example Get information about a specific index
client.indices.status index: 'foo'
@example Get information about shard recovery for a specific index
client.indices.status index: 'foo', recovery: true
@option arguments [List] :index A comma-separated list of index names; use `_all` or empty string
to perform the operation on all indices
@option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [Boolean] :recovery Return information about shard recovery (progress, size, etc) @option arguments [Boolean] :snapshot Return information about snapshots (when shared gateway is used)
@see elasticsearch.org/guide/reference/api/admin-indices-status/
# File lib/elasticsearch/api/actions/indices/status.rb, line 36 def status(arguments={}) valid_params = [ :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :recovery, :snapshot ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), '_status' params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end
Perform multiple operation on index aliases in a single request.
Pass the `actions` (add, remove) in the `body` argument.
@example Add multiple indices to a single alias
client.indices.update_aliases body: { actions: [ { add: { index: 'logs-2013-06', alias: 'year-2013' } }, { add: { index: 'logs-2013-05', alias: 'year-2013' } } ] }
@example Swap an alias (atomic operation)
client.indices.update_aliases body: { actions: [ { remove: { index: 'logs-2013-06', alias: 'current-month' } }, { add: { index: 'logs-2013-07', alias: 'current-month' } } ] }
@option arguments [Hash] :body The operations definition and other configuration (Required) @option arguments [Time] :timeout Explicit operation timeout
@see www.elasticsearch.org/guide/reference/api/admin-indices-aliases/
# File lib/elasticsearch/api/actions/indices/update_aliases.rb, line 33 def update_aliases(arguments={}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :timeout ] method = 'POST' path = "_aliases" params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end
Validate a query
@example Validate a simple query string query
client.indices.validate_query index: 'myindex', q: 'title:foo AND body:bar'
@example Validate an invalid query (with explanation)
client.indices.validate_query index: 'myindex', q: '[[[ BOOM! ]]]', explain: true
@example Validate a DSL query (with explanation)
client.indices.validate_query index: 'myindex', explain: true, body: { filtered: { query: { match: { title: 'foo' } }, filter: { range: { published_at: { from: '2013-06-01' } } } } }
@option arguments [List] :index A comma-separated list of index names to restrict the operation;
use `_all` or empty string to perform the operation on all indices
@option arguments [List] :type A comma-separated list of document types to restrict the operation;
leave empty to perform the operation on all types
@option arguments [Hash] :body The query definition (without the top-level `query` element) @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
no concrete indices. (This includes `_all` string or when no indices have been specified)
@option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
are open, closed or both. (options: open, closed)
@option arguments [Boolean] :explain Return detailed information about the error @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
`missing` ones (options: none, missing) @until 1.0
@option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
unavailable (missing, closed, etc)
@option arguments [String] :source The URL-encoded query definition (instead of using the request body) @option arguments [String] :q Query in the Lucene query string syntax
@see www.elasticsearch.org/guide/reference/api/validate/
# File lib/elasticsearch/api/actions/indices/validate_query.rb, line 57 def validate_query(arguments={}) valid_params = [ :q, :explain, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, :source ] method = 'GET' path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_validate/query' params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end
Generated with the Darkfish Rdoc Generator 2.