Optimizing shards

All search network shards can be optimized with a single call the Optimize method of the Indexer class.

The optimization minimizes the number of index segments on each shard. As a result, search performance increases.

An asynchronous execution flag is available as an option. In the case of asynchronous optimization, you can track the completion of the operation by subscribing to the OptimizationCompleted event.

The following code example demonstrates how to perform search network optimization.

C#

Console.WriteLine("Optimizing shards");
Indexer indexer = node.Indexer;
OptimizeOptions options = new OptimizeOptions();
indexer.Optimize(options);

More resources

GitHub examples

You may easily run the code from documentation articles and see the features in action in our GitHub examples:

Free online document search App

Along with full featured .NET library we provide simple, but powerful free Apps.

You are welcome to search over your PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX and more with our free online Free Online Document Search App.