Skip to content

Commit

Permalink
Revert forcemerge and refresh order
Browse files Browse the repository at this point in the history
Otherwise, opensearch does not clear old segment files

Signed-off-by: Heemin Kim <heemin@amazon.com>
  • Loading branch information
heemin32 committed Jun 7, 2023
1 parent d8cad3a commit fc7f003
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ public void createIndexIfNotExists(final String indexName) {
private void freezeIndex(final String indexName) {
TimeValue timeout = clusterSettings.get(Ip2GeoSettings.TIMEOUT);
StashedThreadContext.run(client, () -> {
client.admin().indices().prepareRefresh(indexName).execute().actionGet(timeout);
client.admin().indices().prepareForceMerge(indexName).setMaxNumSegments(1).execute().actionGet(timeout);
client.admin().indices().prepareRefresh(indexName).execute().actionGet(timeout);
client.admin()
.indices()
.prepareUpdateSettings(indexName)
Expand Down

0 comments on commit fc7f003

Please sign in to comment.