Elastic Search Term Aggregation on numeric / long field

Hey,

I'm a little bit stucked using Terms aggregations on a numeric field.

My schema looks like that:

{ ...
starRating:
{

  • type: "long"

}
...
}

I pass documents there, works fine.
I query them, using a Range Query like, works also fine:

{
"range": {
"starRating": {
"from": 0,
"to": 5,
}
}
}

Whenever I ask for Term Aggregations like:

{
"aggs": {
stars" : {
"terms" : { "field" : "starRating" }
}
}

OR Facets with

"facets" : {
"tag" : {
"terms" : {
"field" : "starRating"
}
}
}

Strange values are returned:

"facets": {
"tag": {
"_type": "terms",
"missing": 0,
"total": 3814,
"other": 0,
"terms": [
{
"term": 0.0,
"count": 2397
},
{
"term": 1.5E-323,
"count": 610
},
{
"term": 2.0E-323,
"count": 378
},
{
"term": 1.0E-323,
"count": 269
},
{
"term": 4.9E-324,
"count": 93
},
{
"term": 2.5E-323,
"count": 67
}
]
}
},
"aggregations": {
"stars": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0.0,
"doc_count": 2397
},
{
"key": 1.5E-323,
"doc_count": 610
},
{
"key": 2.0E-323,
"doc_count": 378
},
{
"key": 1.0E-323,
"doc_count": 269
},
{
"key": 4.9E-324,
"doc_count": 93
},
{
"key": 2.5E-323,
"doc_count": 67
}
]
}
}

Even in the Java Client, I get DoubleTerms instead of LongTerms.

Does anybody have an Idea, what wents wrong there. I would expect Long-Keys
and not Double keys (which are basically close to 0)
The Histogram (with interval of 1) also does not work, everything is close
to the zero valued key.

Cheers, Ralf

--
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/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Besides the Terms filter in aggregation , you should use range aggregation .
It would work like..

{
"aggs": {
stars" : {
"range" : {
"field" : "starRating" ,
"ranges": [{
"to": 5
}, {
"from": 5,
"to": 10
}, {
"from": 10,
"to": 15
}, {
"from": 15
}]

       }
}

}

On Mon, Apr 27, 2015 at 4:18 PM, rh@hubrick.com wrote:

Hey,

I'm a little bit stucked using Terms aggregations on a numeric field.

My schema looks like that:

{ ...
starRating:
{

  • type: "long"

}
...
}

I pass documents there, works fine.
I query them, using a Range Query like, works also fine:

{
"range": {
"starRating": {
"from": 0,
"to": 5,
}
}
}

Whenever I ask for Term Aggregations like:

{
"aggs": {
stars" : {
"terms" : { "field" : "starRating" }
}
}

OR Facets with

"facets" : {
"tag" : {
"terms" : {
"field" : "starRating"
}
}
}

Strange values are returned:

"facets": {
"tag": {
"_type": "terms",
"missing": 0,
"total": 3814,
"other": 0,
"terms": [
{
"term": 0.0,
"count": 2397
},
{
"term": 1.5E-323,
"count": 610
},
{
"term": 2.0E-323,
"count": 378
},
{
"term": 1.0E-323,
"count": 269
},
{
"term": 4.9E-324,
"count": 93
},
{
"term": 2.5E-323,
"count": 67
}
]
}
},
"aggregations": {
"stars": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0.0,
"doc_count": 2397
},
{
"key": 1.5E-323,
"doc_count": 610
},
{
"key": 2.0E-323,
"doc_count": 378
},
{
"key": 1.0E-323,
"doc_count": 269
},
{
"key": 4.9E-324,
"doc_count": 93
},
{
"key": 2.5E-323,
"doc_count": 67
}
]
}
}

Even in the Java Client, I get DoubleTerms instead of LongTerms.

Does anybody have an Idea, what wents wrong there. I would expect
Long-Keys and not Double keys (which are basically close to 0)
The Histogram (with interval of 1) also does not work, everything is close
to the zero valued key.

Cheers, Ralf

--
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/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/CAHzCMprJiRGLs50K9o1OfdWYA65-RNFOmF-gWCOQTtSo2UB8Wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

unfortunately the same "issue".
The Ranged based Aggregation returns me:

"starRating": {
"buckets": [
{
"key": "0.0-0.0",
"from": 0.0,
"from_as_string": "0.0",
"to": 0.0,
"to_as_string": "0.0",
"doc_count": 0
},
{
"key": "1.0-1.0",
"from": 1.0,
"from_as_string": "1.0",
"to": 1.0,
"to_as_string": "1.0",
"doc_count": 0
},
{
"key": "2.0-2.0",
"from": 2.0,
"from_as_string": "2.0",
"to": 2.0,
"to_as_string": "2.0",
"doc_count": 0
},
{
"key": "3.0-3.0",
"from": 3.0,
"from_as_string": "3.0",
"to": 3.0,
"to_as_string": "3.0",
"doc_count": 0
},
{
"key": "4.0-4.0",
"from": 4.0,
"from_as_string": "4.0",
"to": 4.0,
"to_as_string": "4.0",
"doc_count": 0
},
{
"key": "5.0-5.0",
"from": 5.0,
"from_as_string": "5.0",
"to": 5.0,
"to_as_string": "5.0",
"doc_count": 0
}
]
}

It looks like, that the values are read / indexed "wrong". Whats strange,
the filtering by range works.

On Monday, April 27, 2015 at 12:52:35 PM UTC+2, deepak.chauhan wrote:

Besides the Terms filter in aggregation , you should use range aggregation
.
It would work like..

{
"aggs": {
stars" : {
"range" : {
"field" : "starRating" ,
"ranges": [{
"to": 5
}, {
"from": 5,
"to": 10
}, {
"from": 10,
"to": 15
}, {
"from": 15
}]

       }
}

}

On Mon, Apr 27, 2015 at 4:18 PM, <r...@hubrick.com <javascript:>> wrote:

Hey,

I'm a little bit stucked using Terms aggregations on a numeric field.

My schema looks like that:

{ ...
starRating:
{

  • type: "long"

}
...
}

I pass documents there, works fine.
I query them, using a Range Query like, works also fine:

{
"range": {
"starRating": {
"from": 0,
"to": 5,
}
}
}

Whenever I ask for Term Aggregations like:

{
"aggs": {
stars" : {
"terms" : { "field" : "starRating" }
}
}

OR Facets with

"facets" : {
"tag" : {
"terms" : {
"field" : "starRating"
}
}
}

Strange values are returned:

"facets": {
"tag": {
"_type": "terms",
"missing": 0,
"total": 3814,
"other": 0,
"terms": [
{
"term": 0.0,
"count": 2397
},
{
"term": 1.5E-323,
"count": 610
},
{
"term": 2.0E-323,
"count": 378
},
{
"term": 1.0E-323,
"count": 269
},
{
"term": 4.9E-324,
"count": 93
},
{
"term": 2.5E-323,
"count": 67
}
]
}
},
"aggregations": {
"stars": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0.0,
"doc_count": 2397
},
{
"key": 1.5E-323,
"doc_count": 610
},
{
"key": 2.0E-323,
"doc_count": 378
},
{
"key": 1.0E-323,
"doc_count": 269
},
{
"key": 4.9E-324,
"doc_count": 93
},
{
"key": 2.5E-323,
"doc_count": 67
}
]
}
}

Even in the Java Client, I get DoubleTerms instead of LongTerms.

Does anybody have an Idea, what wents wrong there. I would expect
Long-Keys and not Double keys (which are basically close to 0)
The Histogram (with interval of 1) also does not work, everything is
close to the zero valued key.

Cheers, Ralf

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/fed3b7c0-782d-424f-9412-ba6816ce7ffc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

unfortunately the same issue, ...
Whats strange, filtering / querying these values works as expected. I
guess, that there is an internal mapping working unexpected.

"starRating": {
"buckets": [
{
"key": "0.0-1.0",
"from": 0.0,
"from_as_string": "0.0",
"to": 1.0,
"to_as_string": "1.0",
"doc_count": 5119
},
{
"key": "1.0-2.0",
"from": 1.0,
"from_as_string": "1.0",
"to": 2.0,
"to_as_string": "2.0",
"doc_count": 0
},
{
"key": "2.0-3.0",
"from": 2.0,
"from_as_string": "2.0",
"to": 3.0,
"to_as_string": "3.0",
"doc_count": 0
},
{
"key": "3.0-4.0",
"from": 3.0,
"from_as_string": "3.0",
"to": 4.0,
"to_as_string": "4.0",
"doc_count": 0
},
{
"key": "4.0-5.0",
"from": 4.0,
"from_as_string": "4.0",
"to": 5.0,
"to_as_string": "5.0",
"doc_count": 0
},
{
"key": "5.0-6.0",
"from": 5.0,
"from_as_string": "5.0",
"to": 6.0,
"to_as_string": "6.0",
"doc_count": 0
}
]
}

On Monday, April 27, 2015 at 12:52:35 PM UTC+2, deepak.chauhan wrote:

Besides the Terms filter in aggregation , you should use range aggregation
.
It would work like..

{
"aggs": {
stars" : {
"range" : {
"field" : "starRating" ,
"ranges": [{
"to": 5
}, {
"from": 5,
"to": 10
}, {
"from": 10,
"to": 15
}, {
"from": 15
}]

       }
}

}

On Mon, Apr 27, 2015 at 4:18 PM, <r...@hubrick.com <javascript:>> wrote:

Hey,

I'm a little bit stucked using Terms aggregations on a numeric field.

My schema looks like that:

{ ...
starRating:
{

  • type: "long"

}
...
}

I pass documents there, works fine.
I query them, using a Range Query like, works also fine:

{
"range": {
"starRating": {
"from": 0,
"to": 5,
}
}
}

Whenever I ask for Term Aggregations like:

{
"aggs": {
stars" : {
"terms" : { "field" : "starRating" }
}
}

OR Facets with

"facets" : {
"tag" : {
"terms" : {
"field" : "starRating"
}
}
}

Strange values are returned:

"facets": {
"tag": {
"_type": "terms",
"missing": 0,
"total": 3814,
"other": 0,
"terms": [
{
"term": 0.0,
"count": 2397
},
{
"term": 1.5E-323,
"count": 610
},
{
"term": 2.0E-323,
"count": 378
},
{
"term": 1.0E-323,
"count": 269
},
{
"term": 4.9E-324,
"count": 93
},
{
"term": 2.5E-323,
"count": 67
}
]
}
},
"aggregations": {
"stars": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0.0,
"doc_count": 2397
},
{
"key": 1.5E-323,
"doc_count": 610
},
{
"key": 2.0E-323,
"doc_count": 378
},
{
"key": 1.0E-323,
"doc_count": 269
},
{
"key": 4.9E-324,
"doc_count": 93
},
{
"key": 2.5E-323,
"doc_count": 67
}
]
}
}

Even in the Java Client, I get DoubleTerms instead of LongTerms.

Does anybody have an Idea, what wents wrong there. I would expect
Long-Keys and not Double keys (which are basically close to 0)
The Histogram (with interval of 1) also does not work, everything is
close to the zero valued key.

Cheers, Ralf

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/831df5f8-a5d3-4c90-b4c7-d40f12df514d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

may be .. i have tried this again in my index ..
it is working properly
Please check your mapping
or try on another field which is long

On Mon, Apr 27, 2015 at 4:31 PM, rh@hubrick.com wrote:

unfortunately the same issue, ...
Whats strange, filtering / querying these values works as expected. I
guess, that there is an internal mapping working unexpected.

"starRating": {
"buckets": [
{
"key": "0.0-1.0",
"from": 0.0,
"from_as_string": "0.0",
"to": 1.0,
"to_as_string": "1.0",
"doc_count": 5119
},
{
"key": "1.0-2.0",
"from": 1.0,
"from_as_string": "1.0",
"to": 2.0,
"to_as_string": "2.0",
"doc_count": 0
},
{
"key": "2.0-3.0",
"from": 2.0,
"from_as_string": "2.0",
"to": 3.0,
"to_as_string": "3.0",
"doc_count": 0
},
{
"key": "3.0-4.0",
"from": 3.0,
"from_as_string": "3.0",
"to": 4.0,
"to_as_string": "4.0",
"doc_count": 0
},
{
"key": "4.0-5.0",
"from": 4.0,
"from_as_string": "4.0",
"to": 5.0,
"to_as_string": "5.0",
"doc_count": 0
},
{
"key": "5.0-6.0",
"from": 5.0,
"from_as_string": "5.0",
"to": 6.0,
"to_as_string": "6.0",
"doc_count": 0
}
]
}

On Monday, April 27, 2015 at 12:52:35 PM UTC+2, deepak.chauhan wrote:

Besides the Terms filter in aggregation , you should use range
aggregation .
It would work like..

{
"aggs": {
stars" : {
"range" : {
"field" : "starRating" ,
"ranges": [{
"to": 5
}, {
"from": 5,
"to": 10
}, {
"from": 10,
"to": 15
}, {
"from": 15
}]

       }
}

}

On Mon, Apr 27, 2015 at 4:18 PM, r...@hubrick.com wrote:

Hey,

I'm a little bit stucked using Terms aggregations on a numeric field.

My schema looks like that:

{ ...
starRating:
{

  • type: "long"

}
...
}

I pass documents there, works fine.
I query them, using a Range Query like, works also fine:

{
"range": {
"starRating": {
"from": 0,
"to": 5,
}
}
}

Whenever I ask for Term Aggregations like:

{
"aggs": {
stars" : {
"terms" : { "field" : "starRating" }
}
}

OR Facets with

"facets" : {
"tag" : {
"terms" : {
"field" : "starRating"
}
}
}

Strange values are returned:

"facets": {
"tag": {
"_type": "terms",
"missing": 0,
"total": 3814,
"other": 0,
"terms": [
{
"term": 0.0,
"count": 2397
},
{
"term": 1.5E-323,
"count": 610
},
{
"term": 2.0E-323,
"count": 378
},
{
"term": 1.0E-323,
"count": 269
},
{
"term": 4.9E-324,
"count": 93
},
{
"term": 2.5E-323,
"count": 67
}
]
}
},
"aggregations": {
"stars": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0.0,
"doc_count": 2397
},
{
"key": 1.5E-323,
"doc_count": 610
},
{
"key": 2.0E-323,
"doc_count": 378
},
{
"key": 1.0E-323,
"doc_count": 269
},
{
"key": 4.9E-324,
"doc_count": 93
},
{
"key": 2.5E-323,
"doc_count": 67
}
]
}
}

Even in the Java Client, I get DoubleTerms instead of LongTerms.

Does anybody have an Idea, what wents wrong there. I would expect
Long-Keys and not Double keys (which are basically close to 0)
The Histogram (with interval of 1) also does not work, everything is
close to the zero valued key.

Cheers, Ralf

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/831df5f8-a5d3-4c90-b4c7-d40f12df514d%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/831df5f8-a5d3-4c90-b4c7-d40f12df514d%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/CAHzCMppvFBVAjTY9WPXZJ8dew9TjhtWcuJFGe%2BgkYRyrtkwDWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

which version do you use - i'm using 1.4.4. ?

On Monday, April 27, 2015 at 1:27:12 PM UTC+2, deepak.chauhan wrote:

may be .. i have tried this again in my index ..
it is working properly
Please check your mapping
or try on another field which is long

On Mon, Apr 27, 2015 at 4:31 PM, <r...@hubrick.com <javascript:>> wrote:

unfortunately the same issue, ...
Whats strange, filtering / querying these values works as expected. I
guess, that there is an internal mapping working unexpected.

"starRating": {
"buckets": [
{
"key": "0.0-1.0",
"from": 0.0,
"from_as_string": "0.0",
"to": 1.0,
"to_as_string": "1.0",
"doc_count": 5119
},
{
"key": "1.0-2.0",
"from": 1.0,
"from_as_string": "1.0",
"to": 2.0,
"to_as_string": "2.0",
"doc_count": 0
},
{
"key": "2.0-3.0",
"from": 2.0,
"from_as_string": "2.0",
"to": 3.0,
"to_as_string": "3.0",
"doc_count": 0
},
{
"key": "3.0-4.0",
"from": 3.0,
"from_as_string": "3.0",
"to": 4.0,
"to_as_string": "4.0",
"doc_count": 0
},
{
"key": "4.0-5.0",
"from": 4.0,
"from_as_string": "4.0",
"to": 5.0,
"to_as_string": "5.0",
"doc_count": 0
},
{
"key": "5.0-6.0",
"from": 5.0,
"from_as_string": "5.0",
"to": 6.0,
"to_as_string": "6.0",
"doc_count": 0
}
]
}

On Monday, April 27, 2015 at 12:52:35 PM UTC+2, deepak.chauhan wrote:

Besides the Terms filter in aggregation , you should use range
aggregation .
It would work like..

{
"aggs": {
stars" : {
"range" : {
"field" : "starRating" ,
"ranges": [{
"to": 5
}, {
"from": 5,
"to": 10
}, {
"from": 10,
"to": 15
}, {
"from": 15
}]

       }
}

}

On Mon, Apr 27, 2015 at 4:18 PM, r...@hubrick.com wrote:

Hey,

I'm a little bit stucked using Terms aggregations on a numeric field.

My schema looks like that:

{ ...
starRating:
{

  • type: "long"

}
...
}

I pass documents there, works fine.
I query them, using a Range Query like, works also fine:

{
"range": {
"starRating": {
"from": 0,
"to": 5,
}
}
}

Whenever I ask for Term Aggregations like:

{
"aggs": {
stars" : {
"terms" : { "field" : "starRating" }
}
}

OR Facets with

"facets" : {
"tag" : {
"terms" : {
"field" : "starRating"
}
}
}

Strange values are returned:

"facets": {
"tag": {
"_type": "terms",
"missing": 0,
"total": 3814,
"other": 0,
"terms": [
{
"term": 0.0,
"count": 2397
},
{
"term": 1.5E-323,
"count": 610
},
{
"term": 2.0E-323,
"count": 378
},
{
"term": 1.0E-323,
"count": 269
},
{
"term": 4.9E-324,
"count": 93
},
{
"term": 2.5E-323,
"count": 67
}
]
}
},
"aggregations": {
"stars": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0.0,
"doc_count": 2397
},
{
"key": 1.5E-323,
"doc_count": 610
},
{
"key": 2.0E-323,
"doc_count": 378
},
{
"key": 1.0E-323,
"doc_count": 269
},
{
"key": 4.9E-324,
"doc_count": 93
},
{
"key": 2.5E-323,
"doc_count": 67
}
]
}
}

Even in the Java Client, I get DoubleTerms instead of LongTerms.

Does anybody have an Idea, what wents wrong there. I would expect
Long-Keys and not Double keys (which are basically close to 0)
The Histogram (with interval of 1) also does not work, everything is
close to the zero valued key.

Cheers, Ralf

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/831df5f8-a5d3-4c90-b4c7-d40f12df514d%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/831df5f8-a5d3-4c90-b4c7-d40f12df514d%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/c8c251f4-00f6-4229-b7f2-760ec3b0d6db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

yeah may be due to that
..
i am using 1.4.2

On Mon, Apr 27, 2015 at 5:47 PM, rh@hubrick.com wrote:

which version do you use - i'm using 1.4.4. ?

On Monday, April 27, 2015 at 1:27:12 PM UTC+2, deepak.chauhan wrote:

may be .. i have tried this again in my index ..
it is working properly
Please check your mapping
or try on another field which is long

On Mon, Apr 27, 2015 at 4:31 PM, r...@hubrick.com wrote:

unfortunately the same issue, ...
Whats strange, filtering / querying these values works as expected. I
guess, that there is an internal mapping working unexpected.

"starRating": {
"buckets": [
{
"key": "0.0-1.0",
"from": 0.0,
"from_as_string": "0.0",
"to": 1.0,
"to_as_string": "1.0",
"doc_count": 5119
},
{
"key": "1.0-2.0",
"from": 1.0,
"from_as_string": "1.0",
"to": 2.0,
"to_as_string": "2.0",
"doc_count": 0
},
{
"key": "2.0-3.0",
"from": 2.0,
"from_as_string": "2.0",
"to": 3.0,
"to_as_string": "3.0",
"doc_count": 0
},
{
"key": "3.0-4.0",
"from": 3.0,
"from_as_string": "3.0",
"to": 4.0,
"to_as_string": "4.0",
"doc_count": 0
},
{
"key": "4.0-5.0",
"from": 4.0,
"from_as_string": "4.0",
"to": 5.0,
"to_as_string": "5.0",
"doc_count": 0
},
{
"key": "5.0-6.0",
"from": 5.0,
"from_as_string": "5.0",
"to": 6.0,
"to_as_string": "6.0",
"doc_count": 0
}
]
}

On Monday, April 27, 2015 at 12:52:35 PM UTC+2, deepak.chauhan wrote:

Besides the Terms filter in aggregation , you should use range
aggregation .
It would work like..

{
"aggs": {
stars" : {
"range" : {
"field" : "starRating" ,
"ranges": [{
"to": 5
}, {
"from": 5,
"to": 10
}, {
"from": 10,
"to": 15
}, {
"from": 15
}]

       }
}

}

On Mon, Apr 27, 2015 at 4:18 PM, r...@hubrick.com wrote:

Hey,

I'm a little bit stucked using Terms aggregations on a numeric field.

My schema looks like that:

{ ...
starRating:
{

  • type: "long"

}
...
}

I pass documents there, works fine.
I query them, using a Range Query like, works also fine:

{
"range": {
"starRating": {
"from": 0,
"to": 5,
}
}
}

Whenever I ask for Term Aggregations like:

{
"aggs": {
stars" : {
"terms" : { "field" : "starRating" }
}
}

OR Facets with

"facets" : {
"tag" : {
"terms" : {
"field" : "starRating"
}
}
}

Strange values are returned:

"facets": {
"tag": {
"_type": "terms",
"missing": 0,
"total": 3814,
"other": 0,
"terms": [
{
"term": 0.0,
"count": 2397
},
{
"term": 1.5E-323,
"count": 610
},
{
"term": 2.0E-323,
"count": 378
},
{
"term": 1.0E-323,
"count": 269
},
{
"term": 4.9E-324,
"count": 93
},
{
"term": 2.5E-323,
"count": 67
}
]
}
},
"aggregations": {
"stars": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0.0,
"doc_count": 2397
},
{
"key": 1.5E-323,
"doc_count": 610
},
{
"key": 2.0E-323,
"doc_count": 378
},
{
"key": 1.0E-323,
"doc_count": 269
},
{
"key": 4.9E-324,
"doc_count": 93
},
{
"key": 2.5E-323,
"doc_count": 67
}
]
}
}

Even in the Java Client, I get DoubleTerms instead of LongTerms.

Does anybody have an Idea, what wents wrong there. I would expect
Long-Keys and not Double keys (which are basically close to 0)
The Histogram (with interval of 1) also does not work, everything is
close to the zero valued key.

Cheers, Ralf

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/831df5f8-a5d3-4c90-b4c7-d40f12df514d%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/831df5f8-a5d3-4c90-b4c7-d40f12df514d%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/c8c251f4-00f6-4229-b7f2-760ec3b0d6db%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/c8c251f4-00f6-4229-b7f2-760ec3b0d6db%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/CAHzCMpotCzVQAn%2Bc3cdnA1SHZe05aO3LqmTR9HUdbgvE_KhFKQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

i have also tried on 1.5.1 , it is woring properly

On Mon, Apr 27, 2015 at 5:59 PM, Deepak Chauhan <
deepak.chauhan@daffodilsw.com> wrote:

yeah may be due to that
..
i am using 1.4.2

On Mon, Apr 27, 2015 at 5:47 PM, rh@hubrick.com wrote:

which version do you use - i'm using 1.4.4. ?

On Monday, April 27, 2015 at 1:27:12 PM UTC+2, deepak.chauhan wrote:

may be .. i have tried this again in my index ..
it is working properly
Please check your mapping
or try on another field which is long

On Mon, Apr 27, 2015 at 4:31 PM, r...@hubrick.com wrote:

unfortunately the same issue, ...
Whats strange, filtering / querying these values works as expected. I
guess, that there is an internal mapping working unexpected.

"starRating": {
"buckets": [
{
"key": "0.0-1.0",
"from": 0.0,
"from_as_string": "0.0",
"to": 1.0,
"to_as_string": "1.0",
"doc_count": 5119
},
{
"key": "1.0-2.0",
"from": 1.0,
"from_as_string": "1.0",
"to": 2.0,
"to_as_string": "2.0",
"doc_count": 0
},
{
"key": "2.0-3.0",
"from": 2.0,
"from_as_string": "2.0",
"to": 3.0,
"to_as_string": "3.0",
"doc_count": 0
},
{
"key": "3.0-4.0",
"from": 3.0,
"from_as_string": "3.0",
"to": 4.0,
"to_as_string": "4.0",
"doc_count": 0
},
{
"key": "4.0-5.0",
"from": 4.0,
"from_as_string": "4.0",
"to": 5.0,
"to_as_string": "5.0",
"doc_count": 0
},
{
"key": "5.0-6.0",
"from": 5.0,
"from_as_string": "5.0",
"to": 6.0,
"to_as_string": "6.0",
"doc_count": 0
}
]
}

On Monday, April 27, 2015 at 12:52:35 PM UTC+2, deepak.chauhan wrote:

Besides the Terms filter in aggregation , you should use range
aggregation .
It would work like..

{
"aggs": {
stars" : {
"range" : {
"field" : "starRating" ,
"ranges": [{
"to": 5
}, {
"from": 5,
"to": 10
}, {
"from": 10,
"to": 15
}, {
"from": 15
}]

       }
}

}

On Mon, Apr 27, 2015 at 4:18 PM, r...@hubrick.com wrote:

Hey,

I'm a little bit stucked using Terms aggregations on a numeric field.

My schema looks like that:

{ ...
starRating:
{

  • type: "long"

}
...
}

I pass documents there, works fine.
I query them, using a Range Query like, works also fine:

{
"range": {
"starRating": {
"from": 0,
"to": 5,
}
}
}

Whenever I ask for Term Aggregations like:

{
"aggs": {
stars" : {
"terms" : { "field" : "starRating" }
}
}

OR Facets with

"facets" : {
"tag" : {
"terms" : {
"field" : "starRating"
}
}
}

Strange values are returned:

"facets": {
"tag": {
"_type": "terms",
"missing": 0,
"total": 3814,
"other": 0,
"terms": [
{
"term": 0.0,
"count": 2397
},
{
"term": 1.5E-323,
"count": 610
},
{
"term": 2.0E-323,
"count": 378
},
{
"term": 1.0E-323,
"count": 269
},
{
"term": 4.9E-324,
"count": 93
},
{
"term": 2.5E-323,
"count": 67
}
]
}
},
"aggregations": {
"stars": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0.0,
"doc_count": 2397
},
{
"key": 1.5E-323,
"doc_count": 610
},
{
"key": 2.0E-323,
"doc_count": 378
},
{
"key": 1.0E-323,
"doc_count": 269
},
{
"key": 4.9E-324,
"doc_count": 93
},
{
"key": 2.5E-323,
"doc_count": 67
}
]
}
}

Even in the Java Client, I get DoubleTerms instead of LongTerms.

Does anybody have an Idea, what wents wrong there. I would expect
Long-Keys and not Double keys (which are basically close to 0)
The Histogram (with interval of 1) also does not work, everything is
close to the zero valued key.

Cheers, Ralf

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/831df5f8-a5d3-4c90-b4c7-d40f12df514d%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/831df5f8-a5d3-4c90-b4c7-d40f12df514d%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/c8c251f4-00f6-4229-b7f2-760ec3b0d6db%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/c8c251f4-00f6-4229-b7f2-760ec3b0d6db%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/CAHzCMppeTOeGBCYBQj%3DrZkZ-GjvTiU7p8SKXH3zMq22jF3uN_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

problem solved, when switching to 1.5.0+

On Monday, April 27, 2015 at 12:48:19 PM UTC+2, r...@hubrick.com wrote:

Hey,

I'm a little bit stucked using Terms aggregations on a numeric field.

My schema looks like that:

{ ...
starRating:
{

  • type: "long"

}
...
}

I pass documents there, works fine.
I query them, using a Range Query like, works also fine:

{
"range": {
"starRating": {
"from": 0,
"to": 5,
}
}
}

Whenever I ask for Term Aggregations like:

{
"aggs": {
stars" : {
"terms" : { "field" : "starRating" }
}
}

OR Facets with

"facets" : {
"tag" : {
"terms" : {
"field" : "starRating"
}
}
}

Strange values are returned:

"facets": {
"tag": {
"_type": "terms",
"missing": 0,
"total": 3814,
"other": 0,
"terms": [
{
"term": 0.0,
"count": 2397
},
{
"term": 1.5E-323,
"count": 610
},
{
"term": 2.0E-323,
"count": 378
},
{
"term": 1.0E-323,
"count": 269
},
{
"term": 4.9E-324,
"count": 93
},
{
"term": 2.5E-323,
"count": 67
}
]
}
},
"aggregations": {
"stars": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0.0,
"doc_count": 2397
},
{
"key": 1.5E-323,
"doc_count": 610
},
{
"key": 2.0E-323,
"doc_count": 378
},
{
"key": 1.0E-323,
"doc_count": 269
},
{
"key": 4.9E-324,
"doc_count": 93
},
{
"key": 2.5E-323,
"doc_count": 67
}
]
}
}

Even in the Java Client, I get DoubleTerms instead of LongTerms.

Does anybody have an Idea, what wents wrong there. I would expect
Long-Keys and not Double keys (which are basically close to 0)
The Histogram (with interval of 1) also does not work, everything is close
to the zero valued key.

Cheers, Ralf

--
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/9fb08d23-49ee-4baa-8df8-247797e0dee9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Okk ,Congratulation buddy

On Mon, Apr 27, 2015 at 6:15 PM, rh@hubrick.com wrote:

problem solved, when switching to 1.5.0+

On Monday, April 27, 2015 at 12:48:19 PM UTC+2, r...@hubrick.com wrote:

Hey,

I'm a little bit stucked using Terms aggregations on a numeric field.

My schema looks like that:

{ ...
starRating:
{

  • type: "long"

}
...
}

I pass documents there, works fine.
I query them, using a Range Query like, works also fine:

{
"range": {
"starRating": {
"from": 0,
"to": 5,
}
}
}

Whenever I ask for Term Aggregations like:

{
"aggs": {
stars" : {
"terms" : { "field" : "starRating" }
}
}

OR Facets with

"facets" : {
"tag" : {
"terms" : {
"field" : "starRating"
}
}
}

Strange values are returned:

"facets": {
"tag": {
"_type": "terms",
"missing": 0,
"total": 3814,
"other": 0,
"terms": [
{
"term": 0.0,
"count": 2397
},
{
"term": 1.5E-323,
"count": 610
},
{
"term": 2.0E-323,
"count": 378
},
{
"term": 1.0E-323,
"count": 269
},
{
"term": 4.9E-324,
"count": 93
},
{
"term": 2.5E-323,
"count": 67
}
]
}
},
"aggregations": {
"stars": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0.0,
"doc_count": 2397
},
{
"key": 1.5E-323,
"doc_count": 610
},
{
"key": 2.0E-323,
"doc_count": 378
},
{
"key": 1.0E-323,
"doc_count": 269
},
{
"key": 4.9E-324,
"doc_count": 93
},
{
"key": 2.5E-323,
"doc_count": 67
}
]
}
}

Even in the Java Client, I get DoubleTerms instead of LongTerms.

Does anybody have an Idea, what wents wrong there. I would expect
Long-Keys and not Double keys (which are basically close to 0)
The Histogram (with interval of 1) also does not work, everything is
close to the zero valued key.

Cheers, Ralf

--
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/9fb08d23-49ee-4baa-8df8-247797e0dee9%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/9fb08d23-49ee-4baa-8df8-247797e0dee9%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/CAHzCMpoqkTnDab513ZPY-B7VqkHjqVsQC0ACrE%3DOEe6rD9Rtaw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.