Setting number of segments to 1

Hi all,

I am running a query which is heavy on computing. When performing load testing with a decent load, we see that the ES query takes almost 700 - 800 ms to execute.

Hence, we decided to use the optimize API in ES and set the number of segments to 1. I have given this command to set it

$ curl -XPOST 'http://localhost:9200/your-index/_optimize?max_num_segments=1'

But as and when more documents are added and the index is updated, ES defaults to creating more number of segments and the merging process happens.

Our configuration:
2 Core EC2 instance with 8GB ram.
ES Nodes: 3
Shards per index: 2
Number of replicas: 1
Size of the documents in index: 0.1 Million

Is there any way to permanently set the number of segments to 1?

No, segments are automatically created by Lucene.

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