Elasticsearch 5.0 Php ingest attachment

How to force(override) ingest attachment properties.
What if I want to specify my own tittle, name, author, etc... of a document.

In mapper attachment plugin we use:

"my_attachment" : {
"_language" : "en",
"_tittle": "doc title",
"_content" : "... base64 encoded attachment ..."
}

How to do just like this in ingest attachment using php client.

1 Like

You can use another processor in your pipeline to rename or remove fields.

2 Likes

Nice question! I am trying to have some of these definitions as well...

Would be good if we have a sample of that, if you figure it out let us know.

@dadoonet can you sir give me example

1 Like

Here is what I came up so far:

        $params = [
            'id' => 'attachment (pipeline name)',
            'body' => [
                'description' => 'Extract attachment information',
                'processors' => [
                    [
                        'attachment' => [
                            'field' => 'content',
                            'indexed_chars' => -1
                        ]
                    ],
                    [
                        'set' => [
                        'field' => 'attachment.name',
                        'value' => '{{ name }}'
                        ]
                    ],
                    [
                        'set' => [
                        'field' => 'attachment.author',
                        'value' => '{{ author }}'
                        ]
                    ],
                    [
                        'set' => [
                        'field' => 'attachment.editor',
                        'value' => '{{ editor }}'
                        ]
                    ],
                    [
                        'remove' => [
                            'field' => 'name'
                        ]
                    ],
                    [
                        'remove' => [
                            'field' => 'author'
                        ]
                    ],
                    [
                        'remove' => [
                            'field' => 'editor'
                        ]
                    ],
                ]
            ]
        ];
        return $client->ingest()->putPipeline($params);

Hope it heps!

1 Like

Thank you evert, thanks for support