Merging Reducing the aggregations failed when computing the aggregation – How to solve this OpenSearch exception

Opster Team

Aug-23, Version: 1-1.1

Before you dig into reading this guide, have you tried asking OpsGPT what this log means? You’ll receive a customized analysis of your log.

Try OpsGPT now for step-by-step guidance and tailored insights into your OpenSearch operation.

Briefly, this error occurs when OpenSearch is unable to combine the results of the aggregations from different shards. This could be due to memory issues, complex queries, or a bug in the system. To resolve this, you can try simplifying your query, increasing the memory allocation for OpenSearch, or updating your OpenSearch version to the latest one to fix potential bugs. Additionally, consider optimizing your data model to reduce the complexity of the aggregations.

For a complete solution to your to your search operation, try for free AutoOps for Elasticsearch & OpenSearch . With AutoOps and Opster’s proactive support, you don’t have to worry about your search operation – we take charge of it. Get improved performance & stability with less hardware.

This guide will help you check for common problems that cause the log ” Merging/Reducing the aggregations failed when computing the aggregation [ ” to appear. To understand the issues related to this log, read the explanation below about the following OpenSearch concepts: aggregations, search.

Log Context

Log “Merging/Reducing the aggregations failed when computing the aggregation [” class name is We extracted the following from OpenSearch source code for those seeking an in-depth context :

 if (referenceTerms != null &&
 referenceTerms.getClass().equals(terms.getClass()) == false &&
 terms.getClass().equals(UnmappedRareTerms.class) == false) {
 // control gets into this loop when the same field name against which the query is executed
 // is of different types in different indices.
 throw new AggregationExecutionException("Merging/Reducing the aggregations failed when computing the aggregation ["
 + referenceTerms.getName() + "] because the field you gave in the aggregation query existed as two different "
 + "types in two different indices");
 for (B bucket : terms.getBuckets()) {
 List bucketList = buckets.computeIfAbsent(bucket.getKey(); k -> new ArrayList<>());


How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Get expert answers on Elasticsearch/OpenSearch