Realtime Get

The realtime get API retrieves the latest versions of one or more documents.

We use the term “realtime” to distinguish it from normal lucene-based search which operates on a snapshot of the index that is periodically refreshed. Realtime get is guaranteed to return the latest version of a document.

Parameters to the realtime-get component, /get include:

  • id – the id of the document to get
  • ids – a list of comma separated document ids
  • fl – comma separated field list of the document fields to return

Realtime Get Examples

If a single id parameter is used, a simple single-document response is returned. For example:

$ curl http://localhost:8983/solr/demo/get?id=book1
  "doc": {
    "author":"Steven Brust",

If the ids parameter, or multiple id parameters are used, the response will mimic the document list format used by normal queries. For example:

$ curl http://localhost:8983/solr/demo/get?ids=book1,book2
        "author":"Steven Brust",
        "title":["The Black Company"],
        "author":"Glen Cook",

Realtime Get with SolrJ

Here’s an example of how to use real-time get with SolrJ, the Solr Java client:

// Note: this example is for Solr 5.1 and later
// First, we create the client and point it at the Solr server
HttpSolrClient client = new HttpSolrClient("http://localhost:8983/solr/demo");

SolrDocument sdoc = client.getById("book1");
System.out.println("I found book " + sdoc);

client.close(); // shut down the client when we are done