How to use elasticsearch 8.x ingest-attachment with Python

I am trying to read a pdf from python and send it to elasticsearch. I tried to use ingest-attachment to help with that, but I don't know how.

When I followed the official documentation, it worked. However, there doesn't seem to be a way to use Python in the official documentation.

so, I looked at the official documentation and created my own mapping

Data is entered but not attached.

Wandered around and found this. but i don't know how to use

elasticsearch.exceptions.RequestError: RequestError(400, 'invalid_index_name_exception', 'Invalid index name [_ingest/pipeline/attachment_pipeline], must not contain the following characters ['','/','*
','?','"','<','>','|',' ',',']')

If you just run it, it will come out like this: It looks like you have / in your index name. So this time I only ran the bottom part.

elasticsearch.exceptions.RequestError: RequestError(400, 'illegal_argument_exception', 'pipeline with id [attachment_pipeline] does not exist')

..........

I want to know how to use it..

How to make attachment plugin work in python

Welcome to our community! :smiley:

Please don't post pictures of text, logs or code. They are difficult to read, impossible to search and replicate (if it's code), and some people may not be even able to see them :slight_smile:

You need to encode the binary content to BASE64 and then put the BASE64 into the data field.

Also you need to use the PUT ingest pipeline API and not the Create Index API.