How to use "ingest-attachment" and pipeline

419 views
Skip to first unread message

Robert Vogel

unread,
Jan 17, 2017, 6:12:54 AM1/17/17
to Elastica - Elasticsearch PHP Client
Hi!

I want to index office files. I'm using ElasticSearch 5 and therefore the "mapper-attachments" plugin is deprecated. The docs tell me to use "ingest-attachment". I've already set up a type/mapping and the pipeline [1], but now I need to tell ElastichSearch to actually use that pipeline when indexing a document of that type. At the moment I' using code like that

$elasticaIndex = $this->getBackend()->getIndex(); //returns a \Elastica\Index object
$type = $elasticaIndex->getType( 'office' );
$docs = [];
foreach( $documentConfigs as $dc ) {
$docs[] = new \Elastica\Document( $dc['id'], $dc ); //$dc contains a field 'data' with the base64 encoded file
}

$result = $type->addDocuments( $docs );
$elasticaIndex->refresh();

I believe I somehow need set "pipeline=attachment" in the Bulk-Request. But I don't know how. Any help would be much appreciated!


--
Robert

Robert Vogel

unread,
Jan 23, 2017, 7:44:42 AM1/23/17
to Elastica - Elasticsearch PHP Client
It look like even if it is deprecated the old "mapper-attachment" plugin is still working on Elastic 5.x. I can therefore use Document::addFile from Elastica. Are there any plans to support the "ingest-attachment" pipeline mechanism in future?
--
Robert

ruflin

unread,
Jan 31, 2017, 11:22:29 AM1/31/17
to Elastica - Elasticsearch PHP Client
Glad do hear you got it working. We should definitively support the pipeline approach. Could you open a feature request for this on Github?

Robert Vogel

unread,
Feb 14, 2017, 2:48:29 AM2/14/17
to Elastica - Elasticsearch PHP Client
Reply all
Reply to author
Forward
0 new messages