---
teardown:
  - do:
      ingest.delete_pipeline:
        id: "my_pipeline"
        ignore: 404

---
"Test bytes processor":
  - do:
      ingest.put_pipeline:
        id: "my_pipeline"
        body:  >
          {
            "description": "_description",
            "processors": [
              {
                "bytes" : {
                  "field" : "bytes_source_field",
                  "target_field" : "bytes_target_field"
                }
              }
            ]
          }
  - match: { acknowledged: true }

  - do:
      index:
        index: test
        id: "1"
        pipeline: "my_pipeline"
        body: {bytes_source_field: "1kb"}

  - do:
      get:
        index: test
        id: "1"
  - match: { _source.bytes_source_field: "1kb" }
  - match: { _source.bytes_target_field: 1024 }
