# Ingest-attachment ingest local docs

**URL:** <https://discuss.elastic.co/t/ingest-attachment-ingest-local-docs/153215>\
**Category:** Elasticsearch\
**Created:** [October 19, 2018, 7:05pm UTC](https://discuss.elastic.co/t/ingest-attachment-ingest-local-docs/153215 "2018-10-19T19:05:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alina.frey](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@alina.frey](https://discuss.elastic.co/u/alina.frey)\
**Post date:** [October 19, 2018, 7:05pm UTC](https://discuss.elastic.co/t/ingest-attachment-ingest-local-docs/153215/1 "2018-10-19T19:05:28Z")

</div>

I am using ingets-attachment plugin of elasticsearch to parse documents, with the intention of doing a search for a word and retrieve the documents that contain that word.

I created a pipeline:

```auto
PUT: http://localhost:9200/_ingest/pipeline/pipeline-for-many-attachements
{
  "description" : "Extract attachment information from arrays",
  "processors" : [
    {
      "foreach": {
        "field": "attachments",
        "processor": {
          "attachment": {
            "target_field": "_ingest._value.attachment",
            "field": "_ingest._value.data"
          }
        }
      }
    }
  ]
}

```

Added attachment to an index and process them using the pipeline specified above:

```auto
PUT: http://localhost:9200/index-for-many-attachments/doc/0?pipeline=pipeline-for-many-attachements
{
  "attachments" : [
    {
      "filename" : "ipsum.txt",
      "data" : "QWxpbmEgaGFkIGx1bmNoLg=="
    },
    {
      "filename" : "test.txt",
      "data" : "Sm9zaCB3YXMgb24gdmFjYXRpb24u"
    }
  ]
}

Result:
{
    "_index": "index-for-many-attachments",
    "_type": "doc",
    "_id": "0",
    "_version": 1,
    "result": "created",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    },
    "created": true
}

```

The content of "data" is encoded text in base64.

Get the documents:

```auto
GET: http://localhost:9200/index-for-many-attachments/doc/0

Result:
{
    "_index": "index-for-many-attachments",
    "_type": "doc",
    "_id": "0",
    "_version": 2,
    "found": true,
    "_source": {
        "attachments": [
            {
                "filename": "ipsum.txt",
                "data": "QWxpbmEgaGFkIGx1bmNoLg==",
                "attachment": {
                    "content_type": "text/plain; charset=ISO-8859-1",
                    "language": "sk",
                    "content": "Alina had lunch.",
                    "content_length": 17
                }
            },
            {
                "filename": "test.txt",
                "data": "Sm9zaCB3YXMgb24gdmFjYXRpb24u",
                "attachment": {
                    "content_type": "text/plain; charset=ISO-8859-1",
                    "language": "en",
                    "content": "Josh was on vacation.",
                    "content_length": 22
                }
            }
        ]
    }
}

```

My intention now is to pass real documents from my local machine to the ingest-attachment, and be able to search for words in those local documents.

My question: How do I tell in my call to look for documents stored locally?  
For example doc1.pdf and doc2.pdf stored at location path1/doc1.pdf and path2/doc2.pdf.

---

<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:** [October 19, 2018, 10:54pm UTC](https://discuss.elastic.co/t/ingest-attachment-ingest-local-docs/153215/2 "2018-10-19T22:54:05Z")

</div>

In case it helps have a look at FSCrawler project which does that I think.

---

<div class="post-metadata">

**Author:** ![alina.frey](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@alina.frey](https://discuss.elastic.co/u/alina.frey)\
**Post date:** [October 21, 2018, 6:17pm UTC](https://discuss.elastic.co/t/ingest-attachment-ingest-local-docs/153215/3 "2018-10-21T18:17:52Z")

</div>

Is FSCrawler going to be used instead of ingest-attachment, or together with it?

---

<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:** [October 21, 2018, 6:36pm UTC](https://discuss.elastic.co/t/ingest-attachment-ingest-local-docs/153215/4 "2018-10-21T18:36:00Z")

</div>

Instead.

---

<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:** [November 18, 2018, 6:37pm UTC](https://discuss.elastic.co/t/ingest-attachment-ingest-local-docs/153215/5 "2018-11-18T18:37:05Z")

</div>

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