- App Search Guide: other versions:
- Installation
- Getting started
- Authentication
- Limits
- Users and access
- Guides
- Adaptive relevance events logs reference
- Analytics Tags
- Crawl web content
- Crawl a private network using a web crawler on Elastic Cloud
- Crawl custom fields using proxy
- Curations
- Elasticsearch search
- Elasticsearch index engines
- Create Elasticsearch index engines
- Configure dynamic field mappings and analyzers in an Elasticsearch index engine
- Elasticsearch engines text field conventions
- Facets
- Hierarchical Facets
- Indexing Documents
- Language Optimization
- Log settings
- Meta Engines
- Precision tuning (beta)
- Query Suggestions
- Search UI
- Relevance Tuning
- Result Settings
- Result Suggestions
- Role based access control (RBAC)
- Sanitization, Raw or Snippet
- Search
- Synonyms
- View web crawler events logs
- App Search web crawler
- Web crawler FAQ
- Web crawler reference
- Web crawler events logs reference
- API Reference
- Adaptive relevance API reference (beta)
- Analytics APIs
- Analytics clicks API
- Analytics counts API
- Analytics queries API
- API logs API
- Click API
- Credentials API
- Curations API reference
- Documents API
- Elasticsearch search API
- Engines API
- Log settings API
- Multi search API
- Query suggestion API
- Schema API
- Search API
- Search API boosts
- Search API facets
- Search API filters
- Search API group
- Search API precision (beta)
- Search API result fields
- Search API search fields
- Search API sort
- Search API analytics tags
- Search settings API
- Search Explain API
- Source engines API
- Synonyms API
- Web crawler API reference
- API Clients
- Configuration
- Known issues
- Troubleshooting
Search API search fields
editSearch API search fields
editLearn more about Weights within the Relevance Tuning guide.
The search_fields
parameter restricts a query to search only specific fields.
Restricting fields will result in faster queries, especially for schemas with many text fields.
Only available within text fields.
-
query
(required) - A string or number used to find related documents. See here for more details.
-
search_fields
(required) - Send in a search_fields object with your query.
-
fields
(optional) - Fields must exist within your Engine schema and be of type text.
-
weight
(optional) -
Weight is given between 10 (most relevant) to 1 (least relevant). You can also set
weight
to 0 to make the field unsearchable at query time.
Example - Specifying search_fields
for a given query.
curl -X POST '<ENTERPRISE_SEARCH_BASE_URL>/api/as/v1/engines/national-parks-demo/search' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer search-soaewu2ye6uc45dr8mcd54v8' \ -d '{ "search_fields": { "title": {}, "description": {}, "states": {} }, "query": "everglade" }'
Search Fields with Weight
editApply Weights to each search field.
Engine level Weight settings will be applied is none are provided.
Query time Weights take precedence over Engine level values.
Example - Specifying weights to favor the park title
, followed by its description
, and then their states
.
curl -X GET '<ENTERPRISE_SEARCH_BASE_URL>/api/as/v1/engines/national-parks-demo/search' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer search-soaewu2ye6uc45dr8mcd54v8' \ -d '{ "search_fields": { "title": { "weight": 10 }, "description": { "weight": 5 }, "states": { "weight": 3 } }, "query": "everglade" }'
Errors
edit
|
If a requested search field does not exist in the current schema. If a search field JSON object is malformed. It must be an empty JSON object or a JSON object with a |
On this page