amazonka-kendra-2.0: Amazon KendraFrontendService SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.Kendra.Query

Description

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

Creating a Request

data Query Source #

See: newQuery smart constructor.

Constructors

Query' 

Fields

  • attributeFilter :: Maybe 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.

  • documentRelevanceOverrideConfigurations :: Maybe [DocumentRelevanceConfiguration]

    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.

  • facets :: Maybe [Facet]

    An array of documents attributes. Amazon Kendra returns a count for each attribute key specified. This helps your users narrow their search.

  • pageNumber :: Maybe Int

    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.

  • pageSize :: Maybe Int

    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.

  • queryResultTypeFilter :: Maybe QueryResultType

    Sets the type of query. Only results for the specified query type are returned.

  • queryText :: Maybe Text

    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.

  • requestedDocumentAttributes :: Maybe (NonEmpty Text)

    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.

  • sortingConfiguration :: Maybe 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.

  • spellCorrectionConfiguration :: Maybe SpellCorrectionConfiguration

    Enables suggested spell corrections for queries.

  • userContext :: Maybe UserContext

    The user context token or user and group information.

  • visitorId :: Maybe Text

    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.

  • indexId :: Text

    The identifier of the index to search. The identifier is returned in the response from the CreateIndex API.

Instances

Instances details
ToJSON Query Source # 
Instance details

Defined in Amazonka.Kendra.Query

ToHeaders Query Source # 
Instance details

Defined in Amazonka.Kendra.Query

Methods

toHeaders :: Query -> [Header] #

ToPath Query Source # 
Instance details

Defined in Amazonka.Kendra.Query

Methods

toPath :: Query -> ByteString #

ToQuery Query Source # 
Instance details

Defined in Amazonka.Kendra.Query

Methods

toQuery :: Query -> QueryString #

AWSRequest Query Source # 
Instance details

Defined in Amazonka.Kendra.Query

Associated Types

type AWSResponse Query #

Generic Query Source # 
Instance details

Defined in Amazonka.Kendra.Query

Associated Types

type Rep Query :: Type -> Type #

Methods

from :: Query -> Rep Query x #

to :: Rep Query x -> Query #

Read Query Source # 
Instance details

Defined in Amazonka.Kendra.Query

Show Query Source # 
Instance details

Defined in Amazonka.Kendra.Query

Methods

showsPrec :: Int -> Query -> ShowS #

show :: Query -> String #

showList :: [Query] -> ShowS #

NFData Query Source # 
Instance details

Defined in Amazonka.Kendra.Query

Methods

rnf :: Query -> () #

Eq Query Source # 
Instance details

Defined in Amazonka.Kendra.Query

Methods

(==) :: Query -> Query -> Bool #

(/=) :: Query -> Query -> Bool #

Hashable Query Source # 
Instance details

Defined in Amazonka.Kendra.Query

Methods

hashWithSalt :: Int -> Query -> Int #

hash :: Query -> Int #

type AWSResponse Query Source # 
Instance details

Defined in Amazonka.Kendra.Query

type Rep Query Source # 
Instance details

Defined in Amazonka.Kendra.Query

type Rep Query = D1 ('MetaData "Query" "Amazonka.Kendra.Query" "amazonka-kendra-2.0-IHloXAWlYIS8YTp1gXe6J" 'False) (C1 ('MetaCons "Query'" 'PrefixI 'True) (((S1 ('MetaSel ('Just "attributeFilter") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe AttributeFilter)) :*: (S1 ('MetaSel ('Just "documentRelevanceOverrideConfigurations") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [DocumentRelevanceConfiguration])) :*: S1 ('MetaSel ('Just "facets") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [Facet])))) :*: (S1 ('MetaSel ('Just "pageNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int)) :*: (S1 ('MetaSel ('Just "pageSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "queryResultTypeFilter") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe QueryResultType))))) :*: ((S1 ('MetaSel ('Just "queryText") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "requestedDocumentAttributes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (NonEmpty Text))) :*: S1 ('MetaSel ('Just "sortingConfiguration") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe SortingConfiguration)))) :*: ((S1 ('MetaSel ('Just "spellCorrectionConfiguration") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe SpellCorrectionConfiguration)) :*: S1 ('MetaSel ('Just "userContext") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe UserContext))) :*: (S1 ('MetaSel ('Just "visitorId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "indexId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))))))

newQuery Source #

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.

Constructors

QueryResponse' 

Fields

Instances

Instances details
Generic QueryResponse Source # 
Instance details

Defined in Amazonka.Kendra.Query

Associated Types

type Rep QueryResponse :: Type -> Type #

Read QueryResponse Source # 
Instance details

Defined in Amazonka.Kendra.Query

Show QueryResponse Source # 
Instance details

Defined in Amazonka.Kendra.Query

NFData QueryResponse Source # 
Instance details

Defined in Amazonka.Kendra.Query

Methods

rnf :: QueryResponse -> () #

Eq QueryResponse Source # 
Instance details

Defined in Amazonka.Kendra.Query

type Rep QueryResponse Source # 
Instance details

Defined in Amazonka.Kendra.Query

newQueryResponse Source #

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_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.