Update fields to use a different FieldFormatter during an update hook I have a drupal.org module that has changed its fieldformatter ID in a later version and I need the update hook to update all isntance of the content to use the new formatter, but cant seem to figure out how to do this.

e.g.

/**
 * Plugin implementation of the 'field_example_simple_text' formatter.
 *
 * @FieldFormatter(
 *   id = "example_field_formatter",
 *   module = "example",
 *   label = @Translation("example"),
 *   field_types = {
 *     "example_field_type"
 *   }
 * )
 */


has changed to 

/**
 * Plugin implementation of the 'field_example_simple_text' formatter.
 *
 * @FieldFormatter(
 *   id = "new_example_field_formatter",
 *   module = "example",
 *   label = @Translation("example"),
 *   field_types = {
 *     "new_example_field_type"
 *   }
 * )
 */


I need to update the content/fields to be using the new formatter as it overwrites the previous one.
The plugin definitions you've posted are for new fields to build the options when configuring a field formatter in UI. For existing fields you have to update the field formatter in config.

For example:

use Drupal\Core\Entity\Entity\EntityViewDisplay;

function mymodule_update_8001() {
  foreach (EntityViewDisplay::loadMultiple() as $display) {
    foreach ($display-&gt;getComponents() as $name =&gt; $options) {
      if (isset($options['type']) &amp;&amp; $options['type'] == 'old_formatter') {
        $options['type'] = 'new_formatter';
        $display-&gt;setComponent($name, $options)
          -&gt;save();
      }
    }
  }
}