We are currently on Elasticsearch version 5.4.1. We do search across ~30 fields and have highlighting for 12 of those. We are using Unified highlighter (with offsets).
We have repeatedly seen that the bulk of query time is taken by highlighting. For eg. the typical query takes 60-80 ms without highlighting - with highlighting that goes up to ~ 600 ms. The document / field size is not very large.
Is there something we can do to improve highlighting performance?
We are seeing some performance improvement with using highlight_query. The search query is a multi match query - the highlight query is just for each specific field. Would it make a difference? We are yet to test this in production environment.
To improve query performance, we are grouping the fields with same analyzers into composite fields (each composite field has an array of values for each fields). Would it make sense to try the same approach for highlighting? Can I map the highlight hit to the actual field? Is it possible to get index of the value that has highlight hit in the composite field array?