Using facets in a query

Back on teh facets configuration screen for your index, mark only the _category field:

As you can see, now you have an additional key in your response called FacetResults that contains the facet values for the documents in the response.

This is how the results map from Kendra’s search console:

If you were to filter your documents by using the category General you would have to modify your query to look like this:

response=kendra.query(
        QueryText = query,
        IndexId = index_id,
        AttributeFilter = {'AndAllFilters': 
            [ 
                {"EqualsTo": {"Key": "_category","Value": {"StringValue": "General"}}},
            ]
            }
        )

And you will obtain the following result:

Now, you may ask, what would happen if I try to apply a filter for an attribute that is not Facetable. This is the result I got after disabling _category as Facetable.

Amazon Kendra still applied the filter but no FacetResults are returned.