Which node executes the highligting?

We're troubleshooting some performance issues with respect to highlighting, where certain queries that contain 10 - 40 terms take 2x - 3x as long with highlighting enabled.

We're wondering in which phase (and on which nodes) the highlighting is performed? We have three types of nodes:

  • "client" nodes which have node.master and node.data set to false
  • "data" nodes which have node.master: false and node.data: true
  • "master" nodes which have node.master: true and node.data: false

All search and index requests connect to "client" nodes.

Is highlighting always preformed in the "gather" phase and if so, does that mean that in our set up, highlighting is only done on "client" nodes? Or does it depend on the highlighter that the query is using?