Native scoring script: iterate over indexed terms of a field

Hi,

I'm trying to calculate a metric distance using a native scoring script on
my Elasticsearch matches between my query string terms and the found field
term terms of my indexed field.
Therefore I have to retrieve all the indexed field terms.

But it seems to me than I can just get them separately and only by index
of the actual term which I don not know if certain term it not present in
my query string:

This is the method to retrieve the terms separately. I have not seen
another one
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/lookup/IndexField.java
class: org.elasticsearch.search.lookup.IndexField;

Method get() from class IndexField:

public IndexFieldTerm get(Object key, int flags) { String termString = (
String) key;
IndexFieldTerm indexFieldTerm = terms.get(termString);
// see if we initialized already...
if (indexFieldTerm == null) {
indexFieldTerm = new IndexFieldTerm(termString, fieldName,
indexLookup, flags);
terms.put(termString, indexFieldTerm);
}
indexFieldTerm.validateFlags(flags);
return indexFieldTerm;
}

So is there any way to retrieve all the terms and iterate over them?
The groovy plugin provides this possibility, but I like to use a native
script
, because it's faster.

Or is my approach simply not very good and there is a much easier way to
calculate my own metric distance?

Moreover I like to know if there is a way to calculate the base score
without using the tf and idf.
I know there is a constant_score query, which provides this option, but
the score is always 1, regardless of the number of term occurences.

I cannot use the way proposed over here:
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/ignoring-tfidf.html
I just have too many terms.

I hope there is someone who can answer my questions.
Thank you!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5c9dc373-ea47-40b5-9699-ef2dfd95aea6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.