Search Fields
Engine Type | Supported? |
---|---|
Crawler-based Engine | YES |
API-based Engine | YES |
Search only within the provided fields.
- engine_key
- required
- The Engine Key associated with your Engine. Found within your dashboard.
- q
- required
- The query used within your search.
- search_fields
- optional
- Search will only take place in the provided fields. Expects a DocumentType and an array of fields. When combined with other search options, like
fetch_fields
, the other fields will be returned but only the specifiedsearch_fields
will be searched when looking for results.
Example - Return documents from the
books
DocumentType that match the query "brothers", searching only within the title
field. 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",
"search_fields":{
"books":["title"]
}
}'
Stuck? Looking for help? Contact support or check out the Site Search community forum!