Property | Description | Default | Type | Required | QPL Config? |
---|---|---|---|---|---|
type | Stage class name | - | string | Yes | No |
enable | Enable stage for execution | true | boolean | No | No |
name | Name for this specific stage | "search" | string | No | No |
save_to_intermediate | If true, the result of the stage will be stored in the intermediate instead of the final section | false | boolean | No | No |
expand_result | Indicates if the result of this stage should be expanded into the final data dictionary instead of being appended as usual | false | boolean | No | No |
ui_only | Section specific for UI configuration that affects the process of the stage | Semantic Search | QueryStageUIConfig | No | No |
halt_on_exception | Indicates if the pipeline should be interrupted in case of an exception | true | boolean | No | No |
index | Name of the index or alias in which to perform the query | - | string or array of strings | Yes | No |
engine_name | Name of the engine to use for this query. If none is provided, the default engine will be used | - | string | No | No |
size | Number of hits to return per request | - | integer | No | No |
sort | Sort configuration for the query results | - | array or object | No | No |
page_size_default | Default page size for pagination | 25 | integer | No | No |
operator | The default operator for query string query: AND or OR | "or" | string | No | No |
highlight | Name of the key in which the highlights will be stored in the intermediate | "highlight" | string | No | No |
aggregations | Name of the key in which the engine specific aggregations will be stored in the intermediate | "aggregations" | string | No | No |
aggregations_filters | Name of the key in which the engine specific aggregation filters will be stored in the intermediate | "aggregations_filters" | string | No | No |
fetch_fields | List of fields to fetch | - | array of strings | No | |
exclude_fields | List of fields to exclude | - | array of strings | No | |
fields | Fields to be used for matching terms, phrases, spans, etc. | - | array, object, or string | Yes | Yes |
date_fields | Fields to be used for date ranges | - | array, object, or string | No | Yes |
range_fields | Fields to be used for ranges | - | array, object, or string | No | Yes |
date_format | Date format used to convert date values in the query | - | string | No | Yes |
The Query Stage offers a range of parameters that can be passed via the intermediate input to customize your search request or modify the configuration of the current stage. These parameters provide flexibility and control over the search process.
Parameter | Description |
---|---|
q | A string query for performing a search. Can be transformed into engine-specific queries using PyQPL (Query Parser Language). |
query | Engine-specific queries for the search. |
knn | Engine-specific queries specifically for k-nearest neighbor (KNN) searches. |
size | Number of results to return from the search request. Overrides the size specified in the configuration. |
from/start | Indicates the starting point for retrieving search results. Can be used interchangeably with the page parameter. |
page | It can be an alternative to from/start. It calculates the start based on the size parameter |
fetch_fields | List of fields to fetch for each search result. Overrides the fields specified in the configuration. |
exclude_fields | List of fields to exclude from the search results. Overrides the fields specified in the configuration. |
scroll | Scroll ID used to retrieve large numbers of results from a single search request, similar to a cursor in a traditional database. |
operator | The default operator for query string queries: AND or OR . Overrides the default operator specified in the configuration. |
vector | Calculated vectors use to create the knn query. |
Remember that the intermediate can be fill with either other stages or the original request body that trigger the pipeline, making this essentially REST API parameters
The QueryStageUIConfig is a configuration object that provides UI-specific settings for the QueryStage.
Property | Description | Default | Type |
---|---|---|---|
page_size | Configuration for page size settings in the UI | Semantic Search | No |
sort | Configuration for sort settings in the UI | Semantic Search | No |
Property | Description | Default | Type |
---|---|---|---|
default | Default page size value | 25 | integer |
options | Available page size options | [25, 50, 100] | array of integers |
Property | Description | Type | Required |
---|---|---|---|
default | Default sort entry | SortEntry | Yes |
options | Available sort options | array of Semantic Search | Yes |
Property | Description | Type | Required |
---|---|---|---|
field | Name of the field to be used for sorting | string | Yes |
display_name | Display name for this sort entry (only applicable for user interface) | string | No |
order | Sort order to be used | Semantic Search or object | Yes |
Enum Value | Description |
---|---|
"asc" | Ascending sort order |
"desc" | Descending sort order |
_search_stage = SemanticSearchStage( enable=True, save_to_intermediate=True, expand_result=False, halt_on_exception=False, name=SEARCH_STAGE_NAME, engine_name='Elasticsearch', index='movies', sort=None, page_size_default=25, fetch_fields=[ 'title', 'overview' ], ui_only=SemanticSearchStageUIConfig( sort=SortConfig( default=SortEntry( field='_score', display_name='Score', order=SortOrder.DESC ), options=[ SortEntry( field='_score', display_name='Best Match', order=SortOrder.DESC ), SortEntry( field='title', display_name='Alphabetical: A to Z', order=SortOrder.ASC ), SortEntry( field='title', display_name='Alphabetical: Z to A', order=SortOrder.DESC ) ] ), page_size=PageSizeConfig( default=25, options=[25, 50, 100] ) ), exclude_fields=None, fields=[ 'title', 'overview' ], type='SemanticSearchStage' )