Analyzing the results

This the analysis of the result:

At a high level, you can see that this JSON document has 5 keys, the QueryID, the ResultItems key that will contain our results, FacetResults which contains the facets (we will dive deeper into this later), TotalNumberOfResults and, finally, ResponseMetadata which contains details about the query itself (for example requestID, date, retry attempts)

In ResultItems, your query results are expressed as a QueryResultItem objects (ResultItems). Each QueryResultItem includes a summary of the result as well as the document attributes associated to the result.

As you saw on the console search, we have 2 Kendra Suggested answers. Suggested answers have the Type attribute with the value ANSWER.

Here are more details of the first result:

As you can see, you are obtaining the details of which parts of the result need to be highlitghted, the DocumentId, The document Title as well as the highlights for it, the DocumentExcerpt with it’s highlights, DocumentAttributes (that in this case contain the excerpt page number) and the ScoreAttributes that contains the ScoreConfidence. Note that Kendra uses confidence buckets (e.g. Very High, High) and not a specifc score.

This is the mapping of a console response with the API response:

If the confidence score is high enough, Kendra will return up to 3 suggested answers from the reading comprehension model. These will have the type ANSWERS and be the first results returned.

If there had been FAQ results from the FAQ model, those would have showed up next. There are up to four FAQ’s returned.

In this case, if you had an FAQ matched in your query results, then the structure of the result will have the order of ANSWER, QUESTION_ANSWER, DOCUMENT.

This is the result mapped:

The results from the Document Ranking model come last. For these results the type is DOCUMENT, this is how it maps: