# Elasticsearch-ingest-opennlp pdf

**URL:** <https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921>\
**Category:** Elasticsearch\
**Created:** [March 7, 2018, 4:15pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921 "2018-03-07T16:15:02Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 7, 2018, 4:15pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/1 "2018-03-07T16:15:02Z")

</div>

Hello , is that possible to use the plugin "ingest-opennlp " in pdf ??

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 7, 2018, 4:30pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/2 "2018-03-07T16:30:55Z")

</div>

You can use the ingest attachment plugin first, and then run the opennlp processor against the field that was created by the attachment plugin.

--Alex

---

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 8, 2018, 7:41am UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/3 "2018-03-08T07:41:11Z")

</div>

you mean like this ? :

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

 PUT _ingest/pipeline/opennlp-pipeline
   {
 "description": "A pipeline to do named entity extraction",
 "processors": [
   {
  "opennlp" : {
    "field" : "data"
     }
   }
  ]
}

PUT /indice12/type/1?pipeline=opennlp-pipeline
{
 "data" :"base 64-pdf_conversion "
  }

```

normally the OpenNlp need to filter the pdf before ingesting it ? Not ?  
please tell me how ?

---

<div class="post-metadata">

**Author:** ![shanec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shanec/32/4004_2.png) [@shanec](https://discuss.elastic.co/u/shanec)\
**Post date:** [March 8, 2018, 3:48pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/4 "2018-03-08T15:48:29Z")

</div>

`processors` is an array. Instead of setting up 2 separate `pipeline`s, set up a single `pipeline` with the `attachment` processor first and the `opennlp` processor next.

---

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 8, 2018, 3:50pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/5 "2018-03-08T15:50:51Z")

</div>

could you show me how please because i have lost a day in this problem.

also the two plugins are different how that could be

---

<div class="post-metadata">

**Author:** ![shanec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shanec/32/4004_2.png) [@shanec](https://discuss.elastic.co/u/shanec)\
**Post date:** [March 8, 2018, 4:04pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/6 "2018-03-08T16:04:13Z")

</div>

Something like

```auto
PUT _ingest/pipeline/opennlp-pipeline
{
 "description": "A pipeline to do named entity extraction",
 "processors": [
    {
      "attachment" : {
        "field" : "<<base-64 encoded pdf field>>",
        <<any additional ingest-attachment parameters>>
      }
    },
    {
      "opennlp" : {
        "field" : "attachment.content",
        <<any additional ingest-opennlp parameters>>
      }
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 8, 2018, 4:22pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/7 "2018-03-08T16:22:50Z")

</div>

ok the request is valid without errors Thank you ! , but where would i find the results ,the index ?

---

<div class="post-metadata">

**Author:** ![shanec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shanec/32/4004_2.png) [@shanec](https://discuss.elastic.co/u/shanec)\
**Post date:** [March 8, 2018, 4:28pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/8 "2018-03-08T16:28:31Z")

</div>

Yes, you can `PUT` or `POST` a document with the `?pipeline=...` (as you did). After this, you should bet able to do something like `GET /indice12/_search` and see a result.

You can also actually test your pipeline by using the [simulate](https://www.elastic.co/guide/en/elasticsearch/reference/current/simulate-pipeline-api.html) API without having to run a document into your index and then `_search` for or `GET` it

---

<div class="post-metadata">

**Author:** ![shanec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shanec/32/4004_2.png) [@shanec](https://discuss.elastic.co/u/shanec)\
**Post date:** [March 8, 2018, 5:35pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/10 "2018-03-08T17:35:31Z")

</div>

> it require a body what should i put in the body i m new to es

The base-64 encoded PDF as a field. And then you'd reference that field name in the `field` component of the `attachment` processor

---

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 8, 2018, 6:38pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/11 "2018-03-08T18:38:02Z")

</div>

no you didn't understand me  
i talk about this:

```
PUT /indice12/type/1?pipeline=opennlp-pipeline{

  here the problem, what should i put here it dosen't work 

   }
```

---

<div class="post-metadata">

**Author:** ![shanec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shanec/32/4004_2.png) [@shanec](https://discuss.elastic.co/u/shanec)\
**Post date:** [March 8, 2018, 6:42pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/12 "2018-03-08T18:42:05Z")

</div>

You should put something like `"body": "aGVsbG8gdGhlcmU="` or whatever your base-64 encoded pdf is. Assuming you use `body` here, the `field` component I have under the `attachment` section of `PUT _ingest/pipeline/opennlp-pipeline` would be `body`

---

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 8, 2018, 7:08pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/13 "2018-03-08T19:08:05Z")

</div>

i did as you told me :

```
PUT /indice12/type/1?pipeline=opennlp-pipeline{

  "body":"pdf-conversion-to-base64" 

  }

```

And it returned error  
java.lang.IllegalArgumentException

---

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 8, 2018, 7:36pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/14 "2018-03-08T19:36:26Z")

</div>

Any way the first step has succeded:

 ![2018-03-08%20(1)](https://us1.discourse-cdn.com/elastic/original/3X/e/4/e4a7864f721458ea857070de2272382706478910.jpg)

---

<div class="post-metadata">

**Author:** ![shanec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shanec/32/4004_2.png) [@shanec](https://discuss.elastic.co/u/shanec)\
**Post date:** [March 8, 2018, 7:40pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/15 "2018-03-08T19:40:07Z")

</div>

The opennlp-pipeline `attachment.field` should be a field name that you're going to pass in, not the content of the PDF. You've also gotten the order of the opennlp/attachment processors in reverse.

---

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 8, 2018, 7:52pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/16 "2018-03-08T19:52:02Z")

</div>

ok for the order  
but above in your response

```
attachment" : {
    "field" : "<<base-64 encoded pdf field>>",
    <<any additional ingest-attachment parameters>>
  }

```

I m confused??

---

<div class="post-metadata">

**Author:** ![shanec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shanec/32/4004_2.png) [@shanec](https://discuss.elastic.co/u/shanec)\
**Post date:** [March 8, 2018, 8:00pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/17 "2018-03-08T20:00:58Z")

</div>

So you'd have something like

```auto
PUT _ingest/pipeline/opennlp-pipeline
{
 "description": "A pipeline to do named entity extraction",
 "processors": [
    {
      "attachment" : {
        "field" : "mycontentfield"
      }
    },
    {
      "opennlp" : {
        "field" : "attachment.content"
      }
    }
  ]
}

```

and then

```auto
PUT /indice12/type/1?pipeline=opennlp-pipeline
{
  "mycontentfield": "aGVsbG8gdGhlcmU="
}

```

---

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 8, 2018, 8:07pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/18 "2018-03-08T20:07:21Z")

</div>

Thank you so much

---

<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:** [April 5, 2018, 8:07pm UTC](https://discuss.elastic.co/t/elasticsearch-ingest-opennlp-pdf/122921/19 "2018-04-05T20:07:42Z")

</div>

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