Time for action – projecting fields with fl

Another important parameter to consider is fl, that can be used for fields projection, obtaining only certain fields in the results:

If we are interested on obtaining the titles and artist reference for all the documents, we can use the following command:

>>curl -X GET 'http://localhost:8983/solr/paintings/select?q=artist:*&wt=json&indent=true&omitHeader=true&fl=title,artist'

The output for the command is similar to the one shown in the following screenshot:

Time for action – projecting fields with fl
  1. Notice that the results will be indented as requested, and they will not contain any header to be more readable. Moreover, the parameters list does ...

Get Apache Solr Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.