Equivalent node js of ingest-attachment with elasticsearch

Please I'm new with elasticsearch but I can say that I have some experience in node 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

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

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

Thank you very much for your helps.

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