Writing a custom highlighter

I checked the documentation and googled around ... but I can't find a nice documentation how to build a custom highlighter for elasticsearch.

I like to extend the plain-highlighter with some custom stuff (e.g. fragment size will be dynamic in relation where the keywords are found, stripping html and other stuff...)

Is it possible to do this with elasticsearch? I assume I need to write a plugin that somehow extends the plain-highlighter.

Any thoughts on this this? Is there a good ES V2.0 example of how to write a custom highlighter?



Wikimedia's plugin highlighter might have the functionality you need or at least provide the basis for how to write your own: https://github.com/wikimedia/search-highlighter