Retrieving specific fields in a Solr query?

2019-01-22 11:02发布

问题:

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?

回答1:

/?q=query&fl=field1,field2,field3


回答2:

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.



回答3:

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.



回答4:

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



回答5:

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.



标签: lucene solr