For index updates to be visible (searchable), some kind of commit must reopen a searcher to a new point-in-time view of the index. The realtime get feature allows retrieval (by
unique-key) of the latest version of any documents without the associated cost of reopening a searcher. This is primarily useful when using Solr as a NoSQL data store and not just a search index.
Real Time Get relies on the update log feature, which is enabled by default and can be configured in
Real Time Get requests can be performed using the
/get handler which exists implicitly in Solr - see Implicit RequestHandlers - it's equivalent to the following configuration:
For example, if you started Solr using the
bin/solr -e techproducts example command, you could then index a new document (with out committing it) like so:
If you do a normal search, this document should not be found yet:
However if you use the Real Time Get handler exposed at
/get, you can still retrieve that document:
You can also specify multiple documents at once via the ids parameter and a comma separated list of ids, or by using multiple id parameters. If you specify multiple ids, or use the ids parameter, the response will mimic a normal query response to make it easier for existing clients to parse.
Real Time Get requests can also be combined with filter queries, specified with an
fq parameter, just like search requests:
Do NOT disable the realtime get handler at
/get if you are using SolrCloud otherwise any leader election will cause a full sync in ALL replicas for the shard in question. Similarly, a replica recovery will also always fetch the complete index from the leader because a partial sync will not be possible in the absence of this handler.