All Products
Search
Document Center

ApsaraDB for HBase:Index data visibility

Last Updated:Mar 28, 2026

Data synchronized to the Search service is visible only after it is committed. Two commit types control when data becomes visible: soft commit and hard commit.

How commit types work

Commit typeWhat it does
Soft commitMakes index changes visible to search queries. Data becomes queryable but is not yet flushed to disk.
Hard commitFlushes index data to disk. Data is persisted to stable storage.

Use these two commit types together: soft commit for near-real-time query visibility, hard commit for durability. Compared with a hard commit, a soft commit requires less time to complete.

Configure commit timing in solrconfig.xml

When creating an index, specify a configuration set named config set. The solrconfig.xml file in that configuration set controls commit behavior.

Soft commit

<autoSoftCommit>
  <maxTime>${solr.autoSoftCommit.maxTime:15000}</maxTime>
</autoSoftCommit>

The default is 15,000 ms (15 seconds). Data becomes queryable within 15 seconds of being written.

maxTime determines the maximum delay between a write and when the data appears in search results. A smaller value reduces visibility latency but increases soft commit frequency.

Hard commit

<autoCommit>
  <maxTime>${solr.autoCommit.maxTime:30000}</maxTime>
  <openSearcher>false</openSearcher>
</autoCommit>

The default is 30,000 ms (30 seconds). Data is flushed to disk within 30 seconds.

Set this value high enough to avoid frequent disk flushes, which degrade write performance. Use the default unless you have specific requirements.

Note

We recommend that you specify a sufficient amount of time. Otherwise, the Search service frequently flushes data to the disk, which affects the write performance. Use the default value.

Apply configuration changes

  1. Download the configuration set.

  2. Modify the maxTime values for autoSoftCommit and autoCommit in solrconfig.xml.

  3. Upload the updated configuration set to ZooKeeper:

    ./solr zk upconfig -d conf/ -n myconf
    FlagDescription
    -d conf/Path to the local configuration directory
    -n myconfName of the configuration set in ZooKeeper
  4. Reload the collection in the Alibaba Cloud HBase console to apply the new configuration.

Control commits from the client

If you prefer not to modify solrconfig.xml, control commit timing directly from your client code.

Set a per-document commit deadline

Pass a commit deadline when adding a document:

// Signature
public UpdateResponse add(SolrInputDocument doc, int commitWithinMs)
    throws SolrServerException, IOException;

// Example: commit within 1,000 ms (1 second)
cloudSolrClient.add(doc, 1000);

commitWithinMs specifies the maximum number of milliseconds before the document must be committed and become queryable.

Trigger an explicit commit

Call commit() after writing to force an immediate commit:

// Signature
// waitFlush:    whether to wait for the write to flush to disk
// waitSearcher: whether to wait for a new searcher to open
// softCommit:   true for a soft commit, false for a hard commit
public UpdateResponse commit(boolean waitFlush, boolean waitSearcher, boolean softCommit)
    throws SolrServerException, IOException;

// Example: trigger an immediate soft commit without waiting
cloudSolrClient.commit(false, false, true);

Reference

Update handlers in SolrConfig