anchor.diff:  }
   --------------------------------------------------
   // NOTCONSOLE
  +
  +For another array of objects example, see
  +{plugins}/ingest-attachment-with-arrays.html[attachment processor
  +documentation].
  +
  +[discrete]
  +[[foreach-object-ex]]
  +===== Object
  +
  +You can also use the `foreach` processor on object fields. For example,
  +the following document contains a `products` field with object values.
  +
  +[source,js]
  +--------------------------------------------------
  +{
  +  "products" : {
  +    "widgets" : {
  +      "total_sales" : 50,
  +      "unit_price": 1.99,
  +      "display_name": ""
  +    },
  +    "sprockets" : {
  +      "total_sales" : 100,
  +      "unit_price": 9.99,
  +      "display_name": "Super Sprockets"
  +    },
  +    "whizbangs" : {
  +      "total_sales" : 200,
  +      "unit_price": 19.99,
  +      "display_name": "Wonderful Whizbangs"
  +    }
  +  }
  +}
  +--------------------------------------------------
  +// NOTCONSOLE
  +
  +The following `foreach` processor changes the value of `products.display_name`
  +to uppercase.
  +
  +[source,js]
  +--------------------------------------------------
  +{
  +  "foreach": {
  +    "field": "products",
  +    "processor": {
  +      "uppercase": {
  +        "field": "_ingest._value.display_name"
  +      }
  +    }
  +  }
  +}
  +--------------------------------------------------
  +// NOTCONSOLE
  +
  +When run on the document, the `foreach` processor returns:
  +
  +[source,js]
  +--------------------------------------------------
  +{
  +  "products" : {
  +    "widgets" : {
  +      "total_sales" : 50,
  +      "unit_price" : 1.99,
  +      "display_name" : ""
  +    },
  +    "sprockets" : {
  +      "total_sales" : 100,
  +      "unit_price" : 9.99,
  +      "display_name" : "SUPER SPROCKETS"
  +    },
  +    "whizbangs" : {
  +      "total_sales" : 200,
  +      "unit_price" : 19.99,
  +      "display_name" : "WONDERFUL WHIZBANGS"
  +    }
  +  }
  +}
  +--------------------------------------------------
  +// NOTCONSOLE
  +
  +The following `foreach` processor sets each element's key to the
  +value of `products.display_name`. If `products.display_name` contains an empty string,
  +the processor deletes the element.
  +
  +[source,js]
  +--------------------------------------------------
  +{
  +  "foreach": {
  +    "field": "products",
  +    "processor": {
  +      "set": {
  +        "field": "_ingest._key",
  +        "value": "{{_ingest._value.display_name}}"
  +      }
  +    }
  +  }
  +}
  +--------------------------------------------------
  +// NOTCONSOLE
  +
  +When run on the previous document, the `foreach` processor returns:
  +
  +[source,js]
  +--------------------------------------------------
  +{
  +  "products" : {
  +    "Wonderful Whizbangs" : {
  +      "total_sales" : 200,
  +      "unit_price" : 19.99,
  +      "display_name" : "Wonderful Whizbangs"
  +    },
  +    "Super Sprockets" : {
  +      "total_sales" : 100,
  +      "unit_price" : 9.99,
  +      "display_name" : "Super Sprockets"
  +    }
  +  }
  +}
  +--------------------------------------------------
  +// NOTCONSOLE
  +
  +[discrete]
  +[[failure-handling-ex]]
  +===== Failure handling
   
   The wrapped processor can have a `on_failure` definition.
   For example, the `id` field may not exist on all person objects.
  
positive.code: --------------------------------------------------
  // NOTCONSOLE
  
  Let's take a look at another example:
  
  [source,js]
  --------------------------------------------------
  
negative.code: --------------------------------------------------
  // NOTCONSOLE
  
  Then the document will look like this after processing:
  
  [source,js]
  --------------------------------------------------
  