- Plugins and Integrations: other versions:
- Introduction to plugins
- Plugin Management
- API Extension Plugins
- Analysis Plugins
- Discovery Plugins
- Ingest Plugins
- Mapper Plugins
- Snapshot/Restore Repository Plugins
- Store Plugins
- Integrations
- Help for plugin authors
IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Use the attachment processor with CBOR
editUse the attachment processor with CBOR
editTo avoid encoding and decoding JSON to base64, you can instead pass CBOR data to
the attachment processor. For example, the following request creates the
cbor-attachment
pipeline, which uses the attachment processor.
PUT _ingest/pipeline/cbor-attachment { "description" : "Extract attachment information", "processors" : [ { "attachment" : { "field" : "data" } } ] }
The following Python script passes CBOR data to an HTTP indexing request that
includes the cbor-attachment
pipeline. The HTTP request headers use a
content-type
of application/cbor
.
Not all Elasticsearch clients support custom HTTP request headers.
import cbor2 import requests file = 'my-file' headers = {'content-type': 'application/cbor'} with open(file, 'rb') as f: doc = { 'data': f.read() } requests.put( 'http://localhost:9200/my-index-000001/_doc/my_id?pipeline=cbor-attachment', data=cbor2.dumps(doc), headers=headers )
Was this helpful?
Thank you for your feedback.