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 |
halt_on_exception | Indicates if the pipeline should be interrupted in case of an exception | true | boolean | No | 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 |
filters | Name of the key in which the filters will be stored in the intermediate | "filters" | string | No | No |
qpl_enable | Enable QPL to parse the "q" parameter into an engine query with pyQPL | false | boolean | No | Yes |
fields | Fields to be used for matching terms, phrases, spans, etc. | - | array, object, or string | No | Yes |
vector_field_name | Name of the field where we should look for the vector in elasticsearch. This vector usually comes from the Vector Stage. | - | string | Yes | No |
query_type | The type of query to be used when searching for results in elasticsearch. These are SCORE_SCRIPT, BOOLEAN or INNER_HITS (has child). | VectorQueryType.SCORE_SCRIPT | Enum | Yes | No |
child_type_for_inner_hits | Type of the child when using InnerHits Query | - | string | Yes | No |
min_score | Min_score field for SCORE_SCRIPT and INNER_HITS queries | 0.65 | float | Yes | No |
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. |
filters | Calculated filters for search. This with knn parameter get stored on the same variable as a tuple, this is the second parameter of the tuple. |
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
_query_stage = CreateQueryStage( enable=True, save_to_intermediate=True, expand_result=False, halt_on_exception=False, name=QUERY_STAGE_NAME, engine_name='Elasticsearch', filters='filters', qpl_enable=True, vector_field_name='sentence_vector', query_type=VectorQueryType.SCORE_SCRIPT, child_type_for_inner_hits='sentence', min_score=0.7, type='CreateQueryStage', )