How customizable is ES?

Hi, I'm studying a few options before implementing a solution for a
distributed search setup.
I'm very used to manually tunning Lucene to suit my needs. Like weighting
fields, using customized collectors, using external source to change the
score of a doc, changing the overall ranking formula. My question is, would
I be able to those things in elasticsearch? Or, would I be able to
customize Lucene behavior inside elasticsearch?
I would like to use ES distributed and API capabilities but also being able
to tune the ranking and other lucene related things.

To be able to do this kind of thing will I have to alter the own elastic
search code?

Thanks

Felipe Hummel

Just got answered by Kimchy on #elasticsearch:

depends on what you want to do..., custom collectors probably not,
weighting fields => do you mean custom boost values? if so, you can.
external source: what is external, you can write a script or even a custom
Java code that does scoring, ranking formula, do you mean custom
similarity? if so, you can

similarity is not documented, you will need to implement SimilarityProvider
(check the Default one), and then you can configure:
org.elasticsearch.index.similarity.index.type and
org.elasticsearch.index.similarity.search.type to the full class name of
the provider you have
the code is htere:
https://github.com/elasticsearch/elasticsearch/tree/master/src/main/java/org/elasticsearch/index/similarity

Java code to do scoring is documented, this is a sample for a custom score
query based on a script:
http://www.elasticsearch.org/guide/reference/query-dsl/custom-score-query.html and
this part explains how to build a custom Java based script:
http://www.elasticsearch.org/guide/reference/modules/scripting.html

That means I can do pretty much everything I wanted without ever touching
ES source-code. Though, I can still do it if needed.