Skip to content

Commit

Permalink
Merge branch 'remove-optimize-rest'
Browse files Browse the repository at this point in the history
  • Loading branch information
dakrone committed Oct 29, 2015
2 parents 56069a2 + 3a458af commit 3b50580
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.io.IOException;

/**
* A request to upgrade one or more indices. In order to optimize on all the indices, pass an empty array or
* A request to upgrade one or more indices. In order to update all indices, pass an empty array or
* <tt>null</tt> for the indices.
* @see org.elasticsearch.client.Requests#upgradeRequest(String...)
* @see org.elasticsearch.client.IndicesAdminClient#upgrade(UpgradeRequest)
Expand All @@ -43,7 +43,7 @@ public static final class Defaults {
/**
* Constructs an optimization request over one or more indices.
*
* @param indices The indices to optimize, no indices passed means all indices will be optimized.
* @param indices The indices to upgrade, no indices passed means all indices will be optimized.
*/
public UpgradeRequest(String... indices) {
super(indices);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import java.util.Map;

/**
* A response for optimize action.
* A response for the upgrade action.
*
*
*/
Expand Down Expand Up @@ -80,4 +80,4 @@ public void writeTo(StreamOutput out) throws IOException {
public Map<String, Tuple<Version, String>> versions() {
return versions;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public final boolean refreshNeeded() {
public abstract CommitId flush() throws EngineException;

/**
* Optimizes to 1 segment
* Force merges to 1 segment
*/
public void forceMerge(boolean flush) throws IOException {
forceMerge(flush, 1, false, false, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ public org.apache.lucene.util.Version upgrade(UpgradeRequest upgrade) throws IOE
logger.trace("upgrade with {}", upgrade);
}
org.apache.lucene.util.Version previousVersion = minimumCompatibleVersion();
// we just want to upgrade the segments, not actually optimize to a single segment
// we just want to upgrade the segments, not actually forge merge to a single segment
getEngine().forceMerge(true, // we need to flush at the end to make sure the upgrade is durable
Integer.MAX_VALUE, // we just want to upgrade the segments, not actually optimize to a single segment
false, true, upgrade.upgradeOnlyAncientSegments());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@
*
* <li><code>index.merge.policy.max_merge_at_once_explicit</code>:
*
* Maximum number of segments to be merged at a time, during optimize or
* Maximum number of segments to be merged at a time, during force merge or
* expungeDeletes. Default is <code>30</code>.
*
* <li><code>index.merge.policy.max_merged_segment</code>:
*
* Maximum sized segment to produce during normal merging (not explicit
* optimize). This setting is approximate: the estimate of the merged segment
* size is made by summing sizes of to-be-merged segments (compensating for
* percent deleted docs). Default is <code>5gb</code>.
* force merge). This setting is approximate: the estimate of the merged
* segment size is made by summing sizes of to-be-merged segments
* (compensating for percent deleted docs). Default is <code>5gb</code>.
*
* <li><code>index.merge.policy.segments_per_tier</code>:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ public RestForceMergeAction(Settings settings, RestController controller, Client

controller.registerHandler(GET, "/_forcemerge", this);
controller.registerHandler(GET, "/{index}/_forcemerge", this);

// TODO: Remove for 3.0
controller.registerHandler(POST, "/_optimize", this);
controller.registerHandler(POST, "/{index}/_optimize", this);

controller.registerHandler(GET, "/_optimize", this);
controller.registerHandler(GET, "/{index}/_optimize", this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public void testLoadMultipleYamlSuites() throws Exception {
assertThat(yamlSuites.get("index").size(), greaterThan(1));

//multiple paths, which can be both directories or yaml test suites (with optional file extension)
yamlSuites = FileUtils.findYamlSuites(null, "/rest-api-spec/test", "indices.optimize/10_basic", "index");
yamlSuites = FileUtils.findYamlSuites(null, "/rest-api-spec/test", "indices.forcemerge/10_basic", "index");
assertThat(yamlSuites, notNullValue());
assertThat(yamlSuites.size(), equalTo(2));
assertThat(yamlSuites.containsKey("indices.optimize"), equalTo(true));
assertThat(yamlSuites.get("indices.optimize").size(), equalTo(1));
assertSingleFile(yamlSuites.get("indices.optimize"), "indices.optimize", "10_basic.yaml");
assertThat(yamlSuites.containsKey("indices.forcemerge"), equalTo(true));
assertThat(yamlSuites.get("indices.forcemerge").size(), equalTo(1));
assertSingleFile(yamlSuites.get("indices.forcemerge"), "indices.forcemerge", "10_basic.yaml");
assertThat(yamlSuites.containsKey("index"), equalTo(true));
assertThat(yamlSuites.get("index").size(), greaterThan(1));

Expand Down
2 changes: 0 additions & 2 deletions docs/reference/indices.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,5 @@ include::indices/refresh.asciidoc[]

include::indices/forcemerge.asciidoc[]

include::indices/optimize.asciidoc[]

include::indices/upgrade.asciidoc[]

54 changes: 0 additions & 54 deletions docs/reference/indices/optimize.asciidoc

This file was deleted.

7 changes: 7 additions & 0 deletions docs/reference/migration/migrate_3_0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,18 @@ Scroll requests sorted by `_doc` have been optimized to more efficiently resume
from where the previous request stopped, so this will have the same performance
characteristics as the former `scan` search type.

=== REST API changes

==== search exists api removed

The search exists api has been removed in favour of using the search api with
`size` set to `0` and `terminate_after` set to `1`.

==== `/_optimize` endpoint removed

The deprecated `/_optimize` endpoint has been removed. The `/_forcemerge`
endpoint should be used in lieu of optimize.

==== Deprecated queries removed

The following deprecated queries have been removed:
Expand Down
8 changes: 4 additions & 4 deletions docs/reference/search/suggesters/completion-suggest.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ payloads or weights. This form does still work inside of multi fields.
}
--------------------------------------------------

NOTE: The suggest data structure might not reflect deletes on
documents immediately. You may need to do an <<indices-optimize>> for that.
You can call optimize with the `only_expunge_deletes=true` to only target
deletions for merging.
NOTE: The suggest data structure might not reflect deletes on documents
immediately. You may need to do an <<indices-forcemerge>> for that. You can call
force merge with the `only_expunge_deletes=true` to only target deletions for
merging.

[[querying]]
==== Querying
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 3b50580

Please sign in to comment.