mrubin
(Mike Rubin)
May 10, 2018, 12:00am
1
I am trying to issue an _optimize command via curl. I've tried both of the below styles:
$ curl --user username:password -XPOST "https://redacted.us-east-1.aws.found.io:9243/foo/_optimize?max_num_segments=1"
{"error":{"root_cause":[{"type":"parse_exception","reason":"request body is required"}],"type":"parse_exception","reason":"request
$ curl --user username:password -H 'Content-Type: application/json' -XPOST https://redacted.us-east-1.aws.found.io:9243/foo/_optimize -d '{"max_num_segments" : "1"}'
{"error":{"root_cause":[{"type":"invalid_type_name_exception","reason":"Document mapping type name can't start with '_', found: [_optimize]"}],"type":"invalid_type_name_exception","reason":"Document mapping type name can't start with '_', found: [_optimize]"},"status":400}
Is _optimize supported on the Elastic Cloud version of Elasticsearch?
shanec
(Shane Connelly)
May 10, 2018, 12:25am
2
The _optimize
endpoint was deprecated in Elasticsearch 2.1 and subsequently removed in Elasticsearch 5.0 . It was replaced by _forcemerge
which more accurately describes what it's doing. Replace _optimize
with _forcemerge
and if you want to read more, have a look at the force merge API documentation
1 Like
mrubin
(Mike Rubin)
May 11, 2018, 5:34pm
3
@shanec Is it still recommended to run _forcemerge
on indexes that you know will no longer be added to, to set the # of segments to 1?
shanec
(Shane Connelly)
May 13, 2018, 2:11am
4
Elasticsearch will automatically merge segments in the background for you. If you want to explicitly do so at an optimal time, _forcemerge can be useful. But to be honest, most users don't need to explicitly call forcemerge.
system
(system)
Closed
June 10, 2018, 2:11am
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.