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 | Query | 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 | |
query | JSON Query DSL as a string representation or a dictionary | string or object | 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 |
filters | Name of the key in which the filters will be stored in the intermediate | "filters" | string | No | No |
aggregations | Name of the key in which the aggregations will be stored in the intermediate | "aggregations" | string | No | No |
aggregations_filters | Name of the key in which the 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 | ||
qpl_enable | Enable QPL to parse the "q" parameter into an engine query with pyQPL | false | boolean | No | Yes |
implicit_operator | Default operator to use when the relationship between two operands is ambiguous | "or" | string | No | Yes |
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 | |
slop_near | Slop value used for the NEAR operator | 10 | number | No | Yes |
slop_before | Slop value used for the BEFORE operator | 2 | number | No | Yes |
slop_adj | Slop value used for the ADJ operator | 0 | number | No | Yes |
slop_span_not | Slop value used for the SPAN NOT operator | 0 | number | No | Yes |
timezone | Coordinated Universal Time (UTC) offset or IANA time zone used to convert date values in the query to UTC | string | No | Yes | |
wildcard | Use wildcard operators | false | boolean | No | Yes |
grammar | File path or raw string representing the grammar for parsing text into QPL | string | No | Yes | |
custom_operators | Dictionary of custom operators with their names as keys and corresponding logic classes as values | object | No | Yes | |
synonyms_call | Function returning requested synonyms for the specified string | Callable(accepts: string, returns: list of string, or None ) | No | Yes |
Anchor | ||||
---|---|---|---|---|
|
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 | Query | No |
sort | Configuration for sort settings in the UI | Query | No |
Anchor | ||||
---|---|---|---|---|
|
Property | Description | Default | Type |
---|---|---|---|
default | Default page size value | 25 | integer |
options | Available page size options | [25, 50, 100] | array of integers |
Anchor | ||||
---|---|---|---|---|
|
Property | Description | Type | Required |
---|---|---|---|
default | Default sort entry | SortEntry | Yes |
options | Available sort options | array of Query | Yes |
Anchor | ||||
---|---|---|---|---|
|
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 | Query or object | Yes |
Anchor | ||||
---|---|---|---|---|
|
Enum Value | Description |
---|---|
"asc" | Ascending sort order |
"desc" | Descending sort order |
Code Block | ||||
---|---|---|---|---|
| ||||
synonyms = { 'cancer': ['cancer', 'malignancy', '363346000', 'cancers', 'malignancies', '"malignant growth"', '"malignant neoplasm"', '"malignant neoplasms"', '"malignant neoplastic disease"', '"malignant tumor"', '"malignant tumors"', '"neoplasm malignant"', '"neoplasm/cancer"', '"tumor, malignant"'], 'headache': ['headache', '25064002', 'cephalalgia', 'cephalgia', 'cephalgias', '"cranial pain"', '"have headaches"', '"head ache"', '"head pain"', '"head pain cephalgia"', '"head pains"', 'headaches', '"mild global headache"', '"mild headache"', '"pain head"', '"pain in head"', '"pain, head"'] } _query_stage = QueryStage( engine_name=DEFAULT_ENGINE_NAME, enable=True, qpl_enable=True, name=SEARCH_STAGE_NAME, index='movies', synonyms_call= lambda x: self.synonyms.get(x, None), # Simple synonym implementation wildcard=False, fields=['title', 'overview', 'url', 'status', 'metadata', 'metadata.production_companies', 'metadata.cast', 'metadata.directors'], range_fields=['metadata.budget'], date_fields=['release_date'], fetch_fields=['title', 'adult', 'overview', 'url', 'release_date', 'status', 'video', 'metadata', 'metadata.production_companies', 'metadata.cast', 'metadata.directors'], exclude_fields=None, implicit_operator='or', page_size_default=25, sort=SortEntry( field='_score', order=SortOrder.DESC ), aggregations=_aggregation_stage.name, aggregations_filters=_aggregation_stage.filters_name, highlight=_highlight_stage.name, filters=_filter_stage.name, ui_only=QueryStageUIConfig( sort=SortConfig( default=SortEntry( field='_score', display_name='Score', order=SortOrder.DESC ), options=[ SortEntry( field='_score', display_name='Score', order=SortOrder.DESC ), SortEntry( field='release_date', display_name='Release Date', order=SortOrder.ASC ), SortEntry( field='metadata.budget', display_name='Budget', order=SortOrder.DESC ) ] ), page_size=PageSizeConfig( default=25, options=[25, 50, 100] ) ) ) |