I need to take divisions of two field. I tried it with statistical facets
with scripting. But it gives me NaN values. The query is like,
{
"size": 0,
"query": {
"match_all": {}
},
"facets": {
"stat1": {
"statistical": {
"script": "(doc['COUNT_int'].value/ doc['TOTAL_COUNT_int'].value)"
}
}
}
}
and the response ;
{
took: 38
timed_out: false
_shards: {
total: 5
successful: 5
failed: 0
}
hits: {
total: 331324
max_score: 1
hits: [ ]
}
facets: {
stat1: {
_type: statistical
count: 331324
total: NaN
min: 0
max: Infinity
mean: NaN
sum_of_squares: NaN
variance: NaN
std_deviation: NaN
}
}
}
I tried it with doubleValue too but the result was same.
I need to take divisions of two field. I tried it with statistical facets
with scripting. But it gives me NaN values. The query is like,
{
"size": 0,
"query": {
"match_all": {}
},
"facets": {
"stat1": {
"statistical": {
"script": "(doc['COUNT_int'].value/ doc['TOTAL_COUNT_int'].value)"
}
}
}
}
and the response ;
{
took: 38
timed_out: false
_shards: {
total: 5
successful: 5
failed: 0
}
hits: {
total: 331324
max_score: 1
hits:
}
facets: {
stat1: {
_type: statistical
count: 331324
total: NaN
min: 0
max: Infinity
mean: NaN
sum_of_squares: NaN
variance: NaN
std_deviation: NaN
}
}
}
I tried it with doubleValue too but the result was same.
22 Ocak 2013 Salı 18:08:37 UTC+2 tarihinde Ivan Brusic yazdı:
I would assume the issue is that you did a divide by zero. Is it possible
that TOTAL_COUNT was not indexed? Does it work using the source?
--
Ivan
On Tue, Jan 22, 2013 at 4:11 AM, Whispered <ceahm...@gmail.com<javascript:>
wrote:
I need to take divisions of two field. I tried it with statistical facets
with scripting. But it gives me NaN values. The query is like,
{
"size": 0,
"query": {
"match_all": {}
},
"facets": {
"stat1": {
"statistical": {
"script": "(doc['COUNT_int'].value/
doc['TOTAL_COUNT_int'].value)"
}
}
}
}
and the response ;
{
took: 38
timed_out: false
_shards: {
total: 5
successful: 5
failed: 0
}
hits: {
total: 331324
max_score: 1
hits:
}
facets: {
stat1: {
_type: statistical
count: 331324
total: NaN
min: 0
max: Infinity
mean: NaN
sum_of_squares: NaN
variance: NaN
std_deviation: NaN
}
}
}
I tried it with doubleValue too but the result was same.
The second faceted query using TOTAL_COUNT shows that the minimum value is
in fact 0. For at least one document, there is a division by zero error.
Can you query for "TOTAL_COUNT_int = 0" and see what the results are?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.