Using a statistical facet on a script_field

I can now create a script field:

    "script_fields" : {
                    "elapsed_tmp": {
                            "script": "singletimer",
                            "type": "float",
                            "lang": "js"
                    }
    }

This sets elapsed_tmp to a value like 1.234.

I really need the min/max/mean of these values across the query, so I'd
like to use the statistical facet:

   "facets" : {
            "stats0": {
                    "statistical": {
                            "field": "elapsed_tmp"
                    }
            }
    }

It complained that there was no mapping for elapsed_tmp, so I added one.
Now, it generates no errors, but returns no results:

"facets" : {
"stats0" : {
"_type" : "statistical",
"count" : 0,
"total" : 0.0,
"min" : "Infinity",
"max" : "-Infinity",
"mean" : 0.0,
"sum_of_squares" : 0.0,
"variance" : "NaN",
"std_deviation" : "NaN"
}
}

Anybody know how to make this work? Generically, the problem I'm trying to
solve is to pull a piece of data out of message with a regex, and then run
stats on that.

Thanks!

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hey,

the statistical facet itself includes support for scripts fields, you
should go with that. See

--Alex

On Wed, Nov 6, 2013 at 9:33 PM, rastro robert@webmstr.com wrote:

I can now create a script field:

    "script_fields" : {
                    "elapsed_tmp": {
                            "script": "singletimer",
                            "type": "float",
                            "lang": "js"
                    }
    }

This sets elapsed_tmp to a value like 1.234.

I really need the min/max/mean of these values across the query, so I'd
like to use the statistical facet:

   "facets" : {
            "stats0": {
                    "statistical": {
                            "field": "elapsed_tmp"
                    }
            }
    }

It complained that there was no mapping for elapsed_tmp, so I added one.
Now, it generates no errors, but returns no results:

"facets" : {
"stats0" : {
"_type" : "statistical",
"count" : 0,
"total" : 0.0,
"min" : "Infinity",
"max" : "-Infinity",
"mean" : 0.0,
"sum_of_squares" : 0.0,
"variance" : "NaN",
"std_deviation" : "NaN"
}
}

Anybody know how to make this work? Generically, the problem I'm trying
to solve is to pull a piece of data out of message with a regex, and then
run stats on that.

Thanks!

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.