Use the attachment processor with CBORedit

To 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 = {