# How to index PDF file data and search data from attachment PDF file

**URL:** <https://discuss.elastic.co/t/how-to-index-pdf-file-data-and-search-data-from-attachment-pdf-file/265565>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [February 26, 2021, 5:11am UTC](https://discuss.elastic.co/t/how-to-index-pdf-file-data-and-search-data-from-attachment-pdf-file/265565 "2021-02-26T05:11:56Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 26, 2021, 10:31am UTC](https://discuss.elastic.co/t/how-to-index-pdf-file-data-and-search-data-from-attachment-pdf-file/265565/6 "2021-02-26T10:31:18Z")

</div>

So you need to add the ingest attachment plugin

Click on Settings and Plugins:

![image](https://us1.discourse-cdn.com/elastic/original/3X/4/6/465546e08deaeb495edbf0b8df2c41e85372f54e.png)

Add the plugin. And don't forget to save the changes.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/0/900738536d42b8bdb0459ad9629702d8704ce847.png)

After the cluster has been updated, you will be able to use the Elasticsearch endpoint to call the `_simulate` API. See [Simulate pipeline API | Elasticsearch Reference [7.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/simulate-pipeline-api.html)

If you mix that with [the plugin documentation](https://www.elastic.co/guide/en/elasticsearch/plugins/current/using-ingest-attachment.html), you should be able to execute something like:

```auto
# Create the pipeline
PUT _ingest/pipeline/attachment
{
  "description" : "Extract attachment information",
  "processors" : [
    {
      "attachment" : {
        "field" : "data"
      }
    }
  ]
}

```

Use the simulate endpoint

```auto
POST /_ingest/pipeline/attachment/_simulate
{
  "docs": [
    {
      "_index": "index",
      "_id": "id",
      "_source": {
          "data": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0="
      }
    }
  ]
}

```

This will give you an output. Use that content to build your own JSON and send that to AppSearch.

Note that `e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0=` is a BASE64 encoding of a binary file. (A text file here).

---

_[View the full topic](https://discuss.elastic.co/t/how-to-index-pdf-file-data-and-search-data-from-attachment-pdf-file/265565)._
