Custom OpenSearch Highlighter Plugin

Greetings all,

I have been trying to create a custom highlighter by creating a plugin that implements SearchPlugin, getHighlighter() method and create my own CustomHighlighter class that implements the Highlighter interface and its highlight() method.
My logic needs to check the user query to determine what should be highlighted.

Question: How can I get the user query from within SearchPlugin.getHighlighter() method and/or the CustomHighlighter?
(the whole REST request body is preferred).

Your help is highly appreciated.

https://github.com/opensearch-project/OpenSearch/blob/0ba0e7cc26060f964fcbf6ee45bae53b3a9941d0/plugins/examples/custom-suggester/src/main/java/org/opensearch/example/customsuggester/CustomSuggester.java#L46

try this example to replicate

Thanks.

But I dont see how this is related to highlighting. I mainly need to access the user query from within getHighlights method or any equivalent method.