Trying to force merge index

(Rah) #1


I am trying to force purge document immediately after deleting . I am unable to perform it without full re-indexing.
I deleted 3 document in total of 10, but the total document in ES still shows 10.
Following are the result of various api calls :
_stats -->
"indexing": {
"index_total": 22,
"index_time_in_millis": 445,
"index_current": 0,
"index_failed": 68,
"delete_total": 3,
"delete_time_in_millis": 2,

I am invoking forcemerge in following way :
private void optimizeIndex(String index, int maxNumSegments) {
Client client = (Client)SpringUtil.getBean("searchClient");
final ForceMergeRequest request = client.admin().indices().prepareForceMerge(index).setMaxNumSegments(maxNumSegments).setOnlyExpungeDeletes(true).setFlush(true).request();

        // Using a specific timeout to override the global Elasticsearch request timeout
        ForceMergeResponse forceMergeResponse = client.admin().indices().forceMerge(request).actionGet();

I am calling this function as soon as I delete documents.
Not sure what I am doing wrong.


(Christian Dahlqvist) #2

Did you run a refresh before running the forcemerge?

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.