I was looking at a flame graph of an ingestion workload with @dliappis, and it looks like we parse the JSON representation of the index request twice when a document has both a pipeline and a final pipeline.

It's hard to know how much we would save on this benchmark since not all data streams in this benchmark had both a pipeline and a final pipeline, but the cost of parsing index request into maps of maps via IngestService represented 4.06% of overall CPU time according to the flame graph, so this might not be negligible.
server/src/main/java/org/elasticsearch/ingest/IngestService.java
} catch (IllegalArgumentException ex) {
                    
                    
                    handler.accept(
                        new IllegalArgumentException(
                            "Failed to generate the source document for ingest pipeline [" + pipeline.getId() + "]",
                            ex
                        )
                    );
                    return;
                } catch (Exception ex) {
                    
                    
                    
                    
                    handler.accept(
                        new RuntimeException("Failed to generate the source document for ingest pipeline [" + pipeline.getId() + "]", ex)
                    );
                    return;
                }
                cacheRawTimestamp(indexRequest, ingestDocument);
                handler.accept(null);
            }
        });
    }
    /**
     * Builds a new ingest document from the passed-in index request.
     */
    private static IngestDocument newIngestDocument(final IndexRequest request) {
        return new IngestDocument(