setFlushPolicy
Expert: Controls when segments are flushed to disk during indexing. The FlushPolicy initialized during IndexWriter instantiation and once initialized the given instance is bound to this IndexWriter and should not be used with another writer.
See also
.setRAMBufferSizeMB