Fetch Fields
| Engine Type | Supported? |
|---|---|
| Crawler-based Engine | YES |
| API-based Engine | YES |
Specify which document fields to return.
- engine_key
- required
- The Engine Key associated with your Engine. Found within your dashboard.
- q
- required
- The query used within your search.
- fetch_fields
- optional
- Requests with
fetch_fieldswill only return the specified fields. Expects a DocumentType and an array of field names. Field names must coincide with those in your documents.
Example - Return documents from the
books DocumentType that match the query "brothers", but only the author and price fields. Crawler based Engines use page as the default DocumentType.
curl -XGET 'https://search-api.swiftype.com/api/v1/public/engines/search.json' \
-H 'Content-Type: application/json' \
-d '{
"engine_key": "YOUR_ENGINE_KEY",
"q": "brothers",
"fetch_fields":{
"books":["author","price"]
}
}'
Stuck? Looking for help? Contact support or check out the Site Search community forum!