Closed mruediger closed 9 years ago
Hi @mruediger
Did you map the the value
field explicitly, or just rely on dynamic mapping? Currently there is an issue where a new field can be added to two shards at the same time, with different mappings (eg double
vs long
). One mapping will win, but the other mapping continues to exist on the other shard.
I think this is what you're running into. When you run the aggregations, some shards are returning longs while other shards are returning doubles, which is causing this mixup.
We plan on fixing this mapping issue, but in the meantime you can handle this by explicitly specifying the field type.
Hey @clintongormley , thanks for the quick reply.
I suspected something like this and ran
curl -XPUT http://localhost:9200/sensu/_mapping/cpu_metrics/ -d '{ "cpu_metrics" : { "properties" : { "value" : { "type" : "long" }}}}'
I don't now if that is enough to configure the mapping. Is it even possible to set the mapping for data that is already stored? Sorry, I am pretty new to elasticsearch.
-Mathias
@mruediger no worries :)
It isn't sufficient to fix existing mappings. You will need to reindex.
btw, a colleague has just clarified my description of the problem, as it is not quite as clear cut as a described. In your case the long
mapping won. The problem shows up when the primary or replica shard with the internal double
mapping is moved to another node, which then interprets the existing data as long
, when really it has been indexed as a double
.
Reindexing is the only way forward here I'm afraid. Perhaps try a subset of the data first, to confirm that it is the issue.
I will try that. Thanks!
please let us know if that works - if it doesn't then there is another issue
It seems to be working now. Thanks :-)
Its normal that the min/max and avg results are returned as a floating point number (e.g. 4.654463936E9)?
Mathias
Hi @mruediger
Yes, these aggs always return doubles.
Hi. I am trying to use elasticsearch to store metrics of our cluster. The collection is done using sensu and the values in elasticsearch still have the fields "key","value" and "timestamp" that you would see in graphite. When I create a average/max/min histogram over our metrics I get weird results. The average cpu utilisation of our cluster is 1.22907852E-315 according to elasticsearch. At first glance I suspected a overflow issue, but there are simply not enough results to cause that.
The json I am using is the following:
The result looks like this:
I checked the mapping of the type and everything looks good:
I suspect I misunderstood some of the syntax and the error is on my side, but after studying the documentation for quite a while I still cannot figure out what is wrong with my search.
Thanks, Mathias