Native script support in TermsStatsFacet query


(Hanish Bansal) #1

Hi All,

I have registered some custom java based scripts using native script
support in elasticsearch.

Now i am able to use those script using below query:

{
"query" : {
"match_all" : { }
},
"script_fields": {
"MessageReverted": {
"script": "reverse",
"lang": "native",
"params": {
"field": "field1"
}
}
}
}

Where reverse is my script name that is defined in elasticsearch.yml as:

script.native.reverse.type :
org.elasticsearch.examples.nativescript.script.ReverseStringFactory

I am able to get expected results.

Now i want similar functionality in facet functions. I am using term stat
facet query
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-terms-stats-facet.html.

By default TermsStatsFacet query supports below functions:

    Text getTerm();

    Number getTermAsNumber();

    long getCount();

    long getTotalCount();

    double getMin();

    double getMax();

    double getTotal();

    double getMean();

TermsStatsFacet query is really useful feature to compute stats on a field. I
am already using it in some of my use cases. One of my use case is also to
compute some custom stats on a field.

Is there any way to register some custom functions to these using native
scripts or any other method ?

Thanks in advance !!

Thanks & Regards
Hanish Bansal

--
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/CAB0WE8YFLnmcdsitk40Yx_Z74%2BFcJZ5q7eUs6o-ndQQiSas2Kw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2