Term stats


(phill) #1

When using a term_stats facet can I provide a "script" to define the
values to collect stats on just like in a term facet?
that is

"facets" : {
"tag_price_stats" : {
"terms_stats" : {
"script" : "myFunnyRegisteredScript",
"value_field" : "aNumericField"
}
}
}

-Paul

--


(Ivan Brusic) #2

Judging by the code, it appears not:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/facet/termsstats/TermsStatsFacetBuilder.java
(compared to https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/facet/terms/TermsFacetBuilder.java#L246
)

Both the documentation and code point to a field called
"value_script".It appears identical to "script" in the normal terms
facet from a builders standpoint, but I have never tried it.

--
Ivan

On Wed, Sep 5, 2012 at 5:08 PM, P. Hill parehill1@gmail.com wrote:

When using a term_stats facet can I provide a "script" to define the values
to collect stats on just like in a term facet?
that is

"facets" : {
"tag_price_stats" : {
"terms_stats" : {
"script" : "myFunnyRegisteredScript",
"value_field" : "aNumericField"
}
}
}

-Paul

--

--


(system) #3