From b9ccefe279bed5a69120795a919f6fb6cd712c4c Mon Sep 17 00:00:00 2001 From: Heemin Kim Date: Wed, 7 Jun 2023 13:55:19 -0700 Subject: [PATCH] Reverse forcemerge and refresh order Otherwise, opensearch does not clear old segment files Signed-off-by: Heemin Kim --- .../opensearch/geospatial/ip2geo/common/GeoIpDataFacade.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/common/GeoIpDataFacade.java b/src/main/java/org/opensearch/geospatial/ip2geo/common/GeoIpDataFacade.java index 3976ffd0..11e499a0 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/common/GeoIpDataFacade.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/common/GeoIpDataFacade.java @@ -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)