Elasticsearch will automatically re-route index requests to ingest nodes, however with some careful consideration you can optimise this path.
Since Elasticsearch will automatically reroute ingest requests to ingest nodes, you don’t have to specify or configure any routing information. However, if you’re doing heavy ingestion and have dedicated ingest nodes, it makes sense to send index requests to these nodes directly, to avoid any extra hops in the cluster.
The simplest way to achieve this is to create a dedicated "indexing" client instance, and use it for indexing requests.
In complex cluster configurations it can be easier to use a sniffing connection pool along with a node predicate to filter out the nodes that have ingest capabilities. This allows you to customise the cluster and not have to reconfigure the client.