Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 943 Bytes

force_merge.md

File metadata and controls

41 lines (29 loc) · 943 Bytes

Force Merge

The force merge API allows to optimize one or more indexes for faster search by merging the number of Lucene segments (which grow over time). Read more on the official documentation.

There isn't really a whole lot to using this DSL. Simply specify a single index or a sequence of indexes.

client.execute {
  forceMerge("index1")
}

or

client.execute {
  forceMerge("index1", "index2", ....)
}

There are only a few options.

maxSegments allows you to choose how many segments to merge to. To merge to a single segment for example, set this value to 1.

client.execute {
  forceMerge("index1").maxSegments(1)
}

If onlyExpungeDeletes is set to true, then only expunge segments containing document deletions.

client.execute {
  forceMerge("index1").onlyExpungeDeletes(true)
}