-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aggregations that return field values do not respect output format #5254
Aggregations that return field values do not respect output format #5254
Comments
Related to #2458 |
@PSeitz have you checked what elasticsearch does there? |
ES does not return POST /aggs1/_doc/1
{ "value": 4.56e-9 }
GET /aggs1/_search
{
"size": 0,
"aggs": {"number_terms": { "terms": { "field": "value" }}
}
}
...
"buckets": [
{
"key": 4.559999933206882e-9,
"doc_count": 1
}
] It would make sense to generally return |
In elasticsearch, we have this number mapped as a {
took: 34549,
timed_out: false,
_shards: { total: 3, successful: 3, skipped: 0, failed: 0 },
_clusters: { total: 1, successful: 1, skipped: 0 },
hits: {
total: { value: 10000, relation: 'gte' },
max_score: null,
hits: []
},
aggregations: {
dupes: {
doc_count_error_upper_bound: 3,
sum_other_doc_count: 53864635,
buckets: [
{ key: 1769070189829214200, doc_count: 1 },
{ key: 1769070189829214200, doc_count: 1 },
{ key: 1769070189837602800, doc_count: 1 },
{ key: 1769070189837602800, doc_count: 1 },
{ key: 1769070189837602800, doc_count: 1 },
{ key: 1769070189837602800, doc_count: 1 },
{ key: 1769070189837602800, doc_count: 1 },
{ key: 1769070189837602800, doc_count: 1 },
{ key: 1769070189837602800, doc_count: 1 },
{ key: 1769070189837602800, doc_count: 1 }
]
}
}
} |
Although, It does appear that the number is being truncated somewhere. |
@PSeitz I still don't understand the status of this ticket. Can you update? You also haven't said if ES was serializing stuff as u64 in decimal form. Eric is suggesting this is the case. |
ES returns long values not in scientific notation, but truncates them (also shown by Erics example). PUT /long_aggs
{
"mappings": {
"properties": {
"number_field": {
"type": "long"
}
}
}
}
# Add another document to aggs
POST /long_aggs/_doc/1
{
"value": 1769070189829214202
}
GET /long_aggs/_search
{
"size": 0,
"aggs": {
"number_terms": {"terms": {"field": "value"}}
}
}
...
"aggregations": {
"number_terms": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 1769070189829214200,
"doc_count": 1
}
]
}
} Currently we store numeric keys in the term aggregation as f64. If we extend the Having multiple numerical types adds some complexity though, e.g. merging aggregation results with mixed types. |
@esatterwhite u64 numbers should now be correctly serialized with full precision |
Describe the bug
The output format is not respected on aggregations that return field values, such as bucket aggregations, For example, u64 fields that are serialized to json will return a number in scientific notation.
Steps to reproduce (if applicable)
Field Definition
Query
Will return
Expected behavior
If a field has a defined output format in the index field mapping, it should be used to format the field value before it is serialized
Build Info
The text was updated successfully, but these errors were encountered: