Time for action – listing all the fields with the CSV output

We need a simple method to retrieve a list of all the possible fields. This could be useful in most situations. For example, when we have to manage several fields, it will be important to be able to check if they are in the index and how to remap them with copyField when needed:

>> curl -X GET 'http://localhost:8983/solr/paintings_start/select?q=*:*&rows=0&wt=csv'

This simple combination of parameters permits us to retrieve the list of fields currently available.

What just happened?

In this simple case, we introduced two basic parameters, write type (wt) and number of rows (rows). There are cases when we don't need to retrieve the documents explicitly, because we only want some other metadata (rows=0), and we want the results in several formats. For the CSV format, the output will contain a list of headers with the name of the fields to be used as column names, so we have a simple list on combining the two options.

In Chapter 4, Searching the Example Data, we will see the response format in more detail.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.142.144