AWS Kendra get _document_body attribute

491 views Asked by At

I'm trying to query aws kendra but I need to have the document_body in the ResultItem response.

I tried with the RequestedDocumentAttributes param in the QueryCommand but the result still not contains the document body.

const command = new QueryCommand({
    IndexId: 'xxxxxxx',
    QueryText: "How to connect to ec2?",
    RequestedDocumentAttributes: [
        "_document_body",
        "_data_source_id",
        "_last_updated_at"
    ]    
});

Any suggestion?

1

There are 1 answers

0
Kevin Li On BEST ANSWER

_document_body is a special field and Kendra currently does not support returning its entire value in the Query response. Kendra does returns a DocumentExcept for each document ResultItem, which contains the most relevant extract of text in the _document_body.