Searching attachment content with ingest attachment plugin

Please format your code using </> icon as explained in this guide. It will make your post more readable.

Or use markdown style like:

```
CODE
```

I would like to return "filename"

The problem here is that you are indexing multiple files instead of a single one.
The easiest way is to index one file by one file like:

PUT attachments/doc/1?pipeline=attachment
{
  "filename" : "ipsum.txt",
  "data" : "dGhpcyBpcwpqdXN0IHNvbWUgdGV4dAo="
}

If you really want to have multiple files and being able to associate the filename with its content, then you need to use nested fields. See Nested field type | Elasticsearch Guide [8.11] | Elastic

I would like to return word position

The only position you can get is the the position in the extracted text, not in the source document. This later information is not available.
For the "position" within the extracted text Highlighting might help: Highlighting | Elasticsearch Reference [6.0] | Elastic