Similarity class override

Hi everyone.

I'm looking for some way to plug in custom Similarity class into ES.
I've found some mentions that it can be done quite easy, but no
details. I need really simply override to set IDF=1 for all terms but
there's no way to do it with standard ES settings.

Can anybody point me to some docs on it?

Thank you in advance.

-- Michael Korbakov