Forcibly Merging Segments
Each shard is created based on multiple segments. The decrease of the number of segments can greatly improve the query speed. The index segments can be manually merged periodically to improve the query speed. The batch force merge operation on segments of single index and multiple indexes is supported.
The following is an example of single index in security mode:
curl -XPOST --tlsv1.2 --negotiate -k -u : 'https://ip:httpport/myindex-001/_forcemerge?only_expunge_deletes=false&max_num_segments=1&flush=true&pretty'
The following is an example of multiple indexes in security mode:
curl -XPOST --tlsv1.2 --negotiate -k -u: 'https://ip:httpport/myindex-001, myindex-002/_forcemerge?only_expunge_deletes=false&max_num_segments=1&flush=true&pretty'
curl -XPOST --tlsv1.2 --negotiate -k -u : 'https://ip:httpport/_all/_forcemerge?only_expunge_deletes=false&max_num_segments=1&flush=true&pretty'
- The force merge operation consumes a large number of disk I/Os. Therefore, you are advised to forcibly merge segments during off-peak hours.
- max_num_segments: indicates the maximum number of segments. The value 1 indicates that the merge operation is performed until there is only one segment.
- only_expunge_deletes: Only the segments with the deleted flag are cleared. The recommended value is false.
- flush: Run the flush command after clearing. The default value is true.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot