Re: histogram aggregation with float interval < 1.0 gives ArithmeticException

2014-10-27 Thread Mark Molloy
Hi Adrien,

Thanks for letting me know!

-Mark

On Mon, Oct 27, 2014 at 12:14 PM, Adrien Grand <
adrien.gr...@elasticsearch.com> wrote:

> Hi Mark,
>
> This is unfortunately a known limitation of histograms today: they only
> work with integer intervals.
>
> https://github.com/elasticsearch/elasticsearch/issues/4847
>
>
> On Mon, Oct 27, 2014 at 1:17 PM, LiquidMark 
> wrote:
>
>> Hi, the following query (note bolded line):
>>
>> {
>>   "query": {
>> "filtered": {
>>   "query": {
>> "term": {
>>   "self_and_ancestors": "diamonds"
>> }
>>   },
>>   "filter": {
>> "terms": {
>>   "attr_types.diamond#color": [
>> "d"
>>   ]
>> }
>>   }
>> }
>>   },
>>   "sort": [
>> {
>>   "sell_offer_cents": {
>> "order": "asc"
>>   }
>> }
>>   ],
>>   "fields": "_source",
>>   "script_fields": {
>> "gap_cents": {
>>   "script": "custom_score_item_bid_ask_gap",
>>   "params": {
>> "individual_price_item_ids": [],
>> "individual_price_item_cents": [],
>> "pb_amount_below_cents": 0
>>   },
>>   "lang": "native"
>> }
>>   },
>>   "aggs": {
>> "all_items": {
>>   "global": {},
>>   "aggs": {
>> "gem#carats": {
>>   "filter": {
>> "terms": {
>>   "attr_types.diamond#polish": [
>> "ex",
>> "0001vg"
>>   ]
>> }
>>   },
>>   "aggs": {
>> "gems#carats": {
>>   "histogram": {
>> "field": "attr_types.gem#carats",
>>   *  "interval": 0.1,*
>> "min_doc_count": 0
>>   }
>> },
>> "gem#carats_stats": {
>>   "stats": {
>> "field": "attr_types.gem#carats"
>>   }
>> }
>>   }
>> }
>>   }
>> }
>>   }
>> }
>>
>> Gives the following error:
>>
>> {
>>"error": "SearchPhaseExecutionException[Failed to execute phase
>> [query], all shards failed; shardFailures
>> {[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][4]:
>> QueryPhaseExecutionException[[development-liquidibles::application-items][4]:
>> query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[> org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@11ce49a>]:
>> Query Failed [Failed to execute global aggregators]]; nested:
>> ArithmeticException;
>> }{[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][3]:
>> QueryPhaseExecutionException[[development-liquidibles::application-items][3]:
>> query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[> org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@8c9d82>]:
>> Query Failed [Failed to execute global aggregators]]; nested:
>> ArithmeticException;
>> }{[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][2]:
>> QueryPhaseExecutionException[[development-liquidibles::application-items][2]:
>> query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[> org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@73a7e5>]:
>> Query Failed [Failed to execute global aggregators]]; nested:
>> ArithmeticException;
>> }{[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][1]:
>> QueryPhaseExecutionException[[development-liquidibles::application-items][1]:
>> query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[> org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@15d1b1a>]:
>> Query Failed [Failed to execute global aggregators]]; nested:
>> ArithmeticException;
>> }{[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][0]:
>> QueryPhaseExecutionException[[development-liquidibles::application-items][0]:
>> query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[> org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@1b8c216>]:
>> Query Failed [Failed to execute global aggregators]]; nested:
>> *ArithmeticException*; }]",
>>"status": 500
>> }
>>
>> If I change the interval to be 1.0 or greater, it works. But, I want
>> intervals of 0.1...
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elasticsearch/b8dad371-dfef-4c57-b7d8-433ee1

Re: histogram aggregation with float interval < 1.0 gives ArithmeticException

2014-10-27 Thread Adrien Grand
Hi Mark,

This is unfortunately a known limitation of histograms today: they only
work with integer intervals.

https://github.com/elasticsearch/elasticsearch/issues/4847


On Mon, Oct 27, 2014 at 1:17 PM, LiquidMark  wrote:

> Hi, the following query (note bolded line):
>
> {
>   "query": {
> "filtered": {
>   "query": {
> "term": {
>   "self_and_ancestors": "diamonds"
> }
>   },
>   "filter": {
> "terms": {
>   "attr_types.diamond#color": [
> "d"
>   ]
> }
>   }
> }
>   },
>   "sort": [
> {
>   "sell_offer_cents": {
> "order": "asc"
>   }
> }
>   ],
>   "fields": "_source",
>   "script_fields": {
> "gap_cents": {
>   "script": "custom_score_item_bid_ask_gap",
>   "params": {
> "individual_price_item_ids": [],
> "individual_price_item_cents": [],
> "pb_amount_below_cents": 0
>   },
>   "lang": "native"
> }
>   },
>   "aggs": {
> "all_items": {
>   "global": {},
>   "aggs": {
> "gem#carats": {
>   "filter": {
> "terms": {
>   "attr_types.diamond#polish": [
> "ex",
> "0001vg"
>   ]
> }
>   },
>   "aggs": {
> "gems#carats": {
>   "histogram": {
> "field": "attr_types.gem#carats",
>   *  "interval": 0.1,*
> "min_doc_count": 0
>   }
> },
> "gem#carats_stats": {
>   "stats": {
> "field": "attr_types.gem#carats"
>   }
> }
>   }
> }
>   }
> }
>   }
> }
>
> Gives the following error:
>
> {
>"error": "SearchPhaseExecutionException[Failed to execute phase
> [query], all shards failed; shardFailures
> {[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][4]:
> QueryPhaseExecutionException[[development-liquidibles::application-items][4]:
> query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[ org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@11ce49a>]:
> Query Failed [Failed to execute global aggregators]]; nested:
> ArithmeticException;
> }{[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][3]:
> QueryPhaseExecutionException[[development-liquidibles::application-items][3]:
> query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[ org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@8c9d82>]:
> Query Failed [Failed to execute global aggregators]]; nested:
> ArithmeticException;
> }{[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][2]:
> QueryPhaseExecutionException[[development-liquidibles::application-items][2]:
> query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[ org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@73a7e5>]:
> Query Failed [Failed to execute global aggregators]]; nested:
> ArithmeticException;
> }{[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][1]:
> QueryPhaseExecutionException[[development-liquidibles::application-items][1]:
> query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[ org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@15d1b1a>]:
> Query Failed [Failed to execute global aggregators]]; nested:
> ArithmeticException;
> }{[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][0]:
> QueryPhaseExecutionException[[development-liquidibles::application-items][0]:
> query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[ org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@1b8c216>]:
> Query Failed [Failed to execute global aggregators]]; nested:
> *ArithmeticException*; }]",
>"status": 500
> }
>
> If I change the interval to be 1.0 or greater, it works. But, I want
> intervals of 0.1...
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/b8dad371-dfef-4c57-b7d8-433ee1c308c6%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Adrien Grand

-- 
You receive

histogram aggregation with float interval < 1.0 gives ArithmeticException

2014-10-27 Thread LiquidMark
Hi, the following query (note bolded line):

{
  "query": {
"filtered": {
  "query": {
"term": {
  "self_and_ancestors": "diamonds"
}
  },
  "filter": {
"terms": {
  "attr_types.diamond#color": [
"d"
  ]
}
  }
}
  },
  "sort": [
{
  "sell_offer_cents": {
"order": "asc"
  }
}
  ],
  "fields": "_source",
  "script_fields": {
"gap_cents": {
  "script": "custom_score_item_bid_ask_gap",
  "params": {
"individual_price_item_ids": [],
"individual_price_item_cents": [],
"pb_amount_below_cents": 0
  },
  "lang": "native"
}
  },
  "aggs": {
"all_items": {
  "global": {},
  "aggs": {
"gem#carats": {
  "filter": {
"terms": {
  "attr_types.diamond#polish": [
"ex",
"0001vg"
  ]
}
  },
  "aggs": {
"gems#carats": {
  "histogram": {
"field": "attr_types.gem#carats",
  *  "interval": 0.1,*
"min_doc_count": 0
  }
},
"gem#carats_stats": {
  "stats": {
"field": "attr_types.gem#carats"
  }
}
  }
}
  }
}
  }
}

Gives the following error:

{
   "error": "SearchPhaseExecutionException[Failed to execute phase [query], 
all shards failed; shardFailures 
{[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][4]: 
QueryPhaseExecutionException[[development-liquidibles::application-items][4]: 
query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[]:
 
Query Failed [Failed to execute global aggregators]]; nested: 
ArithmeticException; 
}{[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][3]: 
QueryPhaseExecutionException[[development-liquidibles::application-items][3]: 
query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[]:
 
Query Failed [Failed to execute global aggregators]]; nested: 
ArithmeticException; 
}{[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][2]: 
QueryPhaseExecutionException[[development-liquidibles::application-items][2]: 
query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[]:
 
Query Failed [Failed to execute global aggregators]]; nested: 
ArithmeticException; 
}{[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][1]: 
QueryPhaseExecutionException[[development-liquidibles::application-items][1]: 
query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[]:
 
Query Failed [Failed to execute global aggregators]]; nested: 
ArithmeticException; 
}{[D6h8GKwjRqO_Yem09Hu_VA][development-liquidibles::application-items][0]: 
QueryPhaseExecutionException[[development-liquidibles::application-items][0]: 
query[filtered(filtered(self_and_ancestors:diamonds)->cache(attr_types.diamond#color:d))->cache(_type:item)],from[0],size[10],sort[]:
 
Query Failed [Failed to execute global aggregators]]; nested: 
*ArithmeticException*; }]",
   "status": 500
}

If I change the interval to be 1.0 or greater, it works. But, I want 
intervals of 0.1...

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/b8dad371-dfef-4c57-b7d8-433ee1c308c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.