How often should you reindex an elasticsearch cluster?

109 views Asked by At

I have an OpenSearch domain with 40 data nodes. There is currently one index in the whole cluster. We are a delete-heavy cluster where we are constantly deleting HTML documents and adding new ones. We currently have about 200,000,000 searchable documents and 160,000,000 deleted documents. Would reindexing be a good idea? Also, are there tools you can use to estimate the time it would take to reindex a domain?

1

There are 1 answers

0
Jean-Pierre Matsumoto On

Reindex is not the only option. If you can pause the documents ingestion for a few hours (or maybe days), you can run:

  • split on the index. If you split by a factor 6, you will have no more segments > 5GB and Elasticsearch will merge segments and at the same time free disk space of deleted documents. But this option requires a lot of free disk space. Please read carefully the documentation.

  • forcemerge on the index. I think you will have to specify a value for max_num_segments and / or only_expunge_deletes. Warning: Force merge operation cannot be cancelled and can takes hours on such big shards.

Ideally for the future, you should try to avoid having only one big index because they are harder to operate. Usually, it's possible to distribute documents in multiple indexes by a switch (on first letters of HTML domain name for example).