I have a field that is a numerical value. I never need to search on it or filter on it, so it is not indexed. Is there any way to aggregate this field?
The code below doesn't work. total_profits
is always zero.
"aggs": { "by_day_count": { "date_histogram": { "field": "purchase_date", "calendar_interval": "1d", "time_zone": "Asia/Tokyo", "min_doc_count": 1 } }, "by_day_count2": { "date_histogram": { "field": "purchase_date", "calendar_interval": "1d", "time_zone": "Asia/Tokyo", "min_doc_count": 1 }, "aggs": { "gross_sales": { "sum": { "field": "total" <-- indexed, works fine. } }, "total_profits": { "sum": { "field": "total_profit" <-- non-indexed field } } } } },
https://stackoverflow.com/questions/66817451/in-elasticsearch-is-it-possible-to-sum-a-non-indexed-field March 26, 2021 at 09:00PM
没有评论:
发表评论