betto86
betto86

Reputation: 714

Optimize Elasticsearch index

Due to low disk space and a large amount of deleted documents inside one of my index, I need to do an optimize command (ElasticSearch 1.7)

Right now, the index has the following stats:

shards: 15 * 1 | docs: 23,165,760 | size: 1.25TB

Sorry for my bad english :)

And let me know if you need any further stats

Upvotes: 3

Views: 3427

Answers (1)

Andrei Stefan
Andrei Stefan

Reputation: 52366

Will the optimize API block any indexing/query operation untill the optimization is done?

No, it can run in parallel, but the indexing process will affect the optimization. New segments are created, those are subject to optimization as well...

Will the optimize API affects operations on the other indexes?

Not directly, but indirectly by using additional CPU, memory and disk.

Is it possible to have an approximate time to know how long it will take?

Nop :-), maybe only by testing upfront and extrapolating to the number of documents/segments.

Be careful that optimization will require additional disk space. If you optimize to a very low number of segments, the optimization process will most likely try to optimize a set of very large segments in the end which means it will need an additional (largeSegment1_size + largeSegment2_size + ....) disk space. The old segments are deleted only when the resulting merged segment is complete.

Also, look at only_expunge_deletes option for an alternative.

Another advice is to perform the optimization when there is less load on the cluster. As I mentioned the optimization requires additional CPU, memory and disk space resources.

Upvotes: 4

Related Questions