Elasticsearch: Add a document with an attachment

This documentation is part of the Ingest attachment plugin guide. View the full guide here: How to extract data from PPT, XLS, and PDF files to Elasticsearch.

👋 Welcome to the Stackhero documentation!

Stackhero offers a ready-to-use Elasticsearch cloud solution that provides a host of benefits, including:

  • Optimal performance and robust security powered by a private and dedicated VM.
  • Customizable domain name secured with HTTPS encryption support.

Save time and simplify your life: it only takes 5 minutes to try Stackhero's Elasticsearch cloud hosting solution!

Now you can index a document that contains an attachment. The document should include a data field that holds the file content encoded in Base64. In this example, the document is an RTF file containing the sentence "This is the content of an RTF file":

PUT my_index/_doc/my_id?pipeline=attachment
{
  "data": "e1xydGYxXGFuc2kKVGhpcyBpcyB0aGUgY29udGVudCBvZiBhIFJURiBmaWxlClxwYXIgfQ=="
}