Refer to the Query API guide for API examples.
All the request parameters listed below can be set in query profiles. The first four blocks of properties are also modeled as query profile types. These types can be referred from query profiles (and inheriting types) to provide type checking on the parameters.
These parameters often have both a full name - including the path from the root query profile - and one or more abbreviated names. Both names can be used in requests, while only full names can be used in query profiles. The full names are case-sensitive, abbreviated names are case-insensitive.
The parameters modeled as query profiles are also available through get methods as Java objects from the Query to Searcher components.
Parameter | Alias | Type | Default | Description |
---|---|---|---|---|
yql | String |
See the YQL query guide for examples, and the reference for details. |
These parameters are defined in the native
query profile type.
Parameter | Alias | Type | Default | Description |
---|---|---|---|---|
hits | count | Number | 10 |
A positive integer, including 0. The maximum number of hits to return from the result set.
Number of hits can also be set in YQL. |
offset | start | Number | 0 |
To implement pagination: The number of hits to skip when returning the result. A positive integer, including 0.
Offset can also be set in YQL. |
queryProfile | String | default |
A query profile id with format |
|
groupingSessionCache | Boolean | true |
Set to true to enable grouping session cache. See the grouping reference for details. |
|
searchChain | String | default |
A search chain id with format |
|
timeout | String | 0.5s |
Positive floating point number with an optional unit. Default unit is seconds (s), valid unit strings are e.g. ms and s. To set a timeout of one minute, the argument could be set to 60 s. Space between the number and the unit is optional. It specifies the overall timeout of the query execution and can be defined in a query profile. Different classes of queries can then easily have a different latency budget/timeout using different profiles. At timeout, the hits generated thus far are returned, refer to ranking.softtimeout.enable for details on HTTP status codes and response elements. Refer to the Query API guide for more details on timeout handling. |
Parameter | Alias | Type | Default | Description |
---|---|---|---|---|
model.defaultIndex | default-index | String | default |
An index name. The field which is searched for query terms which doesn't explicitly specify an index. Also see the defaultIndex query annotation. |
model.encoding | encoding | String | utf-8 |
Encoding names or aliases defined in the IANA character sets. Sets the encoding to use when returning a result. The query is always encoded as UTF-8, independently of how the result will be encoded.
The encodings |
model.filter | filter | String |
A filter string in the Simple Query Language. Sets a filter to be combined with the model.queryString. Typical use of a filter is to add machine generated or preferences based filter terms to the user query.
Terms which are passed in the filter are not bolded.
The filter is parsed the same way as a query of type Consider using query profiles to add filters to the YQL string, example. |
|
model.locale | locale | String |
A language tag from RFC 5646.
Sets the locale and language to use when parsing queries from a language tag, such as |
|
model.language | lang, language | String |
A language tag from RFC 5646, but allowing underscore instead of dash as separator character. A legacy alternative to locale. When this value is accessed, underscores will be replaced by dashes in the returned value. Also see the language query term annotation. |
|
model.queryString | query | String |
A query string in the Simple Query Language. It is combined with model.filter. See the userQuery operator for how to combine with YQL. Can also be used without YQL. |
|
model.restrict | restrict | String |
A comma-delimited list of document type (schema) names, defaulting to all schemas if not set. See multiple schemas and federation. Use model.sources to restrict to content cluster names or other source names. |
|
model.searchPath | searchpath | String |
Specification of which content nodes a query should be sent to. This is useful for debugging/monitoring and when using Rank phase statistics. Note that in a content cluster with flat distribution (i.e. no <group> element in services.xml), there is 1 implicit group. If not set, defaults to all nodes in one group, selected by load balancing.
Examples:
|
|
model.sources | search, sources | String |
A comma-separated list of content cluster names or other source names, defaulting to all sources/clusters if not set. The names of the sources to query, e.g. one or more content clusters and/or federated sources - see content cluster mapping. Also see federation. Use model.restrict to restrict to schemas. |
|
model.type | type | String | weakAnd |
Selects the query language syntax of the
model.queryString parameter:
|
Parameter | Alias | Type | Default | Description |
---|---|---|---|---|
ranking.location | String |
See Geo search. Point (two-dimensional location) to use as base for location ranking.
Deprecated:
Deprecated in favor of adding a
geoLocation
item to the query tree.
Use inside a rank operator
if it should be used only for ranking).
|
||
ranking.features .featurename |
input .featurename, rankfeature .featurename |
String |
Set a query rank feature input to a value.
The key must be a query feature -
|
|
ranking.listFeatures | rankfeatures | Boolean | false |
Set to true to request all rank-features to be calculated and returned. The rank features will be returned in the summary field rankfeatures. This option is typically used for MLR training, should not to be used for production. |
ranking.profile | ranking | String | default |
Sets rank profile
to use for assigning rank scores for documents.
The |
ranking.properties .propertyname |
rankproperty .propertyname |
String |
Set a rank property
that is passed to, and used by a feature executor for this query.
Example: |
|
ranking.softtimeout .enable |
Boolean | true |
By default, the hits available are returned on timeout.
To return no hits at timeout instead, set
Softtimeout uses
The factor is adaptive, per rank profile -
the factor is adjusted based on remaining time after all ranking phases,
unless overridden in the query using A timeout element is returned in the query response at timeout.
Example: query with 500ms timeout, use 300ms in first-phase ranking:
The
The container might respond with a timeout error with HTTP response code 504 even with soft timeout enabled if the timeout is set so low that the query does not make it to the content nodes, or the container does not have any time left after input and query processing to dispatch the query to the content nodes. Read more about soft timeout in coverage degradation. |
|
ranking.softtimeout .factor |
Number | 0.7 | ||
ranking.sorting | sorting | String |
A valid sort specification. Fields you want to sort on must be stored as document attributes in the index structure by adding attribute to the indexing statement. |
|
ranking.significance.useModel | Boolean | false |
Enables or disables the use of significance models specified in service.xml. Overrides use-model set in the rank profile. |
|
ranking.freshness | String |
Sets the time which will be used as now during execution.
|
||
ranking.queryCache | Boolean | false |
Turns query cache on or off. Query is a two-phase process. If the query cache is on, the query is stored on the content nodes between the first and second phase, saving network bandwidth and also query setup time, at the expense of using more memory. It only affects the protocol phase two, see caches in Vespa. It does not cache the result, it just saves resources by not forwarding the query twice (one for the first protocol phase which is find the best k documents from all nodes, to the second phase which is to fill summary data and potentially ranking features listed in summary-features in the rank profile). The summary-features are re-calculated but this setting avoids sending the query down once more. There is little downside of using it, and it can save resources and latency in cases where the query tree and query ranking features (e.g. tensors used in ranking) are large. As this is a protocol optimization, it also works with changing filter, it's not cached cross independent queries, it's just saving having to send the same query twice. |
|
ranking.rerankCount | Number |
Specifies the number of hits that should be ranked in the second ranking phase. Overrides the rerank-count set in the rank profile. |
||
ranking.keepRankCount | Number |
Specifies the number of hits that should keep rank value. Overrides the keep-rank-count set in the rank profile. |
||
ranking.rankScoreDropLimit | Number |
Minimum rankscore for a document to be considered a hit. Overrides the rank-score-drop-limit set in the rank profile. |
||
ranking.secondphase.rankscoredroplimit | Number |
Minimum rank score for a document to be considered a hit after second phase reranking or rescoring. Overrides the second phase rank-score-drop-limit set in the rank profile. |
||
ranking.globalPhase.rerankCount | Number |
Specifies the number of hits that should be re-ranked in the global ranking phase. Overrides the rerank-count set in the rank profile. |
Settings to control behavior during matching of query evaluation. If these are set in the query, they will override any equivalent settings in the rank profile. Detailed descriptions are found in the rank profile documentation.
Parameter | Alias | Type | Default | Description |
---|---|---|---|---|
ranking.matching .numThreadsPerSearch |
integer |
Rank profile equivalent: num-threads-per-search Overrides the global persearch threads to a lower value. |
||
ranking.matching .minHitsPerThread |
integer |
Rank profile equivalent: min-hits-per-thread After estimating the number of hits for a query, this number is used to decide how many search threads to use. |
||
ranking.matching .numSearchPartitions |
integer |
Rank profile equivalent: num-search-partitions Number of logical partitions the corpus on a content node is divided in. A partition is the smallest unit a search thread will handle. |
||
ranking.matching .termwiseLimit |
double [0.0, 1.0] |
Rank profile equivalent: termwise-limit If estimated number of hits > corpus * termwise-limit, document candidates are pruned with a TAAT evaluation for query terms not needed for ranking. |
||
ranking.matching .postFilterThreshold |
double [0.0, 1.0] |
Rank profile equivalent: post-filter-threshold Threshold value deciding if a query with an approximate nearestNeighbor operator combined with filters is evaluated using post-filtering. |
||
ranking.matching .approximateThreshold |
double [0.0, 1.0] |
Rank profile equivalent: approximate-threshold Threshold value deciding if a query with an approximate nearestNeighbor operator combined with filters is evaluated by searching for approximate or exact nearest neighbors. |
||
ranking.matching .targetHitsMaxAdjustmentFactor |
double [1.0, inf] |
Rank profile equivalent: target-hits-max-adjustment-factor Value used to control the auto-adjustment of targetHits used when evaluating an approximate nearestNeighbor operator with post-filtering. |
Settings to control behavior during the match phase of query evaluation. If these are set in the query, they will override any match-phase settings in the rank profile. Detailed descriptions are found in the rank profile documentation.
Parameter | Alias | Type | Default | Description |
---|---|---|---|---|
ranking.matchPhase .attribute |
string |
Rank profile equivalent: match-phase: attribute The attribute used to limit matches by if more than maxHits hits will be produced. |
||
ranking.matchPhase .maxHits |
long |
Rank profile equivalent: match-phase: max-hits The max number of hits that should be generated on each content node during the match phase. |
||
ranking.matchPhase .ascending |
boolean |
Rank profile equivalent: match-phase: order Whether to keep the documents having the highest (false) or lowest (true) values of the match phase attribute. |
||
ranking.matchPhase .diversity.attribute |
string |
Rank profile equivalent: diversity: attribute The attribute to use when deciding diversity. |
||
ranking.matchPhase .diversity.minGroups |
long |
Rank profile equivalent: diversity: min-groups The minimum number of groups that should be returned from the match phase grouped by the diversity attribute. |
Parameter | Alias | Type | Default | Description |
---|---|---|---|---|
dispatch.topKProbability | double |
Probability to use when computing how many hits to fetch from each partition when merging and creating the final result set. See services for details. Default: none. |
Parameter | Alias | Type | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
presentation.bolding | bolding | Boolean | true |
Whether to bold query terms in schema fields defined with bolding: on or summary: dynamic. |
||||||||||||
presentation.format | format | String | default |
|
||||||||||||
presentation.summary | summary | String |
The name of the summary class used to select fields in results. Default: The default summary class of the schema. |
|||||||||||||
presentation.template | String |
The id of a deployed page template to use for this result. This should be used with the page result format. |
||||||||||||||
presentation.timing | Boolean | false |
Whether a result renderer should try to add optional timing information to the rendered page - see the result reference. |
|||||||||||||
presentation.format.tensors | String | short |
Controls how tensors are rendered in the result.
|
Parameter | Alias | Type | Default | Description |
---|---|---|---|---|
select | String |
Requests specific multi-level result set statistics and/or hit groups to be returned in the result. Fields you want to retrieve statistics or hit groups for must be stored as document attributes in the index structure by adding attribute to the indexing statement. Default is no grouping. See the grouping guide for examples. |
||
collapsefield | String |
Comma-separated list of field names, that should only appear uniquely in a result. Hits with values in these fields which are already present in a higher-ranked hit will be filtered out. Read more in result diversity to compare this with other options. Default is no field collapsing. |
||
collapsesize | Number | 1 |
The number of hits to keep in each collapsed bucket - used for all collapsefields. |
|
collapsesize.fieldname | Number | 1 |
The number of hits to keep in each collapsed bucket - used for the specified field.
This value takes precedence over the value specified in |
|
collapse.summary | String |
A valid name of a document summary class. Use this summary class to fetch the fields used for collapsing. Default: Use default summary or attributes. |
||
grouping.defaultMaxGroups | Number | 10 |
Positive integer or The default number of groups to return when max is not specified. |
|
grouping.defaultMaxHits | Number | 10 |
Positive integer or The default number of hits to return when max is not specified. |
|
grouping.globalMaxGroups | Number | 10000 |
Positive integer or
A cost limit for grouping queries.
Any query that may exceed this threshold will be preemptively failed by the container.
The limit is defined as the total number of groups and document summaries a query may produce.
A query that does not have an implicit or explicit See the grouping guide for practical examples. |
|
grouping.defaultPrecisionFactor | Decimal number |
2.0 |
The default precision scale factor when
precision is not specified.
The final precision value is calculated by multiplying the effective |
Parameters for streaming search mode.
Parameter | Alias | Type | Default | Description |
---|---|---|---|---|
streaming.groupname | A string |
Sets the group (specified by g=<groupname>) of the documents to stream through. |
||
streaming.selection | A document selection |
Restricts streaming search using a selection expression instead of a group id.
If the selection is on the form If any other selection is used, this will stream through all groups, which is very costly. |
||
streaming.maxbucketspervisitor | An integer | Positive infinity |
If set, limit backend bucket concurrency to the specified number of buckets. Can be used to explicitly control resource usage for extremely large streaming search locations. This is an expert option. |
Parameters controlling trace information returning with the result for diagnostics.
Parameter | Alias | Type | Default | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
trace.level | tracelevel | Number | 0 |
A positive number. Default is no tracing. Collect trace information for debugging when running a query. Higher numbers give progressively more detail on query transformations, searcher execution and content node(s) query execution. See query tracing for details and examples. Tracing is subject to change at any time, the below is a guide:
|
||||||||||||||||
trace.explainLevel | explainlevel | Number | 0 |
Set to a positive number to collect query execution information for debugging when running a query. Higher numbers give progressively more detail on content node query execution. Tuning this parameter is useful if we want to get more information from the content nodes without gathering lots of trace information from the container chain. Explanation is subject to change at any time, the below is a guide:
Note that you might get the same at trace.level 5 and above. Default is no explanation. Tracing with |
||||||||||||||||
trace.profileDepth | Number | 0 |
Turns on performance profiling of the content node query execution for
matching,
first-phase ranking, and
second-phase ranking.
How profiling is performed is based on whether
The performance profiling output is subject to change at any time. Default is no information. Tracing with |
|||||||||||||||||
trace.profiling.matching.depth | Number | 0 |
Turns on profiling of matching of the content node query execution. This exposes information about how time spent on matching is distributed between individual search iterators. The profiling output is tagged match_profiling and is subject to change at any time. Default is no information. See trace.profileDepth for semantics of this parameter. Tracing with |
|||||||||||||||||
trace.profiling.firstPhaseRanking.depth | Number | 0 |
Turns on profiling of the first-phase ranking of the content node query execution. This exposes information about how time spent on first-phase ranking is distributed between individual rank features. The profiling output is tagged first_phase_profiling and is subject to change at any time. Default is no information. See trace.profileDepth for semantics of this parameter. Tracing with |
|||||||||||||||||
trace.profiling.secondPhaseRanking.depth | Number | 0 |
Turns on profiling of the second-phase ranking of the content node query execution. This exposes information about how time spent on second-phase ranking is distributed between individual rank features. The profiling output is tagged second_phase_profiling and is subject to change at any time. Default is no information. See trace.profileDepth for semantics of this parameter. Tracing with |
|||||||||||||||||
trace.timestamps | Boolean | false |
Enable to get timing information already at trace.level=1. This is useful for debugging latency spent at different components in the container search chain without rendering a lot of string data which is associated with higher trace levels. |
|||||||||||||||||
trace.query | Boolean | true |
Whether to include the query in any trace messages. This is useful for avoiding query serialization with very large queries to avoid impact from it on performance and excessively large traces. |
Refer to semantic rules.
Parameter | Alias | Type | Default | Description |
---|---|---|---|---|
rules.off | Boolean | true |
Turn rule evaluation off for this query. |
|
rules.rulebase | String |
A rule base name - the name of the rule base to use for these queries. |
||
tracelevel.rules | Number |
The amount of rule evaluation trace output to show, higher number means more details. This is useful to see a trace from rule evaluation without having to see trace from all other searchers at the same time. |
Parameter | Alias | Type | Default | Description |
---|---|---|---|---|
recall | String |
Any allowed collection of recall terms. Sets a recall parameter to be combined with the query. This is identical to filter, except that recall terms are not exposed to the ranking framework and thus not ranked. As such, one can not use unprefixed terms; they must either be positive or negative. |
||
user | String |
The id of the user making the query. The content of the argument is made available to the search chain, but it triggers no features in Vespa apart from being propagated to the access log. |
||
hitcountestimate | Boolean | false |
Make this an estimation query. No hits will be returned, and total hit count will be set to an estimate of what executing the query as a normal query would give. |
|
metrics.ignore | Boolean | false |
Ignore metric collection for this query request, useful for warm-up queries. |
|
weakAnd.replace | Boolean | false |
Replace all instances of OR in the query tree with weakAnd. |
|
wand.hits | Number | 100 |
Used in combination with weakAnd.replace. Sets the targetHits of the new weakAnds to the specified value. |
|
sorting.degrading | Boolean | true |
When sorting on a single-value numeric attribute with fast-search
an optimization is activated to return early, with an inaccurate total-hits count.
Set
This optimization sets the primary sorting attribute as the
match phase attribute, and
match phase maxHits equal to
|
|
noCache | nocache | Boolean | false |
Sets whether this query should never be served from a cache. Vespa has few caches, and this parameter does not control any of them. Therefore, this parameter has no effect |
The status code rules are:
WEB SERVICE ERROR CODES:
200, 301, 302, 307, 400, 401, 403, 404, 405, 406, 408, 428, 429, 431, 500, 501, 502, 511
HTTP COMPATIBLE ERROR CODES:
com.yahoo.container.protect.Error.BAD_REQUEST -> Http code 400 com.yahoo.container.protect.Error.UNAUTHORIZED -> Http code 401 com.yahoo.container.protect.Error.FORBIDDEN -> Http code 403 com.yahoo.container.protect.Error.NOT_FOUND -> Http code 404 com.yahoo.container.protect.Error.INTERNAL_SERVER_ERROR -> Http code 500 com.yahoo.container.protect.Error.INSUFFICIENT_STORAGE -> Http code 507
A select
query is equivalent in structure to YQL, written in JSON.
Contains subparameters where
and grouping
.
Parameter | Alias | Type | Default | Description |
---|---|---|---|---|
where | String |
A string with JSON. Refer to the select reference for details. |
||
grouping | String |
A string with JSON. Refer to the select reference for details. |