File tree Expand file tree Collapse file tree 2 files changed +64
-0
lines changed
lib/elasticsearch/api/actions/indices Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ module Elasticsearch
2+ module API
3+ module Indices
4+ module Actions
5+
6+ # Upgrade the index or indices to the latest Lucene format.
7+ #
8+ # @option arguments [List] :index A comma-separated list of index names;
9+ # use `_all` or empty string to perform the operation on all indices
10+ # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored
11+ # when unavailable (missing or closed)
12+ # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression
13+ # resolves into no concrete indices.
14+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices
15+ # that are open, closed or both. (options: open, closed)
16+ # @option arguments [Boolean] :wait_for_completion Specify whether the request should block until the all
17+ # segments are upgraded (default: true)
18+ #
19+ # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-upgrade.html
20+ #
21+ def upgrade ( arguments = { } )
22+ valid_params = [
23+ :ignore_unavailable ,
24+ :allow_no_indices ,
25+ :expand_wildcards ,
26+ :wait_for_completion ]
27+
28+ method = 'POST'
29+ path = "_upgrade"
30+ params = Utils . __validate_and_extract_params arguments , valid_params
31+ body = nil
32+
33+ perform_request ( method , path , params , body ) . body
34+ end
35+ end
36+ end
37+ end
38+ end
Original file line number Diff line number Diff line change 1+ require 'test_helper'
2+
3+ module Elasticsearch
4+ module Test
5+ class IndicesUpgradeTest < ::Test ::Unit ::TestCase
6+
7+ context "Indices: Upgrade" do
8+ subject { FakeClient . new }
9+
10+ should "perform correct request" do
11+ subject . expects ( :perform_request ) . with do |method , url , params , body |
12+ assert_equal 'POST' , method
13+ assert_equal '_upgrade' , url
14+ assert_equal Hash . new , params
15+ assert_nil body
16+ true
17+ end . returns ( FakeResponse . new )
18+
19+ subject . indices . upgrade
20+ end
21+
22+ end
23+
24+ end
25+ end
26+ end
You can’t perform that action at this time.
0 commit comments