Apache Solr Documentation

6.5 Ref Guide (PDF Download)
Solr Tutorial
Solr Community Wiki

Older Versions of this Guide (PDF)

Ref Guide Topics


*** As of June 2017, the latest Solr Ref Guide is located at https://lucene.apache.org/solr/guide ***

Please note comments on these pages have now been disabled for all users.

Skip to end of metadata
Go to start of metadata

It's possible to export fully sorted result sets using a special rank query parser and response writer  specifically designed to work together to handle scenarios that involve sorting and exporting millions of records. This uses a stream sorting technique that begins to send records within milliseconds and continues to stream results until the entire result set has been sorted and exported.

The cases where this functionality may be useful include: session analysis, distributed merge joins, time series roll-ups, aggregations on high cardinality fields, fully distributed field collapsing, and sort based stats.

Field Requirements

All the fields being sorted and exported must have docValues set to true. For more information, see the section on DocValues.

The /export RequestHandler

The /export request handler with the appropriate configuration is one of Solr's out-of-the-box request handlers - see Implicit RequestHandlers for more information.

Note that this request handler's properties are defined as "invariants", which means they cannot be overridden by other properties passed at another time (such as at query time).

Requesting Results Export

You can use /export to make requests to export the result set of a query.

All queries must include sort and fl parameters, or the query will return an error. Filter queries are also supported.

The supported response writers are 'json' and 'javabin'. For backward compatibility reasons 'wt=xsort' is also supported as input, but 'wt=xsort' behaves same as 'wt=json'. The default output format is json.

Here is an example of what an export request of some indexed log data might look like:

Specifying the Sort Criteria

The sort property defines how documents will be sorted in the exported result set. Results can be sorted by any field that has a field type of int,long, float, double, string. The sort fields must be single valued fields.

Up to four sort fields can be specified per request, with the 'asc' or 'desc' properties.

Specifying the Field List

The fl property defines the fields that will be exported with the result set. Any of the field types that can be sorted (i.e., int, long, float, double, string, date, boolean) can be used in the field list. The fields can be single or multi-valued. However, returning scores and wildcards are not supported at this time.

Distributed Support

See the section Streaming Expressions for distributed support.


  • No labels


  1. Initial docs for the SOLR-5244.


  2. I think there is typo here?

    So Streaming Expression .. => See Streaming Expression ...

    1. Yes, thanks & fixed. I also added a link to the other page.

  3. Any plan to support exporting to csv format?