How to keep segment count of active index small?

We have a index contains around 1 million documents, each time after the full re-indexing, the segment count of each shard is general around 20-30.

And we found that if we optimize the index (_forcemerge?max_num_segments=1), the query performance could be significantly improved.

But after the full re-index, the segment count increased to 20 - 30 again.

So my question is, is there a way to keep the max segment count to be a low number during the re-indexing?

No there's not. You can run a _forcemerge after the indexing though.

I heard that it is not recommended to to _forcemerge on active index, is it true?

Yes, which is why I said after :slight_smile:

If you are having problems with search speed during index time, perhaps telling us more about your use case will open up some ideas on other options.


We do have a query perf issue which I asked in another topic:

Could you please take a look?

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