You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Almog Tavor <al...@gmail.com> on 2022/04/21 15:18:33 UTC

Async batch indexing to Solr

Hi,
I'd like to perform asynchronous bulk indexing operations to Solr with Java.
I've read in the documentation
<https://solr.apache.org/guide/8_7/using-solrj.html>that the Http2SolrClient
<https://solr.apache.org/docs/8_7_0/solr-solrj/org/apache/solr/client/solrj/impl/Http2SolrClient.html>
is
async and non-blocking, but I couldn't find any example in the subject. I
wonder if there's a function that index documents to Solr and returns a
Future. The only thing I've found that fills my needs is the community's "
solrs <https://inoio.github.io/solrs/usage/adding-data.html>" library that
enables one to index documents in bulk and receive a CompletableFuture. I'd
like to know if Solr really offers such an option either, and if not, then
how does Solr expect users to index documents asynchronously.

Re: Async batch indexing to Solr

Posted by Walter Underwood <wu...@wunderwood.org>.
Solr doesn’t work like that. It doesn’t have transactions and you can’t get notification of when new data is searchable. Documents are indexed either when there is an explicit commit or an autocommit. “Commit” is really not the right word. It is a batch submit. 

All indexing is asynchronous. Submit the batch and go on with life.

This is especially true with replication (any kind), which you need to be running for fault tolerance.

wunder
Walter Underwood
wunder@wunderwood.org
http://observer.wunderwood.org/  (my blog)

> On Apr 21, 2022, at 8:18 AM, Almog Tavor <al...@gmail.com> wrote:
> 
> Hi,
> I'd like to perform asynchronous bulk indexing operations to Solr with Java.
> I've read in the documentation
> <https://solr.apache.org/guide/8_7/using-solrj.html>that the Http2SolrClient
> <https://solr.apache.org/docs/8_7_0/solr-solrj/org/apache/solr/client/solrj/impl/Http2SolrClient.html>
> is
> async and non-blocking, but I couldn't find any example in the subject. I
> wonder if there's a function that index documents to Solr and returns a
> Future. The only thing I've found that fills my needs is the community's "
> solrs <https://inoio.github.io/solrs/usage/adding-data.html>" library that
> enables one to index documents in bulk and receive a CompletableFuture. I'd
> like to know if Solr really offers such an option either, and if not, then
> how does Solr expect users to index documents asynchronously.