# Equivalent node js of ingest-attachment with elasticsearch

**URL:** <https://discuss.elastic.co/t/equivalent-node-js-of-ingest-attachment-with-elasticsearch/108316>\
**Category:** Elasticsearch\
**Created:** [November 20, 2017, 5:23am UTC](https://discuss.elastic.co/t/equivalent-node-js-of-ingest-attachment-with-elasticsearch/108316 "2017-11-20T05:23:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yann\_Nkengne](https://avatars.discourse-cdn.com/v4/letter/y/f1d935/32.png) [@Yann\_Nkengne](https://discuss.elastic.co/u/Yann_Nkengne)\
**Post date:** [November 20, 2017, 5:23am UTC](https://discuss.elastic.co/t/equivalent-node-js-of-ingest-attachment-with-elasticsearch/108316/1 "2017-11-20T05:23:39Z")

</div>

Please I'm new with elasticsearch but I can say that I have some experience in node [js.In](http://js.In) elasticsearch documentation, this is the way to index pdf file in my case:

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

PUT my_index/my_type/my_id?pipeline=attachment
{
  "data": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0="
}

```

I have 2 questions: - What is the equivalent syntax using node js using the documentation of ES 6 : [https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html)

Is my\_id the \_id generated by a body indexed before like this ?

```
client.index({
       index: 'gov', 
       id: '1', 
        type: 'constituencies',
        body: { 
             "ConstituencyName": "Ipswich", 
              "ConstituencyID": "E14000761",
              "ConstituencyType": "Borough", 
              "Electorate": 74499, 
               "ValidVotes": 48694, 
} },function(err,resp,status) { 
   console.log(resp);
 });

```

Thank you very much for your helps.

---

<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:** [December 18, 2017, 5:24am UTC](https://discuss.elastic.co/t/equivalent-node-js-of-ingest-attachment-with-elasticsearch/108316/2 "2017-12-18T05:24:09Z")

</div>

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