# 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:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![genero](https://avatars.discourse-cdn.com/v4/letter/g/439d5e/32.png) [@genero](https://discuss.elastic.co/u/genero)\
**Post date:** [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/1 "2021-02-26T05:11:56Z")

</div>

Hello,

I want to index PDF file data in Elastic App Search and search data from PDF file.  
Please suggested is it possible to handle attachment PDF in Elastic App search?

Regards

---

<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, 5:28am UTC](https://discuss.elastic.co/t/how-to-index-pdf-file-data-and-search-data-from-attachment-pdf-file/265565/2 "2021-02-26T05:28:19Z")

</div>

I might add this feature to FSCrawler although I'm unsure how useful this could be.

> <https://github.com/dadoonet/fscrawler/issues/718>
>
> Would be great to have an output to AppSearch service OOTB.
> So people can build a nice UI on top of FSCrawler...

What is the use case?

Note that FSCrawler supports workplace search.

Anyway, what you can do is to use the ingest attachment plugin and the ingest simulate API.

1. Send to this API the PDF.
2. Get back the extracted text and the metadata
3. Create with that your Json document
4. Send it to AppSearch.

---

<div class="post-metadata">

**Author:** ![genero](https://avatars.discourse-cdn.com/v4/letter/g/439d5e/32.png) [@genero](https://discuss.elastic.co/u/genero)\
**Post date:** [February 26, 2021, 5:39am UTC](https://discuss.elastic.co/t/how-to-index-pdf-file-data-and-search-data-from-attachment-pdf-file/265565/3 "2021-02-26T05:39:14Z")

</div>

Thank you for support!  
But can you please suggest how to install or implement ingest attachment plugin and the ingest simulate API **with Elastic App Search**?

I have Elastic Enterprise Search Stander account.

---

<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, 9:35am UTC](https://discuss.elastic.co/t/how-to-index-pdf-file-data-and-search-data-from-attachment-pdf-file/265565/4 "2021-02-26T09:35:11Z")

</div>

Are you running on cloud or locally ?

---

<div class="post-metadata">

**Author:** ![genero](https://avatars.discourse-cdn.com/v4/letter/g/439d5e/32.png) [@genero](https://discuss.elastic.co/u/genero)\
**Post date:** [February 26, 2021, 9:40am UTC](https://discuss.elastic.co/t/how-to-index-pdf-file-data-and-search-data-from-attachment-pdf-file/265565/5 "2021-02-26T09:40:34Z")

</div>

I am using aws Asia Pacific (Tokyo) on cloud.

---

<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).

---

<div class="post-metadata">

**Author:** ![genero](https://avatars.discourse-cdn.com/v4/letter/g/439d5e/32.png) [@genero](https://discuss.elastic.co/u/genero)\
**Post date:** [March 1, 2021, 10:32am UTC](https://discuss.elastic.co/t/how-to-index-pdf-file-data-and-search-data-from-attachment-pdf-file/265565/7 "2021-03-01T10:32:29Z")

</div>

Thank you for update! Let me try this.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 29, 2021, 10:32am UTC](https://discuss.elastic.co/t/how-to-index-pdf-file-data-and-search-data-from-attachment-pdf-file/265565/8 "2021-03-29T10:32:30Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
