Search code examples
amazon-web-servicesamazon-kendra

AWS Kendra get _document_body attribute


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?


Solution

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