Fields with same name as recognized types


(Octavian) #1

Hy,

I have a problem with fields having the same name as known types. For
example, I have the following mapping:

{
"ip_info" : {
"properties" : {
"lat" : {"type" : "double"},
"long" : {"type" : "double"}
}
}
}

I put the following docs in this field:

{
"lat":42.3535,
"long":32.35544545
}

{
"lat":41.3535,
"long":32.35544545
}

{
"lat":41.3535,
"long":32.15544545
}

When I try to do a top on these fields, the lat is working very good:
{"aggs":{"top-tags":{"terms":{"field":"lat","size":3}}}}

returns:
{
aggregations: {
top-tags: {
buckets: [
{
key: 41.3535
doc_count: 2}
{
key: 42.3535
doc_count: 1}]}}
}

But when I try to do a top on "long", the following message is thrown:
{

  • error: ReduceSearchPhaseException[Failed to execute phase [fetch],
    [reduce] ]; nested:
    ClassCastException[org.elasticsearch.search.aggregations.bucket.terms.DoubleTerms$Bucket
    cannot be cast to
    org.elasticsearch.search.aggregations.bucket.terms.LongTerms$Bucket];
  • status: 503

}

I'm using elasticsearch 1.1.1.

What I'm doing wrong?

Thaank you,

--
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/8ef2eb7b-10b0-4fe7-9cf2-6b1a99833bbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Colin Goodheart-Smithe) #2

Hi,

I have tried to reproduce your issue on both the master branch and on
version 1.1.1 but both seem to work as expected. The commands I ran are in
the following gist:

Could you have a look at let me know if I misunderstood something about
your problem?

Colin

On Friday, 8 August 2014 10:14:37 UTC+1, Octavian wrote:

Hy,

I have a problem with fields having the same name as known types. For
example, I have the following mapping:

{
"ip_info" : {
"properties" : {
"lat" : {"type" : "double"},
"long" : {"type" : "double"}
}
}
}

I put the following docs in this field:

{
"lat":42.3535,
"long":32.35544545
}

{
"lat":41.3535,
"long":32.35544545
}

{
"lat":41.3535,
"long":32.15544545
}

When I try to do a top on these fields, the lat is working very good:
{"aggs":{"top-tags":{"terms":{"field":"lat","size":3}}}}

returns:
{
aggregations: {
top-tags: {
buckets: [
{
key: 41.3535
doc_count: 2}
{
key: 42.3535
doc_count: 1}]}}
}

But when I try to do a top on "long", the following message is thrown:
{

  • error: ReduceSearchPhaseException[Failed to execute phase [fetch],
    [reduce] ]; nested:
    ClassCastException[org.elasticsearch.search.aggregations.bucket.terms.DoubleTerms$Bucket
    cannot be cast to
    org.elasticsearch.search.aggregations.bucket.terms.LongTerms$Bucket];
  • status: 503

}

I'm using elasticsearch 1.1.1.

What I'm doing wrong?

Thaank you,

--
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/f401b6c0-9af7-4dc1-bb31-d7ab295ef1e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Octavian) #3

Yes, that are the commands that should reproduce this.

If on your version works ok, that my question is why on my setup doing a
top on long field returns the error (

  • error: ReduceSearchPhaseException[Failed to execute phase [fetch],
    [reduce] ]; nested:
    ClassCastException[org.elasticsearch.search.aggregations.bucket.terms.DoubleTerms$Bucket
    cannot be cast to
    org.elasticsearch.search.aggregations.bucket.terms.LongTerms$Bucket];

)

Basically, ES tries to convert the fields from double to long. Why is doing
this?
On Friday, August 8, 2014 2:47:32 PM UTC+3, Colin Goodheart-Smithe wrote:

Hi,

I have tried to reproduce your issue on both the master branch and on
version 1.1.1 but both seem to work as expected. The commands I ran are in
the following gist:
https://gist.github.com/colings86/d67e00c378ee28c4485a

Could you have a look at let me know if I misunderstood something about
your problem?

Colin

On Friday, 8 August 2014 10:14:37 UTC+1, Octavian wrote:

Hy,

I have a problem with fields having the same name as known types. For
example, I have the following mapping:

{
"ip_info" : {
"properties" : {
"lat" : {"type" : "double"},
"long" : {"type" : "double"}
}
}
}

I put the following docs in this field:

{
"lat":42.3535,
"long":32.35544545
}

{
"lat":41.3535,
"long":32.35544545
}

{
"lat":41.3535,
"long":32.15544545
}

When I try to do a top on these fields, the lat is working very good:
{"aggs":{"top-tags":{"terms":{"field":"lat","size":3}}}}

returns:
{
aggregations: {
top-tags: {
buckets: [
{
key: 41.3535
doc_count: 2}
{
key: 42.3535
doc_count: 1}]}}
}

But when I try to do a top on "long", the following message is thrown:
{

  • error: ReduceSearchPhaseException[Failed to execute phase [fetch],
    [reduce] ]; nested:
    ClassCastException[org.elasticsearch.search.aggregations.bucket.terms.DoubleTerms$Bucket
    cannot be cast to
    org.elasticsearch.search.aggregations.bucket.terms.LongTerms$Bucket];
  • status: 503

}

I'm using elasticsearch 1.1.1.

What I'm doing wrong?

Thaank you,

--
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/ecd62598-99d4-488f-a749-7597c326d0bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Colin Goodheart-Smithe) #4

I am not sure why your setup is producing this issue. To help to diagnose
the cause could you please post the mappings for the index (see [1] for how
to do this) and the complete cURL command for your search request?

Thanks

Colin

[1] http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get-mapping.html#indices-get-mapping

On Monday, 11 August 2014 10:12:05 UTC+1, Octavian wrote:

Yes, that are the commands that should reproduce this.

If on your version works ok, that my question is why on my setup doing a
top on long field returns the error (

  • error: ReduceSearchPhaseException[Failed to execute phase [fetch],
    [reduce] ]; nested:
    ClassCastException[org.elasticsearch.search.aggregations.bucket.terms.DoubleTerms$Bucket
    cannot be cast to
    org.elasticsearch.search.aggregations.bucket.terms.LongTerms$Bucket];

)

Basically, ES tries to convert the fields from double to long. Why is
doing this?
On Friday, August 8, 2014 2:47:32 PM UTC+3, Colin Goodheart-Smithe wrote:

Hi,

I have tried to reproduce your issue on both the master branch and on
version 1.1.1 but both seem to work as expected. The commands I ran are in
the following gist:
https://gist.github.com/colings86/d67e00c378ee28c4485a

Could you have a look at let me know if I misunderstood something about
your problem?

Colin

On Friday, 8 August 2014 10:14:37 UTC+1, Octavian wrote:

Hy,

I have a problem with fields having the same name as known types. For
example, I have the following mapping:

{
"ip_info" : {
"properties" : {
"lat" : {"type" : "double"},
"long" : {"type" : "double"}
}
}
}

I put the following docs in this field:

{
"lat":42.3535,
"long":32.35544545
}

{
"lat":41.3535,
"long":32.35544545
}

{
"lat":41.3535,
"long":32.15544545
}

When I try to do a top on these fields, the lat is working very good:
{"aggs":{"top-tags":{"terms":{"field":"lat","size":3}}}}

returns:
{
aggregations: {
top-tags: {
buckets: [
{
key: 41.3535
doc_count: 2}
{
key: 42.3535
doc_count: 1}]}}
}

But when I try to do a top on "long", the following message is thrown:
{

  • error: ReduceSearchPhaseException[Failed to execute phase [fetch],
    [reduce] ]; nested:
    ClassCastException[org.elasticsearch.search.aggregations.bucket.terms.DoubleTerms$Bucket
    cannot be cast to
    org.elasticsearch.search.aggregations.bucket.terms.LongTerms$Bucket];
  • status: 503

}

I'm using elasticsearch 1.1.1.

What I'm doing wrong?

Thaank you,

--
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/6fb2d7c3-8614-453f-b758-dbb4e52d23f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #5