diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeRequest.java b/core/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeRequest.java
index 5472660a7bb..be47ba22195 100644
--- a/core/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeRequest.java
+++ b/core/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeRequest.java
@@ -26,7 +26,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
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
* null for the indices.
* @see org.elasticsearch.client.Requests#upgradeRequest(String...)
* @see org.elasticsearch.client.IndicesAdminClient#upgrade(UpgradeRequest)
@@ -43,7 +43,7 @@ public class UpgradeRequest extends BroadcastRequest {
/**
* 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);
diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeResponse.java b/core/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeResponse.java
index df611759790..64e958372cd 100644
--- a/core/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeResponse.java
+++ b/core/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeResponse.java
@@ -32,7 +32,7 @@ import java.util.List;
import java.util.Map;
/**
- * A response for optimize action.
+ * A response for the upgrade action.
*
*
*/
@@ -80,4 +80,4 @@ public class UpgradeResponse extends BroadcastResponse {
public Map> versions() {
return versions;
}
-}
\ No newline at end of file
+}
diff --git a/core/src/main/java/org/elasticsearch/index/engine/Engine.java b/core/src/main/java/org/elasticsearch/index/engine/Engine.java
index 46f144ea5f2..b0fefe71189 100644
--- a/core/src/main/java/org/elasticsearch/index/engine/Engine.java
+++ b/core/src/main/java/org/elasticsearch/index/engine/Engine.java
@@ -488,7 +488,7 @@ public abstract class Engine implements Closeable {
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);
diff --git a/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java b/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java
index dccaaa4ecbf..5d9239323af 100644
--- a/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java
+++ b/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java
@@ -665,7 +665,7 @@ public class IndexShard extends AbstractIndexShardComponent {
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());
diff --git a/core/src/main/java/org/elasticsearch/index/shard/MergePolicyConfig.java b/core/src/main/java/org/elasticsearch/index/shard/MergePolicyConfig.java
index 0e1ecc1d208..0a9315dbc25 100644
--- a/core/src/main/java/org/elasticsearch/index/shard/MergePolicyConfig.java
+++ b/core/src/main/java/org/elasticsearch/index/shard/MergePolicyConfig.java
@@ -64,15 +64,15 @@ import org.elasticsearch.common.unit.ByteSizeValue;
*
* index.merge.policy.max_merge_at_once_explicit
:
*
- * 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 30
.
*
* index.merge.policy.max_merged_segment
:
*
* 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 5gb
.
+ * 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 5gb
.
*
* index.merge.policy.segments_per_tier
:
*
diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/forcemerge/RestForceMergeAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/forcemerge/RestForceMergeAction.java
index 37c2b4c7999..4bec04845d0 100644
--- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/forcemerge/RestForceMergeAction.java
+++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/forcemerge/RestForceMergeAction.java
@@ -48,13 +48,6 @@ public class RestForceMergeAction extends BaseRestHandler {
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
diff --git a/core/src/test/java/org/elasticsearch/test/rest/test/FileUtilsTests.java b/core/src/test/java/org/elasticsearch/test/rest/test/FileUtilsTests.java
index 20bd7a21241..b0df110f0a8 100644
--- a/core/src/test/java/org/elasticsearch/test/rest/test/FileUtilsTests.java
+++ b/core/src/test/java/org/elasticsearch/test/rest/test/FileUtilsTests.java
@@ -62,12 +62,12 @@ public class FileUtilsTests extends ESTestCase {
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));
diff --git a/docs/reference/indices.asciidoc b/docs/reference/indices.asciidoc
index 33ca9a48501..da41ac52df5 100644
--- a/docs/reference/indices.asciidoc
+++ b/docs/reference/indices.asciidoc
@@ -112,7 +112,5 @@ include::indices/refresh.asciidoc[]
include::indices/forcemerge.asciidoc[]
-include::indices/optimize.asciidoc[]
-
include::indices/upgrade.asciidoc[]
diff --git a/docs/reference/indices/optimize.asciidoc b/docs/reference/indices/optimize.asciidoc
deleted file mode 100644
index 8a9462cd37b..00000000000
--- a/docs/reference/indices/optimize.asciidoc
+++ /dev/null
@@ -1,54 +0,0 @@
-[[indices-optimize]]
-== Optimize
-
-deprecated[2.1.0,Optimize API has been renamed to the force merge API]
-
-The optimize API allows to optimize one or more indices through an API.
-The optimize process basically optimizes the index for faster search
-operations (and relates to the number of segments a Lucene index holds
-within each shard). The optimize operation allows to reduce the number
-of segments by merging them.
-
-This call will block until the optimize is complete. If the http connection
-is lost, the request will continue in the background, and
-any new requests will block until the previous optimize is complete.
-
-[source,js]
---------------------------------------------------
-$ curl -XPOST 'http://localhost:9200/twitter/_optimize'
---------------------------------------------------
-
-[float]
-[[optimize-parameters]]
-=== Request Parameters
-
-The optimize API accepts the following request parameters as query arguments:
-
-[horizontal]
-`max_num_segments`:: The number of segments to optimize to. To fully
-optimize the index, set it to `1`. Defaults to simply checking if a
-merge needs to execute, and if so, executes it.
-
-`only_expunge_deletes`:: Should the optimize process only expunge segments with
-deletes in it. In Lucene, a document is not deleted from a segment, just marked
-as deleted. During a merge process of segments, a new segment is created that
-does not have those deletes. This flag allows to only merge segments that have
-deletes. Defaults to `false`. Note that this won't override the
-`index.merge.policy.expunge_deletes_allowed` threshold.
-
-`flush`:: Should a flush be performed after the optimize. Defaults to
-`true`.
-
-[float]
-[[optimize-multi-index]]
-=== Multi Index
-
-The optimize API can be applied to more than one index with a single
-call, or even on `_all` the indices.
-
-[source,js]
---------------------------------------------------
-$ curl -XPOST 'http://localhost:9200/kimchy,elasticsearch/_optimize'
-
-$ curl -XPOST 'http://localhost:9200/_optimize?only_expunge_deletes=true'
---------------------------------------------------
diff --git a/docs/reference/migration/migrate_3_0.asciidoc b/docs/reference/migration/migrate_3_0.asciidoc
index bbf109fe449..3a6cce13d30 100644
--- a/docs/reference/migration/migrate_3_0.asciidoc
+++ b/docs/reference/migration/migrate_3_0.asciidoc
@@ -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.
+
=== Parent/Child changes
The `children` aggregation, parent child inner hits and `has_child` and `has_parent` queries will not work on indices
diff --git a/docs/reference/search/suggesters/completion-suggest.asciidoc b/docs/reference/search/suggesters/completion-suggest.asciidoc
index af93ea1598a..dbef11ac7e1 100644
--- a/docs/reference/search/suggesters/completion-suggest.asciidoc
+++ b/docs/reference/search/suggesters/completion-suggest.asciidoc
@@ -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 <> 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 <> for that. You can call
+force merge with the `only_expunge_deletes=true` to only target deletions for
+merging.
[[querying]]
==== Querying
diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.optimize.json b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.optimize.json
deleted file mode 100644
index c5e63bfe60d..00000000000
--- a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.optimize.json
+++ /dev/null
@@ -1,52 +0,0 @@
-{
- "indices.optimize": {
- "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-optimize.html",
- "methods": ["POST", "GET"],
- "url": {
- "path": "/_optimize",
- "paths": ["/_optimize", "/{index}/_optimize"],
- "parts": {
- "index": {
- "type" : "list",
- "description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices"
- }
- },
- "params": {
- "flush": {
- "type" : "boolean",
- "description" : "Specify whether the index should be flushed after performing the operation (default: true)"
- },
- "ignore_unavailable": {
- "type" : "boolean",
- "description" : "Whether specified concrete indices should be ignored when unavailable (missing or closed)"
- },
- "allow_no_indices": {
- "type" : "boolean",
- "description" : "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"
- },
- "expand_wildcards": {
- "type" : "enum",
- "options" : ["open","closed","none","all"],
- "default" : "open",
- "description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both."
- },
- "max_num_segments": {
- "type" : "number",
- "description" : "The number of segments the index should be merged into (default: dynamic)"
- },
- "only_expunge_deletes": {
- "type" : "boolean",
- "description" : "Specify whether the operation should only expunge deleted documents"
- },
- "operation_threading": {
- "description" : "TODO: ?"
- },
- "wait_for_merge": {
- "type" : "boolean",
- "description" : "Specify whether the request should block until the merge process is finished (default: true)"
- }
- }
- },
- "body": null
- }
-}
diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.optimize/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.optimize/10_basic.yaml
deleted file mode 100644
index 1f24871ac08..00000000000
--- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.optimize/10_basic.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
----
-"Optimize index tests":
- - do:
- indices.create:
- index: testing
-
- - do:
- indices.optimize:
- index: testing
- max_num_segments: 1