I am running a Solr instance on Jetty and when I search using the Solr admin panel, it returns the entire document. What should I do to get only specified fields from each Solr document returned by the search?
5 Answers
/?q=query&fl=field1,field2,field3

- 5,160
- 2
- 25
- 37
-
Andrew Any idea how to retrieve fields using solr autosuggest like this /suggest?spellcheck.q=india&fl=count:totaltermfreq(title, 'untitled'),title. – atpatil11 Apr 15 '14 at 11:30
From the Solr Admin home page, click on "Full Interface". On that page there is a box called "Fields to Return". You can list the you want here (comma-separated). "*" means all fields.

- 1,805
- 10
- 6
http://xx.xxx.xx.xx:8983/solr/corename/select?indent=on&q=*:*&wt=json&fl=ImageID,Imagepath,Category
This link has fl parameter: fl is a field list, which will display the specified fields from the indexed list.

- 2,016
- 1
- 9
- 12
-
While this may solve the question, [including an explanation](//meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations! – Filnor Dec 28 '17 at 12:58
-
1The explanation is not correct either; `fl` stands for `field list` - it will not filter any thing - just set which fields to fetch from the index. The existing answers explain exactly the same thing. – MatsLindh Dec 28 '17 at 22:04
The best way is to run the query from Admin concole. When we run it, it also provides the actuall SQL query executed. Just copy the query and use it.
About the question: select specific fields from the table. In the admin console look for 'FL' text box. write the field names you want to retrieve, comma sapereted. Hit the 'Execute Query' button. Top right side the SQL will be available.
Generated Query: ......select?fl=FIELDNAME&indent=on&q=:&wt=json

- 712
- 9
- 7
you can simply pass fl parameter with required fields name in your query.
&fl=field1,field2,field3&query=:
your response documents contains only mentioned fields.

- 69
- 3