Copyright | (c) 2013-2023 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Searches an active index. Use this API to search your documents using
query. The Query
API enables to do faceted search and to filter
results based on document attributes.
It also enables you to provide user context that Amazon Kendra uses to enforce document access control in the search results.
Amazon Kendra searches your index for text content and question and answer (FAQ) content. By default the response contains three types of results.
- Relevant passages
- Matching FAQs
- Relevant documents
You can specify that the query return only one type of result using the
QueryResultTypeConfig
parameter.
Each query returns the 100 most relevant results.
Synopsis
- data Query = Query' {
- attributeFilter :: Maybe AttributeFilter
- documentRelevanceOverrideConfigurations :: Maybe [DocumentRelevanceConfiguration]
- facets :: Maybe [Facet]
- pageNumber :: Maybe Int
- pageSize :: Maybe Int
- queryResultTypeFilter :: Maybe QueryResultType
- queryText :: Maybe Text
- requestedDocumentAttributes :: Maybe (NonEmpty Text)
- sortingConfiguration :: Maybe SortingConfiguration
- spellCorrectionConfiguration :: Maybe SpellCorrectionConfiguration
- userContext :: Maybe UserContext
- visitorId :: Maybe Text
- indexId :: Text
- newQuery :: Text -> Query
- query_attributeFilter :: Lens' Query (Maybe AttributeFilter)
- query_documentRelevanceOverrideConfigurations :: Lens' Query (Maybe [DocumentRelevanceConfiguration])
- query_facets :: Lens' Query (Maybe [Facet])
- query_pageNumber :: Lens' Query (Maybe Int)
- query_pageSize :: Lens' Query (Maybe Int)
- query_queryResultTypeFilter :: Lens' Query (Maybe QueryResultType)
- query_queryText :: Lens' Query (Maybe Text)
- query_requestedDocumentAttributes :: Lens' Query (Maybe (NonEmpty Text))
- query_sortingConfiguration :: Lens' Query (Maybe SortingConfiguration)
- query_spellCorrectionConfiguration :: Lens' Query (Maybe SpellCorrectionConfiguration)
- query_userContext :: Lens' Query (Maybe UserContext)
- query_visitorId :: Lens' Query (Maybe Text)
- query_indexId :: Lens' Query Text
- data QueryResponse = QueryResponse' {}
- newQueryResponse :: Int -> QueryResponse
- queryResponse_facetResults :: Lens' QueryResponse (Maybe [FacetResult])
- queryResponse_queryId :: Lens' QueryResponse (Maybe Text)
- queryResponse_resultItems :: Lens' QueryResponse (Maybe [QueryResultItem])
- queryResponse_spellCorrectedQueries :: Lens' QueryResponse (Maybe [SpellCorrectedQuery])
- queryResponse_totalNumberOfResults :: Lens' QueryResponse (Maybe Int)
- queryResponse_warnings :: Lens' QueryResponse (Maybe (NonEmpty Warning))
- queryResponse_httpStatus :: Lens' QueryResponse Int
Creating a Request
See: newQuery
smart constructor.
Query' | |
|
Instances
Create a value of Query
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:attributeFilter:Query'
, query_attributeFilter
- Enables filtered searches based on document attributes. You can only
provide one attribute filter; however, the AndAllFilters
, NotFilter
,
and OrAllFilters
parameters contain a list of other filters.
The AttributeFilter
parameter enables you to create a set of filtering
rules that a document must satisfy to be included in the query results.
$sel:documentRelevanceOverrideConfigurations:Query'
, query_documentRelevanceOverrideConfigurations
- Overrides relevance tuning configurations of fields or attributes set at
the index level.
If you use this API to override the relevance tuning configured at the index level, but there is no relevance tuning configured at the index level, then Amazon Kendra does not apply any relevance tuning.
If there is relevance tuning configured at the index level, but you do not use this API to override any relevance tuning in the index, then Amazon Kendra uses the relevance tuning that is configured at the index level.
If there is relevance tuning configured for fields at the index level, but you use this API to override only some of these fields, then for the fields you did not override, the importance is set to 1.
Query
, query_facets
- An array of documents attributes. Amazon Kendra returns a count for each
attribute key specified. This helps your users narrow their search.
$sel:pageNumber:Query'
, query_pageNumber
- Query results are returned in pages the size of the PageSize
parameter. By default, Amazon Kendra returns the first page of results.
Use this parameter to get result pages after the first one.
$sel:pageSize:Query'
, query_pageSize
- Sets the number of results that are returned in each page of results.
The default page size is 10. The maximum number of results returned is
100. If you ask for more than 100 results, only 100 are returned.
$sel:queryResultTypeFilter:Query'
, query_queryResultTypeFilter
- Sets the type of query. Only results for the specified query type are
returned.
$sel:queryText:Query'
, query_queryText
- The input query text for the search. Amazon Kendra truncates queries at
30 token words, which excludes punctuation and stop words. Truncation
still applies if you use Boolean or more advanced, complex queries.
$sel:requestedDocumentAttributes:Query'
, query_requestedDocumentAttributes
- An array of document attributes to include in the response. You can
limit the response to include certain document attributes. By default
all document attributes are included in the response.
$sel:sortingConfiguration:Query'
, query_sortingConfiguration
- Provides information that determines how the results of the query are
sorted. You can set the field that Amazon Kendra should sort the results
on, and specify whether the results should be sorted in ascending or
descending order. In the case of ties in sorting the results, the
results are sorted by relevance.
If you don't provide sorting configuration, the results are sorted by the relevance that Amazon Kendra determines for the result.
$sel:spellCorrectionConfiguration:Query'
, query_spellCorrectionConfiguration
- Enables suggested spell corrections for queries.
$sel:userContext:Query'
, query_userContext
- The user context token or user and group information.
$sel:visitorId:Query'
, query_visitorId
- Provides an identifier for a specific user. The VisitorId
should be a
unique identifier, such as a GUID. Don't use personally identifiable
information, such as the user's email address, as the VisitorId
.
$sel:indexId:Query'
, query_indexId
- The identifier of the index to search. The identifier is returned in the
response from the CreateIndex
API.
Request Lenses
query_attributeFilter :: Lens' Query (Maybe AttributeFilter) Source #
Enables filtered searches based on document attributes. You can only
provide one attribute filter; however, the AndAllFilters
, NotFilter
,
and OrAllFilters
parameters contain a list of other filters.
The AttributeFilter
parameter enables you to create a set of filtering
rules that a document must satisfy to be included in the query results.
query_documentRelevanceOverrideConfigurations :: Lens' Query (Maybe [DocumentRelevanceConfiguration]) Source #
Overrides relevance tuning configurations of fields or attributes set at the index level.
If you use this API to override the relevance tuning configured at the index level, but there is no relevance tuning configured at the index level, then Amazon Kendra does not apply any relevance tuning.
If there is relevance tuning configured at the index level, but you do not use this API to override any relevance tuning in the index, then Amazon Kendra uses the relevance tuning that is configured at the index level.
If there is relevance tuning configured for fields at the index level, but you use this API to override only some of these fields, then for the fields you did not override, the importance is set to 1.
query_facets :: Lens' Query (Maybe [Facet]) Source #
An array of documents attributes. Amazon Kendra returns a count for each attribute key specified. This helps your users narrow their search.
query_pageNumber :: Lens' Query (Maybe Int) Source #
Query results are returned in pages the size of the PageSize
parameter. By default, Amazon Kendra returns the first page of results.
Use this parameter to get result pages after the first one.
query_pageSize :: Lens' Query (Maybe Int) Source #
Sets the number of results that are returned in each page of results. The default page size is 10. The maximum number of results returned is 100. If you ask for more than 100 results, only 100 are returned.
query_queryResultTypeFilter :: Lens' Query (Maybe QueryResultType) Source #
Sets the type of query. Only results for the specified query type are returned.
query_queryText :: Lens' Query (Maybe Text) Source #
The input query text for the search. Amazon Kendra truncates queries at 30 token words, which excludes punctuation and stop words. Truncation still applies if you use Boolean or more advanced, complex queries.
query_requestedDocumentAttributes :: Lens' Query (Maybe (NonEmpty Text)) Source #
An array of document attributes to include in the response. You can limit the response to include certain document attributes. By default all document attributes are included in the response.
query_sortingConfiguration :: Lens' Query (Maybe SortingConfiguration) Source #
Provides information that determines how the results of the query are sorted. You can set the field that Amazon Kendra should sort the results on, and specify whether the results should be sorted in ascending or descending order. In the case of ties in sorting the results, the results are sorted by relevance.
If you don't provide sorting configuration, the results are sorted by the relevance that Amazon Kendra determines for the result.
query_spellCorrectionConfiguration :: Lens' Query (Maybe SpellCorrectionConfiguration) Source #
Enables suggested spell corrections for queries.
query_userContext :: Lens' Query (Maybe UserContext) Source #
The user context token or user and group information.
query_visitorId :: Lens' Query (Maybe Text) Source #
Provides an identifier for a specific user. The VisitorId
should be a
unique identifier, such as a GUID. Don't use personally identifiable
information, such as the user's email address, as the VisitorId
.
query_indexId :: Lens' Query Text Source #
The identifier of the index to search. The identifier is returned in the
response from the CreateIndex
API.
Destructuring the Response
data QueryResponse Source #
See: newQueryResponse
smart constructor.
QueryResponse' | |
|
Instances
Create a value of QueryResponse
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
QueryResponse
, queryResponse_facetResults
- Contains the facet results. A FacetResult
contains the counts for each
attribute key that was specified in the Facets
input parameter.
$sel:queryId:QueryResponse'
, queryResponse_queryId
- The identifier for the search. You use QueryId
to identify the search
when using the feedback API.
$sel:resultItems:QueryResponse'
, queryResponse_resultItems
- The results of the search.
$sel:spellCorrectedQueries:QueryResponse'
, queryResponse_spellCorrectedQueries
- A list of information related to suggested spell corrections for a
query.
$sel:totalNumberOfResults:QueryResponse'
, queryResponse_totalNumberOfResults
- The total number of items found by the search; however, you can only
retrieve up to 100 items. For example, if the search found 192 items,
you can only retrieve the first 100 of the items.
$sel:warnings:QueryResponse'
, queryResponse_warnings
- A list of warning codes and their messages on problems with your query.
Amazon Kendra currently only supports one type of warning, which is a warning on invalid syntax used in the query. For examples of invalid query syntax, see Searching with advanced query syntax.
$sel:httpStatus:QueryResponse'
, queryResponse_httpStatus
- The response's http status code.
Response Lenses
queryResponse_facetResults :: Lens' QueryResponse (Maybe [FacetResult]) Source #
Contains the facet results. A FacetResult
contains the counts for each
attribute key that was specified in the Facets
input parameter.
queryResponse_queryId :: Lens' QueryResponse (Maybe Text) Source #
The identifier for the search. You use QueryId
to identify the search
when using the feedback API.
queryResponse_resultItems :: Lens' QueryResponse (Maybe [QueryResultItem]) Source #
The results of the search.
queryResponse_spellCorrectedQueries :: Lens' QueryResponse (Maybe [SpellCorrectedQuery]) Source #
A list of information related to suggested spell corrections for a query.
queryResponse_totalNumberOfResults :: Lens' QueryResponse (Maybe Int) Source #
The total number of items found by the search; however, you can only retrieve up to 100 items. For example, if the search found 192 items, you can only retrieve the first 100 of the items.
queryResponse_warnings :: Lens' QueryResponse (Maybe (NonEmpty Warning)) Source #
A list of warning codes and their messages on problems with your query.
Amazon Kendra currently only supports one type of warning, which is a warning on invalid syntax used in the query. For examples of invalid query syntax, see Searching with advanced query syntax.
queryResponse_httpStatus :: Lens' QueryResponse Int Source #
The response's http status code.